[AS3/AS2] To tween any rotation property of the target object in the shortest direction, use "shortRotation" For example, if myObject.rotation is currently 170 degrees and you want to tween it to -170 degrees, a normal rotation tween would travel a total of 340 degrees in the counter-clockwise direction, but if you use shortRotation, it would travel 20 degrees in the clockwise direction instead. You can define any number of rotation properties in the shortRotation object which makes 3D tweening easier, like:, 2, {shortRotation:{rotationX:-170, rotationY:35, rotationZ:200}});

Normally shortRotation is defined in degrees, but if you prefer to have it work with radians instead, simply set the useRadians special property to true like:, 2, {shortRotation:{customRotationProperty:Math.PI, useRadians:true}});


import com.greensock.TweenLite; 
import com.greensock.plugins.TweenPlugin; 
import com.greensock.plugins.ShortRotationPlugin; 
TweenPlugin.activate([ShortRotationPlugin]); //activation is permanent in the SWF, so this line only needs to be run once., 1, {shortRotation:{rotation:-170}});
//or for a 3D tween with multiple rotation values..., 1, {shortRotation:{rotationX:-170, rotationY:35, rotationZ:10}}); 


Version: 1.20.3 updated 2017-10-02




        By using GreenSock code, you agree to the terms of use.

        Help support GreenSock by becoming a member

        Join Club GreenSock