How to move multiple objects at once using js?🤔🤔 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 12

How to move multiple objects at once using js?🤔🤔

I want some Circles go down at the same time.

26th Feb 2017, 4:50 AM
Nikhil
Nikhil - avatar
4 Answers
+ 3
You cannot move multiple objects really at once, as all instructions in JS are executed in a mono-thread, so you need to sequentially ( iterate over an array ) to update properties of objects, and that will be do so quick that you see objects moving as at once...
26th Feb 2017, 10:15 AM
visph
visph - avatar
+ 12
Okk visph but is there a way to move objects down using svg animate tag only.??
26th Feb 2017, 10:21 AM
Nikhil
Nikhil - avatar
+ 3
have a look at p5js for simple js animation on canvas and much more. http://p5js.org Easy, comprehensive tutorials on the matter by Daniel Shiffman on his youtube channel The coding Train https://www.youtube.com/playlist?list=PLRqwX-V7Uu6Zy51Q-x9tMWIv9cueOFTFA
26th Feb 2017, 7:08 AM
seamiki
seamiki - avatar
+ 3
You don't have previously specify Svg... In theory ( I don't have a lot practice of Svg, and don't have time now to study this particularity ), you can define an animation object with an ID that you can next apply to how many elements as you want ^^ ( search for <def> svg element )
26th Feb 2017, 10:40 AM
visph
visph - avatar