Ekamjot-Kaire / fast-pages

Apache License 2.0
0 stars 0 forks source link

javascript exit ticket #37

Open Ekamjot-Kaire opened 1 year ago

Ekamjot-Kaire commented 1 year ago

Object Oriented JS:

Car Sprite Animation:

IMG_3D18174BFDA2-1

IMG_EC41B7381E80-1

Changing ans:

Screen Shot 2023-06-02 at 7 24 27 AM



carSprites

As 1 is continuously added to this.frameX, the rendered sprite moves to the right*, creating a smooth animation. Once the rendered sprite reaches the 16th sprite, it resets back to 0

*the sprite width is set as a variable. this.frameX is multiplied by the sprite width. This sets the x position at which the sprite render starts

this.frameY is determined by the ans variable (talked about above)