Introduction


Welcome to the world of animation! It’s exciting, but it can also get complex 😱.

In this first lesson, we’ll explore why animations can enhance data visualizations, when to use them (and when not to), and introduce the concept of spring animations.

Ready to get hands-on? We’ll dive into the code in the next lesson!

Free
4 minutes read

Why Use Animation?

Imagine you have a web app with a few charts to explore a dataset. Each chart can represent different groups within the data.

You could switch instantly between groups, but adding smooth, animated transitions gives the experience a polished, engaging feel.


Here’s an example, try clicking the buttons above the charts!

Types of Data Professionals

The field of data offers a diverse array of job titles, making it challenging to navigate without getting lost in the jargon and uncertainty about which roles to pursue. The charts below offer deeper insights into the competencies needed, salary ranges, and popularity trends for the four primary job titles.

ML OpsData PipelinesDatabaseData VizStorytellingBusiness InsightsReportingExperimentationStatsML ModelingDeployment
00

Three charts with smooth dataset transition.

There are many advantages coming with those smooth animations!

Pros

  • Enhances Understanding: help viewers grasp changes over time or shifts in data by gradually showing differences, reducing cognitive load compared to abrupt changes.
  • Directs Attention: Animation naturally attracts attention, guiding users to focus on specific data points or trends, which can be especially useful in dashboards or interactive reports.

When used effectively, animations make applications more visually appealing, enhancing overall engagement.

❌ Yes, but

Animated transitions must be used carefully to avoid overwhelming or distracting users.

When overused or too complex, animations can create visual clutter, drawing attention away from important data or insights.

Long or intricate animations can also slow down user interactions, which can frustrate users and reduce usability.

If you're hesitant to add an animation in your app, keep this citation by Josh Comeau in mind:


Animation is like salt: too much of it spoils the dish

☯️ 2 types if animation

There are two main types of animations: CSS and spring.

→ CSS animations are simple, using keyframes to create smooth transitions for things like fades, spins, and hover effects. They’re efficient but lack flexibility for interactive or dynamic animations.

→ Spring animations, on the other hand, mimic real-world physics by adding effects like bounce and decay, making them ideal for interactive elements that respond naturally to user input.


There are 2 main ways to animate stuff on the web: CSS and spring-based animations.


Each type serves different purposes: CSS is great for simple, efficient transitions, while spring animations create dynamic, realistic movement. Think of spring physics as a secret ingredient that makes animations feel more alive.

I’d love to dive deeper into spring animations, but Josh Comeau has introduced the concept so brilliantly that it’s worth reading his explanation. If you want a better understanding of the why before tackling the how, check out his work here.

More about spring anim.

🙇🏽‍♂️ Let's code!

It's time to create our first spring animation using javascript and a library called react-spring!