Skip to content

Commit bc18be5

Browse files
authored
Update animate-images-with-keyframes-using-css.mdx
1 parent 315dd4d commit bc18be5

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

projects/animate-images-with-keyframes-using-css/animate-images-with-keyframes-using-css.mdx

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,37 @@ Before we get started, it's important to note what animations are in CSS. Animat
7373
<RoundedImage link="https://i.imgur.com/oYGbPkH.gif" description="html review" />
7474

7575
### keyframes
76+
77+
CSS animations have "steps" in them (also known as keyframes) to signify each moment of change in the animation.
78+
79+
For example,
80+
81+
```
82+
<div className="box"></div>
83+
```
84+
```
85+
@keyframes colorChange {
86+
0% { background-color: red; }
87+
50% { background-color: yellow; }
88+
100% { background-color: red; }
89+
}
90+
91+
.box {
92+
width: 100px;
93+
height: 100px;
94+
background-color: red;
95+
animation: colorChange 2s infinite;
96+
}
97+
```
98+
99+
would look like
100+
101+
<RoundedImage link="https://i.imgur.com/bBzHFra.gif" description="flashing yellow and red box" />
102+
103+
So at 0% of the animation, the color is red, at 50% it's yellow, and at 100% or at the end, it's red again, hence the loop!
104+
105+
Let's also take a look at this line of code:
106+
107+
```
108+
animation: colorChange 2s infinite;
109+
```

0 commit comments

Comments
 (0)