Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
As we've seen throughout the course, there's a ton of possibilities with transitions and transforms, but for traditional animators, it doesn't have anywhere near the degree of control they are used to. Luckily, there is another set of options in the CSS3 tool chest that we can tap for everything from percentage-based timelines to infinite iterations. There are two primary elements for more sophisticated Motion Graphics are the @keyframes statement and the animation properties. The @keyframes statement is similar to the @media or @import statements.
The code is inserted in the external stylesheet or within an embedded style tag and can be formatted either with percentage-based values, like the example on the left, or keyword, like example the right. In either case you'll need to give it a unique name, like I have here with myAnimation and yourAnimation. The animation properties are added to the CSS rule for the selector to be affected, just like transform properties. There is a shorthand version that's often used. Let's step through the most commonly applied syntax.
Right after the animation property is the animation name, which is the same as the one referenced in the @keyframes statement. Next is a duration, which can be given in seconds, s, or milliseconds, ms. Then you have the option for setting the number of times to repeat the animation. This can be of value like 3 or 6 or the keyword infinite, which causes the animation to repeat as long as it's on the screen. The final parameter in our example is the keyword alternate, which designates the animation direction.
As you might suspect, alternate will go back and forth. The other possible value is a keyword normal, which causes the animation to play in a start to finish direction. Here's a list of the majority of cross browser animation properties that can be used, if you don't want to code with shorthand syntax. Note that a couple of these, like animation-timing-function and animation-delay, work exactly like their transition equivalents. The @keyframes in animation properties are supported in browsers about as well as 3D transforms, and it's getting better quickly, as you can see from the caniuse web site.
Okay, that's enough of a bird's eye view. You are ready now to get your hands dirty with keyframes and animations.
Get unlimited access to all courses for just $25/month.Become a member
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.
Your file was successfully uploaded.