Android Animation for Titanium
Provides access to Honeycomb+ Animation APIs
 All Classes Functions Variables Pages
Public Member Functions | List of all members
ViewPropertyAnimator_ Class Reference

Provides a fluent interface to quickly and easily animate several properties of an Android View. More...

Inherits KrollProxy, and AnimatorListener.

Public Member Functions

.method ViewPropertyAnimator_ setDuration (long milliseconds)
 Specify the duration of the animation. More...
 
.method long getDuration ()
 The duration of the animation. More...
 
.method long getStartDelay ()
 A delay, in milliseconds, before the animation should begin. More...
 
.method ViewPropertyAnimator_ setStartDelay (long milliseconds)
 A delay, in milliseconds, before the animation should begin. More...
 
.method ViewPropertyAnimator_ setInterpolator (int interpolator, Object...interpolatorValues)
 Specify which interpolator the animation should use. More...
 
.method void start ()
 Start the animation. More...
 
.method void cancel ()
 Cancel a running animation. More...
 
.method ViewPropertyAnimator_ alpha (float value)
 Animate the alpha (opacity) of the view to the given value. More...
 
.method ViewPropertyAnimator_ alphaBy (float value)
 Animate the alpha (opacity) of the view by the given value. More...
 
.method ViewPropertyAnimator_ opacity (float value)
 Synonymous with alpha(float "alpha"). More...
 
.method ViewPropertyAnimator_ opacityBy (float value)
 Synonymous with alphaBy(float "alphaBy"). More...
 
.method ViewPropertyAnimator_ x (Object value)
 Animate the view's native "x" value to the given value. More...
 
.method ViewPropertyAnimator_ xBy (Object value)
 Animate the view's native "x" value by the given value. More...
 
.method ViewPropertyAnimator_ y (Object value)
 Animate the view's native "y" value to the given value. More...
 
.method ViewPropertyAnimator_ yBy (Object value)
 Animate the view's native "y" value by the given value. More...
 
.method ViewPropertyAnimator_ rotation (float value)
 
.method ViewPropertyAnimator_ rotationBy (float value)
 
.method ViewPropertyAnimator_ rotationX (float value)
 
.method ViewPropertyAnimator_ rotationXBy (float value)
 
.method ViewPropertyAnimator_ rotationY (float value)
 
.method ViewPropertyAnimator_ rotationYBy (float value)
 
.method ViewPropertyAnimator_ translationX (Object value)
 Animate the view's native "translationX" value to the given value. More...
 
.method ViewPropertyAnimator_ translationXBy (Object value)
 Animate the view's native "translationX" value by the given value. More...
 
.method ViewPropertyAnimator_ translationY (Object value)
 Animate the view's native "translationY" value to the given value. More...
 
.method ViewPropertyAnimator_ translationYBy (Object value)
 Animate the view's native "translationY" value by the given value. More...
 
.method ViewPropertyAnimator_ scaleX (float value)
 Animate the view's native "scaleX" value to the given value. More...
 
.method ViewPropertyAnimator_ scaleXBy (float value)
 Animate the view's native "scaleX" value by the given value. More...
 
.method ViewPropertyAnimator_ scaleY (float value)
 Animate the view's native "scaleY" value to the given value. More...
 
.method ViewPropertyAnimator_ scaleYBy (float value)
 Animate the view's native "scaleY" value by the given value. More...
 
.method ViewPropertyAnimator_ setListener (KrollFunction func)
 A function (callback) to be called when the animation starts, ends or is canceled. More...
 
.method ViewPropertyAnimator_ withStartAction (KrollFunction function)
 
.method ViewPropertyAnimator_ withEndAction (KrollFunction function)
 

Detailed Description

Provides a fluent interface to quickly and easily animate several properties of an Android View.

When animating a view, you should attempt to use this class if possible since it is optimized (within native Android) for animating views. There will be some cases when this class won't suffice; see the ObjectAnimator documentation for some examples of when you might use it instead of this ViewPropertyAnimator.

