HTML5/CSS3 - how to make “endless” rotating background - 360 degrees panorama

后端 未结 6 1819
情深已故
情深已故 2021-02-04 16:41

i have a JPG image with the 360 degrees view of the city (9000px by 1000px). I need to create a page with endlessly rotating background - giving user an impress

6条回答
  •  北海茫月
    2021-02-04 17:17

    If you're only targeting webkit-browsers, you can accomplish this with CSS3 alone. CSS3 has built-in support for animations. By specifying 'infinite' with the iteration-count property, your animation will go on forever and ever and... You get the point ;-)

    @-webkit-keyframes rotateEndlessly
    {
        from 
        {
            -webkit-transform: rotate(0deg);
            transform: rotate(0deg);
        }
        to 
        {
            -webkit-transform: rotate(360deg);
            transform: rotate(360deg);
        }
    }
    
    img 
    {
        -webkit-animation-name: rotateEndlessly;
        -webkit-animation-duration: 2s;
        -webkit-animation-iteration-count: infinite;
        -webkit-animation-timing-function: linear;
    
    }
    

    And of course, the image in your HTML:

    image
    

提交回复
热议问题