What are Animations?
- CSS animations are used to apply animations on HTML elements.
- @keyframes is used to apply CSS animations.
This will be our boilerplate:
index.html
CSS Animation Properties
i) animation-name: It is used to specify the name of the animation.
ii) animation-duration: It is used to specify that, how long time an animation should take to complete one cycle.
iii) animation-delay: The animation-delay property specifies a delay for the start of an animation.
iv) animation-iteration-count: It is used to specify, how many times the animation will be played.
v) animation-direction: property specifies in which direction that animation should be played forwards, backward, or in alternate cycles.
vi) animation: It is the shorthand property to specify all the animation properties.
vii) animation-fill-mode: This property specifies, how a CSS animation applies styles to its target before and after its execution.
div { animation-fill-mode: forwards; }
viii) animation-play-state: This animation property is used to sets whether an animation is running or paused.
div { animation-play-state: running; }
CSS @keyframes
@keyframes animation-name { from {CSS properties} to {CSS properties} }
from { }: The place where from the animation will start.
to { }: The place where the animation will end.
animation-name: It takes the name of the animation.
"We can also use % values as keyframes selector"
@keyframes animation-name { 0% {CSS properties} 25% {CSS properties} 75% {CSS properties} 100% {CSS properties}}
Using CSS Animation Properties
index.html
Output:
Write this code in your Code Editor and See the output on the browser window.
Can you share pdf of this book
ReplyDelete