Newtons Cradle
This script dosn't use any calculations involving conservation
of momentum, but it does show how to set and reset groups using the
"tget" and "tset" methods, which store and restore the position and
rotation of a group or object. This can be seen at lines 63
and 212. When making this type of rotating object, it is impossible
to accurately add and subtract angles repeatedly, without introducing
"zeroings errors", which show up as "misalignment" at zero degrees.
"tget" and "tset" fix this by accurately storing the exact position.
The mobileStart, mobileStop, and mobileMove subroutines, are hacked from
the zinc demo, and are just used for the initial "start-of-swing" of the
balls. It is a rudimentary way of mouse dragging, and could use some
improvements, but it is Ok for this demo.
Here is a demo of the classic destop toy.
Htmlified newtons-cradle
newtons-cradle
---- Newton's Cradle ----
More later.
----------------------------------------------------