How do we make animations move back and forth | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

How do we make animations move back and forth

27th Jul 2019, 2:35 PM
General😸JAPCat(=^・ェ・^=)
General😸JAPCat(=^・ェ・^=) - avatar
3 Answers
+ 9
Thanks to YouTube 👇 watch this https://m.youtube.com/watch?v=CZAXucMryxU 🎥 JavaScript Animation Tutorial - Animating a UI with the ...
27th Jul 2019, 4:42 PM
KingDaniel2004
KingDaniel2004 - avatar
+ 4
If you want to move a rectangle back and forth, then you can have a variable representing the current x-axis position of the rectangle and have another variable representing how much to increase the x-axis of the rectangle. If the rectangle is at the edge of the screen to the right, then the variable that represents how much to increase the x-axis position becomes its value in negative form. And if the rectangle is at the edge of the screen to the left, then the variable representing how much to increase the x-axis of the rectangle becomes positive. https://code.sololearn.com/WxB5T8Zbr3YT/?ref=app
27th Jul 2019, 6:15 PM
androidCoder255
androidCoder255 - avatar
+ 2
Thanks
28th Jul 2019, 12:08 AM
General😸JAPCat(=^・ェ・^=)
General😸JAPCat(=^・ェ・^=) - avatar