RotationPlugin Class
The RotationPlugin for TweenJS modifies tweens of rotation properties. These properties can be changed when calling
install. Install using:
RotationPlugin.install(props);
After installation, by default all rotation tweens will rotate in the shortest direction. For example, if you
tween from rotation=15 to rotation=330, it will rotate counter-clockwise 45 degrees. You can modify this behaviour by
specifying a rotationDir tween value. A value of -1 will force CCW rotation, 1 will force CW, and 0 will
disable the plugin effects for that portion of the tween.
Note that the rotationDir value will persist until overridden in future to calls. Set it to null to re-enable the default behavior.
// this tween will rotate: CCW, then CCW (because rotationDir persists), then CW.
myTween.get(foo).to({rotation:30, rotationDir:-1}).to({rotation:60}).to({rotation:10, rotationDir:1});
You can also disable the plugin completely for a tween by setting tween.pluginData.Rotation_disabled=true.
Item Index
Methods
change
-
tween -
step -
prop -
value -
ratio -
end
Called before a property is updated by the tween. See change for more info.
Returns:
init
-
tween -
prop -
value
Called by TweenJS when a new property initializes on a tween. See init for more info.
Returns:
install
-
props
Installs this plugin for use with TweenJS. Call this once after TweenJS is loaded to enable this plugin.
Parameters:
-
propsObjectAn object defining the properties this plugin acts on. For example, passing
{angle:true}will cause the plugin to only act on theangleproperty. By default the properties arerotationrotationX,rotationY, androtationZ.