Lead image courtesy of Alltechbuzz on Pexels.
Web animations can be used to attract attention, engage people better, and communicate more clearly and effectively. It can engage and hold people's attention longer than just a static web page.
@keyframes
RuleWhen you specify CSS styles inside the @keyframes rule, the animation will gradually change form the current style to the new style at certain times.
The animation is specified by using two types keywords: from - to and
0% - 100%
.NOTE: By using per cent, you can add as many style changes as you like, For Example On (0%, 20%, 40%, 80% and 100%).
To get an animation to work, you must bind the animation to an element.
.content{
width: 100px;
height: 100px;
color: orange;
animation-name: false;
animation-duration: 0.3s;
}
@keyframes fade {
from{ opacity: 0; }
to{ opacity: 1; }
}
If the animation-duration property is not specified, no animation will occur, because the default value is 0s.
The
animation-delay
property specifies a delay for the start of an animationThe
animation-iteration-count
property specifies the number of times an animation should run.The animation-direction property specifies whether an animation should be played forwards, backwards or in alternate cycles.
The animation-direction property can have the following:
The
animation-timing-function
property specifies the speed curve of the animation.The animation-timing-function property can have the following values:
Animation does not affect an element before the first keyframe is played or after the last keyframe is played. The
animation-fill-mode
property is used to override this behavior.The
animation-fill-mode
property specifies a style for the target element when the animation is not playing (before it starts after it ends, or both).content{
width: 100px;
height: 100px;
color: orange;
/*animation: name duration timing-function delay iteration-count direction filll-mode*/
animation: fade 0.3s ease 1s 1 reverse forwards;
}
⌛ Thanks For Reading | Happy Coding 🍵
SUPPORT ME
Previously published here.