This course has been updated! We now recommend you take the JavaScript Performance course.

Check out a free preview of the full Website Performance course:
The "JavaScript Animations" Lesson is part of the full, Website Performance course featured in this preview video. Here's what you'd learn in this lesson:

Offloading animations from JavaScript into CSS can drastically improve the performance of your website. Using the setTimeout function in JavaScript can lead to inconsistent animation behavior and be unreliable. Same is true with setInterval. HTML5 added a better interface for animation called requestAnimationFrame. The purpose of this API is to tell the browser to run some code the next time it’s going to repaint the screen. This API is a better way to animate in JavaScript.

Get Unlimited Access Now