Here's an example of using this class to move a view down and to the right using an accelerate-decelerate interpolator. Note how you acquire an instance of this class (module.viewPropertyAnimator.animate(view)).

// where "module" is an instance of this module and
// "view" is a view you've placed on the window already.
module.viewPropertyAnimator.animate(view)
    .setInterpolator(module.ACCELERATE_DECELERATE_INTERPOLATOR)
    .setDuration(3000)
    .xBy("100dp")
    .yBy("200dp");

Note also that you don't need to tell it to start. The ViewPropertyAnimator begins its animation when the call chain is finished.

Do not create an instance using "traditional" Titanium factory methods such as module.createViewPropertyAnimator({...}).

Since
1.0

Member Function Documentation

.method ViewPropertyAnimator_ alpha ( float  value)
inline

Animate the alpha (opacity) of the view to the given value.

Parameters
valueThe value to be animated to.
Returns
This instance (for method chaining).
Since
1.0
.method ViewPropertyAnimator_ alphaBy ( float  value)
inline

Animate the alpha (opacity) of the view by the given value.

Parameters
valueThe value to be animated by, as an offset of the current value.
Returns
This instance (for method chaining).
Since
1.0
.method void cancel ( )
inline

Cancel a running animation.

Since
1.0
.method long getDuration ( )
inline

The duration of the animation.

Returns
Milliseconds
Since
1.0
.method long getStartDelay ( )
inline

A delay, in milliseconds, before the animation should begin.

Returns
Milliseconds
Since
1.0
.method ViewPropertyAnimator_ opacity ( float  value)
inline

Synonymous with alpha(float "alpha").

Since
1.0
.method ViewPropertyAnimator_ opacityBy ( float  value)
inline

Synonymous with alphaBy(float "alphaBy").

Since
1.0
.method ViewPropertyAnimator_ rotation ( float  value)
inline
Since
1.0
.method ViewPropertyAnimator_ rotationBy ( float  value)
inline
Since
1.0
.method ViewPropertyAnimator_ rotationX ( float  value)
inline
Since
1.0
.method ViewPropertyAnimator_ rotationXBy ( float  value)
inline
Since
1.0
.method ViewPropertyAnimator_ rotationY ( float  value)
inline
Since
1.0
.method ViewPropertyAnimator_ rotationYBy ( float  value)
inline
Since
1.0
.method ViewPropertyAnimator_ scaleX ( float  value)
inline

Animate the view's native "scaleX" value to the given value.

Parameters
valueThe scaling factor value to animate to. A value of 1 means the true size in the layout (i.e., no scaling).
Returns
This instance (for method chaining).
Since
1.0
.method ViewPropertyAnimator_ scaleXBy ( float  value)
inline

Animate the view's native "scaleX" value by the given value.

Parameters
valueThe scaling factor value to animate by, as an offset of the current scaling factor.
Returns
This instance (for method chaining).
Since
1.0
.method ViewPropertyAnimator_ scaleY ( float  value)
inline

Animate the view's native "scaleY" value to the given value.

Parameters
valueThe scaling factor value to animate to. A value of 1 means the true size in the layout (i.e., no scaling).
Returns
This instance (for method chaining).
Since
1.0
.method ViewPropertyAnimator_ scaleYBy ( float  value)
inline

Animate the view's native "scaleY" value by the given value.

Parameters
valueThe scaling factor value to animate by, as an offset of the current scaling factor.
Returns
This instance (for method chaining).
Since
1.0
.method ViewPropertyAnimator_ setDuration ( long  milliseconds)
inline

Specify the duration of the animation.

Parameters
MillisecondsNumber of milliseconds (seconds / 1000) over which the animation should run.
Returns
This instance (for method chaining).
.method ViewPropertyAnimator_ setInterpolator ( int  interpolator,
Object...  interpolatorValues 
)
inline

