animation properties css
<style>
@keyframes animatename{
0%{
transform: translateY(3px);
}
100%{
transform: translateY(-3px);
}
}
.my-div{
animation: animatename 1s linear infinite;
/* animation shorthand */
animation: animation-name animation-duration animation-direction animation-iteration-count
}
</style>
4.22
9
body{
background-color: purple;
}
@keyframes party{
0% {background-color: red;}
10% {background-color: orange;}
20% {background-color: yellow;}
30% {background-color: green;}
40% {background-color: blue;}
50% {background-color: purple;}
}
@-webkit-keyframes party{
0% {background-color: red;}
10% {background-color: orange;}
20% {background-color: yellow;}
30% {background-color: green;}
40% {background-color: blue;}
50% {background-color: purple;}
}
Thank you!
9
0
4
1
<html>
<body id="bd">
<button onclick="party()">Press Me!</button>
</body>
</html>
Thank you!
1
0
4
3
<style>
.my-element {
width: 100%;
height: 100%;
animation: tween-color 5s infinite;
}
@keyframes tween-color {
0% {
background-color: red;
}
50% {
background-color: green;
}
100% {
background-color: red;
}
}
html,
body {
height: 100%;
}
<style>
<body>
<div class="my-element"></div>
</body>
Thank you!
3
0
4.5
2
animation: name time func delay iteration dir fill play;
animation: none 0s ease 0s 1 normal none running;
Thank you!
2
0
5
1
function party(){
document.body.style.animation = 'party 2.5s infinite linear';
}
Thank you!
1
0
Are there any code examples left?
New code examples in category CSS