Animator: Script Example 9

Dragable arrows



Arrow2 notes:

Animator supports two types of arrows, Arrow and Arrow2.  The first type, Arrow, is designed to show velocity and force vectors since these arrows evaluate their length at every time step.  Arrow2 is designed to have a fixed length.  Arrow2 objects cannot change their length in reponse to their dynamics.  They can, however, change their length in response to mouse events. This test page shows how to use Arrow2 with mouse events.

Arrow2 is created using the addObject method just like a dynamic arrow, Arrow.


Arrow2 has static vertical and horizontal components that can be changed using the mouse.  These feature are enabled by setting the dragable and/or resize properties to true.

You can read the vertical and horizontal components using the methods to read the width and height of an object:

getH(id)  will read the height, that is the vertical, component.

getW(id)  will read the width, that is the horizontal, component.