Titanium.UI.Animation

Object of Titanium.UI.
Platform Since
Android 0.9
iPhone 0.9
iPad 0.9

Summary

The Animation object is used for specifying lower-level animation properties and more low-level control of events during an animation. The Animation is created by the method Titanium.UI.createAnimation.

Code Examples

Animation applied to a view

Create a simple animation and apply it to the view. In this example, the view will animate from red to black to orange over 2 seconds.

var view = Titanium.UI.createView({
   backgroundColor:'red'
});
var animation = Titanium.UI.createAnimation();
animation.backgroundColor = 'black';
animation.duration = 1000;
var animationHandler = function() {
   animation.removeEventListener('complete',animationHandler);
   animation.backgroundColor = 'orange';
   view.animate(animation);
};
animation.addEventListener('complete',animationHandler);
view.animate(animation);

Methods

Name Summary
addEventListener

Adds the specified callback as an event listener for the named event.

fireEvent

Fires a synthesized event to any registered listeners.

removeEventListener

Removes the specified callback as an event listener for the named event.

Properties

Name Type Summary
autoreverse Boolean

the property specifies if the animation should be replayed in reverse upon completion

backgroundColor String

value of the backgroundColor property to change during animation (iPhone, iPad only.)

bottom Number

value of the bottom property to change during animation

center Object

value of the center property to change during animation

color String

value of the color property to change during animation (iPhone, iPad only.)

curve Number

the curve of the animation (iPhone, iPad only.)

delay Number

the duration of time in milliseconds before starting the animation

duration Number

the duration of time in milliseconds to perform the animation

height Number

value of the height property to change during animation

left Number

value of the left property to change during animation

opacity Number

value of the opacity property to change during animation

opaque Boolean

value of the opaque property to change during animation (iPhone, iPad only.)

repeat Number

the number of times the animation should be performed

right Number

value of the right property to change during animation

top Number

value of the top property to change during animation

transform Object

value of the transform property to change during animation

transition Number

during a transition animation, this is the constant to the type of transition to use (iPhone, iPad only.)

visible Boolean

value of the visible property to change during animation (iPhone, iPad only.)

width Number

value of the width property to change during animation

zIndex Number

value of the zIndex property to change during animation (iPhone, iPad only.)

Events

Name Summary
complete

fired when the animation completes

start

fired when the animation starts