3DRepresentation('van der Waals Spheres') Let rotator = new ChemDoodle.RotatorCanvas3D('rotator', 250, 250) For convenience, the animation can be toggled by the user by double-clicking on the canvas. When everything is ready, the AnimatorCanvas.startAnimation() function will start the rotation while the AnimatorCanvas.stopAnimation() function will stop it. The default is 33ms, which specifies a refresh rate of about 30 frames per second. This variable controls how many milliseconds elapse before the next frame is painted.
The animation framerate can also be set by specifying the AnimatorCanvas.timeout variable in milliseconds. The default rate for all axes is π/15 radians/sec. For 2D rotation, only the RotatorCanvas3D.zIncrement is considered.
There are three rotation increment variables that define the rate of rotation around the given axes in radians/sec: RotatorCanvas3D.xIncrement, RotatorCanvas3D.yIncrement and RotatorCanvas3D.zIncrement. new ChemDoodle.RotatorCanvas3D(name, width, height) Īfter the constructor has been called, several variables can be set to specify rotation increments, animation speed, and to start and stop the animation. The RotatorCanvas3D class is also a child of the AnimatorCanvas class through a double-inheritance. The RotatorCanvas3D class is a child of the Canvas3D class which is in turn a child of the Canvas class. There is no optional boolean for 3D rotation, as all rotations will be 3D.
Just like the RotatorCanvas constructor, the RotatorCanvas3D constructor takes a name, width and height.