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
Starting with an HTML, which has a single img tag of an animated GIF of a cat walking.
1
+
"use strict";
5
2
6
-
1. Create a variable to store a reference to the img.
7
-
2. Change the style of the img to have a "left" of "0px", so that it starts at the left hand of the screens.
8
-
3. Create a function called catWalk() that moves the cat 10 pixels to the right of where it started, by changing the "left" style property.
9
-
4. Call that function every 50 milliseconds.Your cat should now be moving across the screen from left to right.Hurrah!
10
-
5. When the cat reaches the right - hand of the screen, restart them at the left hand side("0px").So they should keep walking from left to right across the screen, forever and ever.
11
-
6. When the cat reaches the middle of the screen, replace the img with an image of a cat dancing(use this URL: https: //tenor.com/StFI.gif), keep it dancing for 5 seconds, and then replace the img with the original image and have it continue the walk.
0 commit comments