Animation.animateProp

Syntax

animateProp(context: PP.Object, propertyName: String, callback: PP.Delegate|function);

Parameters

context. Object that has the property to animate.

propertyName. Name of the animated property.

callback. Callback function.

Description

The animateProp method plays object property animation.

Example

To execute the example, the page must contain an instance of the Animation class named animation (see Animation Constructor) and the TextArea component named textArea. Play animation of text area width change for one second:

// Get DOM node of the text area
var domNode = textArea.getDomNode();
console.log("Initial width of the text area: " + textArea.getWidth());
// Play animation of the text area width change
animation.animateProp(textArea, "Width");
if (animation.isExecute()) {
    // Stop animation playing in one second
    var command = "console.log(\"Width before animation completion: \" + textArea.getWidth());" +
        "animation.stop();" +
        "console.log(\"Width after animation completion: \" + textArea.getWidth());" +
        "console.log(\"Current animation step: \" + animation.getNow());" +
        "console.log(\"Last animation step: \" + animation.step(animation.getDuration()));";
    setTimeout(command, 1000);
};

After executing the example, animation of text area width change plays for one second. Its initial and resulting width, as well as the current and last (maximum possible) animation steps are displayed to the browser console:

Text area initial width: 200
Width before animation is finished: 179
Width after animation is finished: 179
Current animation step: 179
Last animation step: 200

See also:

Animation