animation properties css code example
Example 1: css animation
<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>
Example 2: animation shorthand css
animation: name time func delay iteration dir fill play;
animation: none 0s ease 0s 1 normal none running;
Example 3: css animation
# css animaition .................... infinite dont stop
animation-name: example;
animation-duration: 1s;
animation-iteration-count: infinite;
@keyframes example {
0%{transform: rotate(0deg)}
50% {transform: rotate(5deg)}
75%{transform: rotate(0deg)}
100% {transform: rotate(50deg)}
}
Example 4: animation properties css
<html>
<body id="bd">
<button onclick="party()">Press Me!</button>
</body>
</html>
Example 5: animation properties css
function party(){
document.body.style.animation = 'party 2.5s infinite linear';
}
Example 6: animation properties css
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;}
}