written 6.8 years ago by | • modified 2.8 years ago |
Subject: Advanced Internet Technology
Topic: Responsive web design with HTML5 and CSS3
Difficulty: Medium
written 6.8 years ago by | • modified 2.8 years ago |
Subject: Advanced Internet Technology
Topic: Responsive web design with HTML5 and CSS3
Difficulty: Medium
written 6.7 years ago by | • modified 6.7 years ago |
CSS-3 Animations
The @keyframes Rule
Standard syntax
@keyframes example {
from {background-color: red;}
to {background-color: yellow;}
}
The sub-properties of the animation property are:
- animation-delay Configures the delay between the time the element is loaded and the beginning of the animation sequence.
- animation-direction Configures whether or not the animation should alternate direction on each run through the sequence or reset to the start point and repeat itself.
- animation-duration Configures the length of time that an animation should take to complete one cycle.
- animation-iteration-count Configures the number of times the animation should repeat; you can specify infinite to repeat the animation indefinitely.
- animation-name Specifies the name of the @keyframes at-rule describing the animation’s keyframes.
- animation-timing-function Configures the timing of the animation; that is, how the animation transitions through keyframes, by establishing acceleration curves.
Example: The following example binds the "example" animation to the
<!DOCTYPE html>
<html>
<head>
<style>
div {
width: 100px;
height: 100px;
background-color: red;
animation-name: example;
animation-duration: 4s;
}
}
</style>
</head>
<body>
<div></div>
</body>
</html>