js add animation to element
document.getElementById('test').style.animation = 'fading 2s infinite'
4
7
let rotate360 = [
{ transform: 'rotate(360deg)' }
];
Thank you!
7
0
5
4
#test {
background-color: blue;
width: 100px;
height: 100px;
position: relative;
-webkit-animation: fading 5s infinite;
animation: fading 5s infinite;
}
/* Here is the animation (keyframes) */
@keyframes fading {
0% { opacity: 1; }
100% { opacity: 0; }
}
Thank you!
4
0
4.33
6
< script src = ' /path/to/jquery.keyframes [.min ] .js ' > </ script >
Thank you!
6
0
3.7
11
var animation = element.animate(keyframes, options);
Thank you!
11
0
3.5
2
document.getElementById("tunnel").animate([
// keyframes
{ transform: 'translateY(0px)' },
{ transform: 'translateY(-300px)' }
], {
// timing options
duration: 1000,
iterations: Infinity
});
Thank you!
2
0
Are there any code examples left?
New code examples in category Javascript