Wie man Animation macht, bleibt 100% auf
animation-fill-mode:forwards;
L
animation-fill-mode:forwards;
animation: name time func delay iteration dir fill play;
animation: none 0s ease 0s 1 normal none running;
animation-name: none;
animation-duration: 0s;
animation-timing-function: ease;
animation-delay: 0s;
animation-iteration-count: 1;
animation-direction: normal;
animation-fill-mode: none;
animation-play-state: running;
article {
animation-name : displaceContent;
animation-duration : 1s;
animation-delay : 4s;
animation-iteration-count : 1;
animation-fill-mode : forwards;
}
@keyframes displaceContent {
from { transform : translateY(0em) }
to { transform : translateY(3em) } /* slide down to make room for advertisements */
}
Here a codePen with cool animations:
https://codepen.io/DevLorenzo/pen/ExgpvJM
div{
animation-name: rotateElement;
animation-duration: 6s;
width: 100px;
height: 100px;
padding: 10px;
text-align: center;
background: yellow;
border: 3px dashed blue;
}
@keyframes rotateElement{
from{
transform: rotate(0deg);
}
to{
transform: rotate(360deg);
}
}
/* The animation code */
@keyframes example {
from {background-color: red;}
to {background-color: yellow;}
}
/* The element to apply the animation to */
div {
width: 100px;
height: 100px;
background-color: red;
animation-name: example;
animation-duration: 4s;
}