I’m trying to change CSS Animation keyframes, it’s bouncing Y axis direction, but I’m trying to change it to X axis means trying to bounce left to right or right to left.
Fiddle: http://jsfiddle.net/5y8ebfcw/
HTML:
<div class='thisone'></div>
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);
}
}
I have tried this by changing translate(0, 5px); to translateX(0, 5px);
Problem Fiddle: http://jsfiddle.net/5y8ebfcw/5/
But it’s not working. So my question is how to Animation bounce left to right or right to left.
Thanks.
.animate()method and animate it throughmargin-leftproperty ? Maybe this fiddle will give you some idea