PropertyAnimation Class
Property Animations allow constant changes to a numeric
value/property of an object, dependent on start-value, end-value
and the duration of the animation.
Animations can be
seen as functions defining the progress of the change on the
value. The Animation can be parametrized via easing curves.
//We want to animate a GeoLocation to move 100 meters up in altitude // over a period of 10 seconds to simulate an elevator var elevatorAnimation = new AR.PropertyAnimation( geoLocation1, //the object geoLocation1 holds the animated property "altitude", //the property altitude will be animated 500, //the start value of the animation is 500 meters 600, //the resulting value of the animation is 600 meters 10000, //the duration of the elevator climb is 10 seconds (10000 miliseconds) easingCurve, //easing curve object to simulate acceleration and deceleration {onFinish : beepSound.play} //when finished, play a beep sound that elevator doors will now open );
Constructor
PropertyAnimation
-
target
-
property
-
start
-
end
-
duration
-
easingCurve
-
options
Parameters:
-
target
ARchitectObjectThe object which holds the property that will be animated. Must be an AR.ARchitectObject.
-
property
StringThe object's property name that will be animated.
-
start
NumberThe value the PropertyAnimation will start with. If null, the current value of the property will be used. Remark: In case null is set as start value, and the PropertyAnimation loops more than once, the PropertyAnimation will not reset the value after it has completed the first run, and the value won't change in the following runs. To reset the value after each run, supply the property's current value as start value.
-
end
NumberThe value the PropertyAnimation will end with. The value must be non-null.
-
duration
NumberThe duration of the PropertyAnimation, in milliseconds. The value must be non-negative and a whole number.
-
easingCurve
(defaults toAR.EasingCurve("linear")
) EasingCurve optionalan AR.EasingCurve describing the nature of the animation. If the easingCurve parameter is omitted, set to null or undefined or does not contain a type property, the easingCurve parameter will default to a linear easing curve.
-
options
ObjectSetup-Parameters to customize additional object properties.
Accepted options-properties are
Item Index
Properties
Methods
destroy
()
Destroys the object.
isRunning
()
Boolean
Checks if the Animation is currently running.
Returns:
true if the Animation is currently running, false if the Animation is currently not running.
pause
()
Pauses the Animation.
If the PropertyAnimation is currently not running, the call will have no effect.
resume
()
Resumes the Animation.
If the PropertyAnimation is currently running, the call has no effect. Otherwise, it will either be resumed from the position where it was last paused,
or will start from the beginning if it was not paused.
start
-
loopTimes
Immediately starts the Animation.
Parameters:
-
loopTimes
(defaults to1
) Number optionalDefines how often the animation should be played. A negative value indicates an infinite looping. Must be a whole number.
stop
()
Immediately stops the Animation. Allows manual stopping of the Animation before the animation would automatically stop. The onFinish-trigger will not be fired after a manual stopping.
Properties
Events
onFinish
The trigger will fire when the Animation finishes.
The trigger is null by default, and will thus result in no action executed when the trigger fires. A developer can add custom functionality by assigning a custom function to onFinish.
onStart
The trigger will fire right before the Animation starts.
The trigger is null by default, and will thus result in no action executed when the trigger fires. A developer can add custom functionality by assigning a custom function to onStart.