From the course: Interactive Animations with CSS and JavaScript

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

Easing

Easing

From the course: Interactive Animations with CSS and JavaScript

Start my 1-month free trial

Easing

- [Instructor] Great. Now that we have the animation in place, I wanna add one more property that I want to vary, and I wanna change the opacity of the unchosen elements so that they appear to be more dim than the chosen one. So let's go back over to our source code, and I'm going to add one more property to this animation block. All right, I'm gonna go down to the unchosen elements, and I'm gonna change their opacity. I'm gonna make them, when they're done, their opacity should be 25%. Now, in the keyframes, I'm gonna go with the starting opacity of one to the final opacity, which is .25, 25%. And let's go back over to our browser. Refresh. Now you'll notice that they dim, and that's the effect I was looking for. The other thing I wanna show while we're looking at this is it's not as easy to see when you're using a half second animation, but there's a rate of change for these properties. The size doesn't change linearly. In this case, the default animation uses what's called easing…

Contents