net.rim.device.api.animation
Class AnimatedScalar

java.lang.Object
  extended by net.rim.device.api.animation.AnimatedScalar
All Implemented Interfaces:
Animatable

public class AnimatedScalar
extends Object
implements Animatable

Defines an animatable scalar. It is a general purpose animation target.

Targetting an AnimatedScalar for Animation

 // Create a scalar, initial value is 10.0f.
 AnimatedScalar scalar = new AnimatedScalar(10.0f);
 // Create an animation targetting the scalar. 
 Animation scalarAnimation = animator.addAnimationTo(scalar, AnimatedScalar.ANIMATION_PROPERTY_SCALAR, 100.0f, Animation._EASINGCURVE_BOUNCE_IN, 1000L); 
 

The above scalar value can now be used to represent the desired animatable property.You could use the value to represent the width of a box. In this case, the animation would cause the width of the box to animate from 10 to 100 with a bounce-in effect.

Since:
BlackBerry API 6.0.0

Field Summary
static int ANIMATION_PROPERTY_SCALAR
          Constant representing the Animatable property.
 
Constructor Summary
AnimatedScalar(float value)
           Class constructor that initializes the scalar to a float value.
AnimatedScalar(int value)
           Class constructor that initializes the scalar to a int value.
 
Method Summary
 int getAnimationPropertyComponentCount(int property)
           Gets the number of components of the specified property.
 void getAnimationValue(int property, AnimationValue value)
           Gets the value or values of the specified property.
 float getFloat()
           Gets the value of the AnimatedScalar as a float.
 int getInt()
           Gets the value of the AnimatedScalar as an int.
 void setAnimationValue(int property, AnimationValue value)
           Sets the value or values of the specified property.
 void setFloat(float value)
           Sets the float value of the AnimatedScalar.
 void setInt(int value)
           Sets the int value of the AnimatedScalar.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 



Field Detail

ANIMATION_PROPERTY_SCALAR

public static int ANIMATION_PROPERTY_SCALAR
Constant representing the Animatable property.

Since:
BlackBerry API 6.0.0


Constructor Detail

AnimatedScalar

public AnimatedScalar(float value)

Class constructor that initializes the scalar to a float value.

Parameters:
value - The float value to assign to the AnimatedScalar.
Since:
BlackBerry API 6.0.0

AnimatedScalar

public AnimatedScalar(int value)

Class constructor that initializes the scalar to a int value.

Parameters:
value - The int value to assign to the AnimatedScalar.
Since:
BlackBerry API 6.0.0


Method Detail

getFloat

public float getFloat()

Gets the value of the AnimatedScalar as a float.

Returns:
the current value of the AnimatedScalar.
Since:
BlackBerry API 6.0.0

setFloat

public void setFloat(float value)

Sets the float value of the AnimatedScalar.

Parameters:
value - The value to set the AnimatedScalar to.
Since:
BlackBerry API 6.0.0

getInt

public int getInt()

Gets the value of the AnimatedScalar as an int.

Returns:
the current value of the AnimatedScalar.
Since:
BlackBerry API 6.0.0

setInt

public void setInt(int value)

Sets the int value of the AnimatedScalar.

Parameters:
value - The value to set the AnimatedScalar to.
Since:
BlackBerry API 6.0.0

getAnimationValue

public void getAnimationValue(int property,
                              AnimationValue value)
Description copied from interface: Animatable

Gets the value or values of the specified property.

Used by the Animation framework to get the values of the specified property on the Animatable. The implementer must set the value of the specified target property in the AnimationValue parameter.

Specified by:
getAnimationValue in interface Animatable
Parameters:
property - The property to get the current value or values of.
value - An AnimationValue used to store the returned property values.
See Also:
Animatable.getAnimationValue(int,AnimationValue)
Since:
BlackBerry API 6.0.0

setAnimationValue

public void setAnimationValue(int property,
                              AnimationValue value)
Description copied from interface: Animatable

Sets the value or values of the specified property.

Used by the Animation framework to update the value or values of the specified target property on the Animatable with the currently calculated animation value. The implementer must update the current value or values of the given target property with the values in the AnimationValue parameter.

Specified by:
setAnimationValue in interface Animatable
Parameters:
property - The property to set the current value or values of.
value - The AnimationValue used to specify the value or values to set.
See Also:
Animatable.setAnimationValue(int,AnimationValue)
Since:
BlackBerry API 6.0.0

getAnimationPropertyComponentCount

public int getAnimationPropertyComponentCount(int property)
Description copied from interface: Animatable

Gets the number of components of the specified property.

The implementer must define the component size of every animatable property defined for the Animatable.

Specified by:
getAnimationPropertyComponentCount in interface Animatable
Parameters:
property - The property to retrieve the component count for.
Returns:
The number of components comprising the specified property.
See Also:
Animatable.getAnimationPropertyComponentCount(int)
Since:
BlackBerry API 6.0.0





Copyright 1999-2011 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Java is a trademark of Oracle America Inc. in the US and other countries.
Legal