API Documentation for: 1.0.0
Show:

RotationPlugin Class

Defined in: RotationPlugin:38
Module: TweenJS

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

Properties

Methods

change

(
  • tween
  • step
  • prop
  • value
  • ratio
  • end
)
Any static

Defined in change:144

Called before a property is updated by the tween. See change for more info.

Parameters:

Returns:

Any:

init

(
  • tween
  • prop
  • value
)
Any static

Defined in init:94

Called by TweenJS when a new property initializes on a tween. See init for more info.

Parameters:

Returns:

Any:

install

(
  • props
)
static

Defined in install:81

Installs this plugin for use with TweenJS. Call this once after TweenJS is loaded to enable this plugin.

Parameters:

  • props Object

    An object defining the properties this plugin acts on. For example, passing {angle:true} will cause the plugin to only act on the angle property. By default the properties are rotation rotationX, rotationY, and rotationZ.

step

(
  • tween
  • step
  • props
)
static

Defined in step:112

Called when a new step is added to a tween (ie. a new "to" action is added to a tween). See step for more info.

Parameters:

Properties

_props

Object protected static

Defined in _props:64

ID

String static readonly

Defined in ID:72

READ-ONLY. A unique identifying string for this plugin. Used by TweenJS to ensure duplicate plugins are not installed on a tween.