custom animation css code example
Example 1: css keyframes animation
//css keyframes
#image{
width: 100px;
height: 100px;
background-color: red;
position: relative;
animation: monFrame 5s linear 2s infinite alternate;
}
@keyframes monFrame {
0% {left:0px; top:0px;}
25% {left:500px; top:0px;}
50% {left:500px; top:500px;}
75% {left:0px; top:500px;}
100% {left:0px; top:0px;}
}
Example 2: css animation
CSS animation properties template:
{
animation-name: anima-name;
animation-duration: 1s;
animation-iteration-count: infinite;
animation-delay: 2s;
animation-direction: reverse | normal | alternate | alternate-reverse ;
animation-timing-function: ease | ease-out | ease-in | ease-in-out | linear | cubic-bezier(x1, y1, x2, y2) (e.g. cubic-bezier(0.5, 0.2, 0.3, 1.0));
animation-fill-mode:forwards | backwards | both | none;
}
@keyframes anima-name {
from {
background-position:right;
}
to {
background-position:left;
}
}
@keyframes anima-name {
0% {
background-color: red;
}
50% {
background-color: green;
}
100% {
background-color: red;
}
}
Example 3: css animation
Read this helpful, short and straightforward article to learn CSS animation perfectly.
https://medium.com/@Cafe_Code/learn-css-animation-asap-as-simple-as-possible-374b7874d4dd