2016-10-22 16 views
0

アニメーションの背景イメージがあります。HTML5エンドレス背景アニメーション

エンドレスアニメーションはどうすればできますか?

(アニメーションがページの右側に行けば、私はそれを見たいページの左側に表示されます)

enter image description here

答えて

5

David Walsh - CSS Background Animations

@keyframes animatedBackground { 
 
    from { 
 
    background-position: 0 0; 
 
    } 
 
    to { 
 
    background-position: 100% 0; 
 
    } 
 
} 
 
#animate-area { 
 
    width: 560px; 
 
    height: 400px; 
 
    background-image: url(https://davidwalsh.name/demo/bg-clouds.png); 
 
    background-position: 0px 0px; 
 
    background-repeat: repeat-x; 
 
    animation: animatedBackground 40s linear infinite; 
 
}
<div id="animate-area"></div>

から元のコード
+0

おかげoğuzhan、偉大な:) –

2

あなたが左から右に言ったので、これを投稿しました。 このようなものを使用できます。

#horizontal-scroll { 
 
    width: 1439px; 
 
    height: 1170px; 
 
    background: black url(https://assets.periscope.tv/images/map.svg); 
 
    -webkit-animation: backgroundScroll 50s linear infinite; 
 
    animation: backgroundScroll 50s linear infinite; 
 
} 
 
@-webkit-keyframes backgroundScroll { 
 
    from { 
 
background-position: -1439px 0; 
 
    } 
 
    to { 
 
background-position: 0 0; 
 
    } 
 
} 
 
@keyframes backgroundScroll { 
 
    from { 
 
background-position: -1439px 0; 
 
    } 
 
    to { 
 
background-position: 0 0; 
 
    } 
 
}
<div id="horizontal-scroll"></div>

+0

おかげで動作します動作しますが、どのように私はそのようなことができます:https://www.periscope.tv/404(.E:背景をイメージ)アニメーションがあなたの答えで再開します –

+0

https://jsfiddle.net/norcaljohnny/eoswn2yv/ –

+0

ありがとう、チャームのように働く:) –

0
@keyframes customname 
{ 
    from { background-position: 0 0; } 
    to { background-position: 100% 0; } 
} 


classname 
{ 
    background-image: url(Url of tyour file); 
    width: width of the file; 
    height: Height of the file; 
    background-position: 0px 0px; 
    background-repeat: repeat-x; //Repeating through X axis only 

    animation: customname 40s linear infinite; 
} 
関連する問題