Skip to Content
Creating Web Animations
book

Creating Web Animations

by Kirupa Chinnathambi
March 2017
Beginner
210 pages
4h
English
O'Reilly Media, Inc.
Content preview from Creating Web Animations

Chapter 6. Transitions, Animations, and JavaScript

So far, while learning the basics of how CSS animations and transitions work, we haven’t deviated too far from the safe middle road. We loaded the page, and an animation automatically started to play. We hovered over an element, and some property on that element animated in some way. The middle road is fine for many cases, but there is so much more we can do. In this chapter, we are going to take some less beaten paths and expand the ways we can interact with animations and transitions by adding in a dash of JavaScript.

By adding JavaScript, we can start to do a lot more things, such as:

  • Having our animations play at a time other than during page load or in response to simple gestures like hover, focus, and so on.
  • Defining the properties we animate, their values, or both on the fly as opposed to having them always be predefined in our CSS.
  • Having the element whose properties we animate be wildly different than the element we trigger the animation on.

These are all situations that you’ll run into frequently, and they also are situations that you simply can’t bring to life using only CSS. You need to involve JavaScript, and this chapter will show you some of the ways you can do that. Also, don’t worry if you are not a JavaScript expert. We’ll stay out of the complex stuff as much as possible, but we will review a few key JavaScript concepts that you will see over and over again as you go about creating animations.

It’s Just ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Web Animation using JavaScript: Develop and Design

Web Animation using JavaScript: Develop and Design

Julian Shapiro
SVG Animations

SVG Animations

Sarah Drasner

Publisher Resources

ISBN: 9781491957509Errata Page