
###時間差のアニメションを繰り返したい。
下記の記述は理想の流れのパターン
左から一つ目が上がって下がって止まる、二つ目が上がって下がって止まる、三つ目が上がって下がって止まって終わり、となっている。
これを、三つ目まで行ったら、また左から一つ目が動いて次、という風に動かしたい。
さらに理想をいうなれば、四つ目・五つ目と増えても、同じように動くようにしたい。
###時間差アニメーション
HTML
1 <ul id="line"> 2 <li><img src="img/img01.png" alt=""></li> 3 <li><img src="img/img02.png" alt=""></li> 4 <li><img src="img/img03.png" alt=""></li> 5 </ul>
css
1#line.motion li{ 2 position: relative; 3 animation-name: up; 4 animation-duration: 1s; 5} 6#line.motion li:nth-of-type(2){ 7 animation-delay: 1s; 8} 9#line.motion li:nth-of-type(3){ 10 animation-delay: 2s; 11} 12@keyframes up{ 13 0% { 14 top: 0; 15 } 16 50% { 17 top: -10px; 18 } 19 100% { 20 top: 0; 21 } 22}
javascript
1$(document).ready(function(i){ 2 $("#line").addClass("motion"); 3});
###失敗例()
上記の記述に
「animation-iteration-count」を追記したら
上がって下がって止まるではなく、上がって下がってを繰り返している。
css
1#line.motion li{ 2 position: relative; 3 animation-name: up; 4 animation-duration: 1s; 5 animation-iteration-count: infinite; 6} 7#line.motion li:nth-of-type(2){ 8 animation-delay: 1s; 9} 10#line.motion li:nth-of-type(3){ 11 animation-delay: 2s; 12} 13@keyframes up{ 14 0% { 15 top: 0; 16 } 17 50% { 18 top: -10px; 19 } 20 100% { 21 top: 0; 22 } 23}
語彙力が低くて、思っていることが伝わっているか分からないけど、助けを求める。

回答3件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
退会済みユーザー
2017/03/03 01:01