🔵 CSS Animation Overview 🔵

CSS Animations make animating web UI elements simple. You can achieve many animations without needing any JS or external packages and can be done straight away with vanilla CSS.

Let's break down CSS animations. 👇 🧵 1/14
1️⃣ Keyframes

All CSS animations start with defining keyframes, before an element can be animated we need to define what the animation will be.

This is done using keyframes with either percentages or from/to.

2/14
2️⃣ Applying to an element

Once we have our animation defined we can apply it to an element in one of two ways:

👉 animation-name
👉 animation shorthand syntax

We'll come back to the shorthand syntax later, first let's look at all the properties.

3/14
⭐ animation-name

This property declares the name of keyframe we are going to apply to the element.

See the previous tweet for an example.

Read More:

🔗 https://developer.mozilla.org/en-US/docs/Web/CSS/animation-name

4/14
⭐ animation-duration

This property declares the length of time in either seconds or milliseconds to complete one cycle of the animation.

E.G.

animation-duration: 500ms;
animation-duration: 5s;

Read more:

🔗 https://developer.mozilla.org/en-US/docs/Web/CSS/animation-duration

5/14
⭐ animation-timing-function

This property establishes the acceleration curve for the animation to use.

E.G.

animation-timing-function: ease-in;
animation-timing-function: linear;

See a full list:

🔗 https://developer.mozilla.org/en-US/docs/Web/CSS/animation-timing-function

6/14
⭐ animation-delay

As the name suggests this property allows you to add delay to the start of the animation.

By default, animations will start immediately but this property allows you to change that.

E.G.

animation-delay: 1s;

Read More:

🔗 https://developer.mozilla.org/en-US/docs/Web/CSS/animation-delay

7/14
⭐ animation-direction

Allows you to state if the animation will play in reverse, normally or change on each run (alternate).

E.G.

animation-direction: alternate;

Read More:

🔗 https://developer.mozilla.org/en-US/docs/Web/CSS/animation-direction

8/14
⭐ animation-iteration-count

This property allows you to specify how many times the animation should run or can be infinite if you don't want it to stop.

E.G.

animation-iteration-count: infinite;
animation-iteration-count: 5;

Read More:

🔗 https://developer.mozilla.org/en-US/docs/Web/CSS/animation-iteration-count

9/14
⭐ animation-fill-mode

This property controls the styles that apply to the element after the animation is finished.

If you animate an element to grow this controls if it stays grown after or not.

E.G.

animation-fill-mode: both;

Read More:

🔗 https://developer.mozilla.org/en-US/docs/Web/CSS/animation-fill-mode

10/14
⭐ animation-play-state

Controls the current play status of the animation. Can be toggled between play and pause.

E.G.

animation-play-state: running;
animation-play-state: paused;

Read More:

🔗 https://developer.mozilla.org/en-US/docs/Web/CSS/animation-play-state

11/14
⭐ animation shorthand

Animation shorthand syntax can control all of the above properties in one.

E.G.

animation: 3s ease-in 1s infinite reverse both running <NAME>;

or

duration | easing-function | delay | iteration-count | direction | fill-mode | play-state | name

12/14
❓ Found this helpful?

If you found this thread on CSS Animations helpful, please consider liking and re-tweeting it so others can find it helpful too.

If you would like to see more content like this on your timeline please make sure to follow me. 😄

14/14
You can follow @MrConerMurphy.
Tip: mention @twtextapp on a Twitter thread with the keyword “unroll” to get a link to it.

Latest Threads Unrolled: