From the course: CSS: Scrolling and Parallax

Unlock this course with a free trial

Join today to access over 22,600 courses taught by industry experts.

Randomizing the appearance

Randomizing the appearance - CSS Tutorial

From the course: CSS: Scrolling and Parallax

Randomizing the appearance

- [Instructor] So there's really nothing wrong with this animation, I think we've learned quite a bit about the different ways that we can control elements on screen. I do like what's happening here. But I don't really like that all these different monsters are all appearing at the same time. So sometimes to add visual interest to an animation, it's good to add a little bit of randomness. So I'll show you how to randomize the appearance of these monsters in a pretty easy way. We've already got an element here that holds all of the monsters into an element. It's an array like object. Using this element, I can go ahead and loop through each one of the monsters. So let's go ahead and do that. Similar to what we did before using the forEach statement. But in this case, I'm going to do it before this moveHeader function, which is handling all of our requests animation frames. So this is essentially going to pre-load…

Contents