You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: projects/animate-images-with-keyframes-using-css/animate-images-with-keyframes-using-css.mdx
+72Lines changed: 72 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -107,3 +107,75 @@ Let's also take a look at this line of code:
107
107
```
108
108
animation: colorChange 2s infinite;
109
109
```
110
+
111
+
-`colorChange` is the name of our animation
112
+
-`2s` is the length in seconds of how long the animation lasts
113
+
-`infinite` is indicating it will loop forever
114
+
115
+
The line of code above is attached to the `.box` class from our HTML file! Animations can only show up if they are defined in the `animation:`.
116
+
117
+
## Easing
118
+
Easing in CSS animations is essential to understanding the pace in which an animation progresses over time.
119
+
120
+
<RoundedImagelink="https://i.imgur.com/9C7DeEg.gif"description="easing demo from mdn web docs" />
121
+
122
+
Some common ones you'll see:
123
+
124
+
-`linear`: Constant speed
125
+
-`ease`: Starts slow, speeds up, then slows down
126
+
-`ease-in`: Starts slow, then accelerates
127
+
-`ease-out`: Starts fast, then decelerates
128
+
-`ease-in-out`: Combines `ease-in` and `ease-out`
129
+
130
+
These can differ and are added right in the `animation:` of your CSS.
131
+
132
+
```
133
+
.tinker_bell {
134
+
animation: bounce 1s linear infinite;
135
+
}
136
+
```
137
+
138
+
**Note:** Easing can get pretty complicated based on the type of motion you want to create! You can review the open source [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/CSS/animation-timing-function) for more information on easing and animation examples.
Here, we're using the CSS function `rotate()` to establish which degree we want to start and end at. In this example, we're using the keywords `from` and `to` which are shortcuts for `0%` and `100%`.
177
+
178
+
The result of the club penguin sensei looks like this 🔥🔥
179
+
180
+
<RoundedImagelink="https://i.imgur.com/YVnPHFA.gif"description="spinning club penguin sensei" />
0 commit comments