Aar*_*iba 3 html css css3 css-transforms css-animations
我正在尝试更改CSS动画关键帧,它正在反弹Y轴方向,但我试图将其更改为X轴意味着尝试从左到右或从右到左反弹.
小提琴: http ://jsfiddle.net/5y8ebfcw/
HTML:
<div class='thisone'></div>
Run Code Online (Sandbox Code Playgroud)
CSS:
.thisone {
-webkit-animation-name: slybounce;
-webkit-animation-duration: 3s;
-webkit-animation-timing-function: ease-in-out;
-webkit-animation-iteration-count: infinite;
-webkit-animation-delay: 0;
-webkit-animation-play-state: running;
-moz-animation-name: slybounce;
-moz-animation-duration: 3s;
-moz-animation-timing-function: ease-in-out;
-moz-animation-iteration-count: infinite;
-moz-animation-delay: 0;
-moz-animation-play-state: running;
}
@-webkit-keyframes slybounce {
0% {
-webkit-transform: translate(0, -5);
}
50% {
-webkit-transform: translate(0, 5px);
}
100% {
-webkit-transform: translate(0, -5);
}
}
@-moz-keyframes slybounce {
0% {
-moz-transform: translate(0, -5);
}
50% {
-moz-transform: translate(0, 5px);
}
100% {
-moz-transform: translate(0, -5);
}
}
Run Code Online (Sandbox Code Playgroud)
我已经尝试过translate(0, 5px);
改为translateX(0, 5px);
问题小提琴: http
://jsfiddle.net/5y8ebfcw/5/
但是它不起作用.所以我的问题是如何动画从左到右或从右到左反弹.
谢谢.
将转换(x,y)中的操作数从translate(0,-5)
/转换translate(0,+5)
为translate(-5,0)
/ translate(+5,0)
.
甚至更好,使用translateX而不是翻译