0
これはCSSのアニメーションで可能かどうかわかりません...ステップ()を使用してスプライトをアニメーション化しようとしていますが、特定のフレームを他のものよりも長く(フレーム#1 .5s 、フレーム#2 .2s、フレーム#3~#5 .1sなど)を含む。私は複数のステップアニメーションを使用しようとしましたが、それは動作していないようです。何か案は?CSSのステップ()の変更点は
@keyframes throw{
100% {background-position: 380px;}
}
@keyframes hold{
100% {background-position: 760px;}
}
@keyframes drop{
100% {background-position: 1520px;}
}
#cheerleader{
position:absolute
top: 110px;
left: 15%;
width: 190px;
height: 240px;
margin: 0 auto;
background: url("/assets/images/cheer01.png") left center;
animation:
throw .5s steps(1, 2) infinite,
hold .2s steps(3, 4),
drop .8s steps(5, 8),
}
ご協力いただきまして誠にありがとうございます。ありがとう!
私の更新されたコードはこれです:
@keyframes hold{
0% { background-position-x: 0px; }
100% {background-position-x: 160px; }
}
@keyframes grab{
0% {background-position-x: 160px; }
100% {background-position-x: 480px; }
}
@keyframes propped{
0% {background-position-x: 480px;}
100% {background-position-x: 800px;}
}
@keyframes throw{
0% {background-position-x: 800px;}
100% {background-position-x: 960px;}
}
@keyframes catch{
0% {background-position-x: 960px;}
100% {background-position-x: 1280px;}
}
.cheerpeopleone{
position:absolute;
top:110px;
left:15%;
width:160px;
height:320px;
margin: 0 auto;
background: url('/assets/images/cheerpeopleone.png') left center;
animation:
hold 0.5s steps(1) infinite,
grab 0.3s steps(3) infinite,
propped 0.6s steps(2) infinite,
throw 0.2s steps(1) infinite,
catch 0.3s steps(3) infinite;
animation-delay: 0s, .5s, 0.8s, 1.4s, 1.6s;
z-index:90;
}
しかし、今、私はそれが無限に再生するときに動作していない遅延の問題が生じています。また、人物がフレームに滑り込んでからアニメートするので、私のポジショニングで何かが起こっていると思います。 PNGの全幅は1280ピクセルで、各フレームは160ピクセル幅です。
むしろ、前方よりも無限のアニメーションの実行を持つことが可能である場合、私は興味がありましたか?私自身がこれを試み、アニメーションの遅延は最初の繰り返しの後には動作しなくなりました。 –