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 - 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
-
-
-
-
-
Building your new monsters section9m 41s
-
(Locked)
Smooth scrolling on link clicks2m 48s
-
(Locked)
Request animation frame4m 22s
-
(Locked)
Adding classes when scrolling4m 3s
-
(Locked)
Removing the header cue when scrolling3m 50s
-
(Locked)
Parallax scrolling with JavaScript8m 35s
-
(Locked)
Determining when an object first appears7m 36s
-
(Locked)
Animating when objects enter the screen4m 15s
-
(Locked)
Randomizing the appearance5m 26s
-
-
-
-
-