Specify which interpolator the animation should use.

For an overview of interpolators, see the Android documentation.

Parameters
interpolatorA value indicating which interpolator to use. The values are in constants on the main module class.
interpolatorValuesOne or more values to pass to the interpolator. Some interpolators accept values to direct/alter their calculations; the bounce interpolator is an example of such. See the Android documentation for more details.
Returns
This instance (for method chaining).
Since
1.0
.method ViewPropertyAnimator_ setListener ( KrollFunction  func)
inline

A function (callback) to be called when the animation starts, ends or is canceled.

As an alternative to this, see withStartAction and withEndAction.

Parameters
funcThe callback function. When called, it will be passed a single argument object, which mimics standard Titanium event listeners. The argument object's type property will be set to "start", "end" or "cancel", depending on the event provoking the callback.
Returns
This instance (for method chaining).
Since
1.0
.method ViewPropertyAnimator_ setStartDelay ( long  milliseconds)
inline

A delay, in milliseconds, before the animation should begin.

Parameters
millisecondsThe duration of the delay, after which the animation should begin changing the view property(ies) after it has been started.
Returns
This instance (for method chaining).
Since
1.0
.method void start ( )
inline

Start the animation.

You probably rarely call this since the animations start automatically.

Since
1.0
.method ViewPropertyAnimator_ translationX ( Object  value)
inline

Animate the view's native "translationX" value to the given value.

Parameters
valueThe value to animate to. You can pass a string that contains units, such as "12dp", and the calculation will be done for you.
Returns
This instance (for method chaining).
Since
1.0
.method ViewPropertyAnimator_ translationXBy ( Object  value)
inline

Animate the view's native "translationX" value by the given value.

Parameters
valueThe value to animate by as offset of the current value. You can pass a string that contains units, such as "12dp", and the calculation will be done for you.
Returns
This instance (for method chaining).
Since
1.0
.method ViewPropertyAnimator_ translationY ( Object  value)
inline

Animate the view's native "translationY" value to the given value.

Parameters
valueThe value to animate to. You can pass a string that contains units, such as "12dp", and the calculation will be done for you.
Returns
This instance (for method chaining).
Since
1.0
.method ViewPropertyAnimator_ translationYBy ( Object  value)
inline

Animate the view's native "translationY" value by the given value.

Parameters
valueThe value to animate by as offset of the current value. You can pass a string that contains units, such as "12dp", and the calculation will be done for you.
Returns
This instance (for method chaining).
Since
1.0
.method ViewPropertyAnimator_ withEndAction ( KrollFunction  function)
inline
Since
1.0
.method ViewPropertyAnimator_ withStartAction ( KrollFunction  function)
inline
Since
1.0
.method ViewPropertyAnimator_ x ( Object  value)
inline

Animate the view's native "x" value to the given value.

Parameters
valueThe value to animate to. You can pass a string that contains units, such as "12dp", and the calculation will be done for you.
Returns
This instance (for method chaining).
Since
1.0
.method ViewPropertyAnimator_ xBy ( Object  value)
inline

Animate the view's native "x" value by the given value.

Parameters
valueThe value to animate by as offset of the current value. You can pass a string that contains units, such as "12dp", and the calculation will be done for you.
Returns
This instance (for method chaining).
Since
1.0
.method ViewPropertyAnimator_ y ( Object  value)
inline

Animate the view's native "y" value to the given value.

Parameters
valueThe value to animate to. You can pass a string that contains units, such as "12dp", and the calculation will be done for you.
Returns
This instance (for method chaining).
Since
1.0
.method ViewPropertyAnimator_ yBy ( Object  value)
inline

Animate the view's native "y" value by the given value.

Parameters
valueThe value to animate by as offset of the current value. You can pass a string that contains units, such as "12dp", and the calculation will be done for you.
Returns
This instance (for method chaining).
Since
1.0

The documentation for this class was generated from the following file: