net.rim.device.api.animation
Class AnimationValue

java.lang.Object
  extended by net.rim.device.api.animation.AnimationValue

public class AnimationValue
extends Object

Defines an interface for an object value that gets passed to the Animatable target during animation, allowing the target to get or set animation values for the property that is currently being animated.

The data in this container is stored as floating point data. However, there are getInt() and setInt() methods available that support rounding.

Updating The Target Property's Presentation Value

 public void setAnimationValue(int property, AnimationValue value)
 {
     switch(property) 
     {
         
         case ANIMATION_PROPERTY_XY:
             this.x = value.getFloat(0);
             this.y = value.getFloat(1);
             break;
         case ANIMATION_PROPERTY_WIDTH:
             this.width = value.getFloat(0);
             break;
         case ANIMATION_PROPERTY_HEIGHT:
             this.height = value.getFloat(0);
             break;
         
         _propertyDirty = true;
     }
 }
 

Getting The Target Property's Presentation Value

 public void getAnimationValue(int property, AnimationValue value)
 {
     switch(property) 
     {
         case ANIMATION_PROPERTY_XY:
             value.setFloat(0, this.x);
             value.setFloat(1, this.y);
             break;
         case ANIMATION_PROPERTY_WIDTH:
             value.setFloat(0, this.width);
             break;
         case ANIMATION_PROPERTY_HEIGHT:
             value.setFloat(0, this.height);
             break;
     }
 }
 

See Also:
Animatable
Since:
BlackBerry API 6.0.0

Method Summary
 Buffer getBuffer()
           Returns the data as a Buffer.
 int getChannelCount()
           Gets the number of data channels.
 void getFloat(float[] value, int offset)
           Gets the value of the AnimationValue.
 float getFloat(int index)
           Gets the value of the specified component as a float.
 void getFloat(int channel, float[] value, int offset)
           Gets the value of the AnimationValue on the specified data channel.
 float getFloat(int channel, int index)
           Gets the value of the specified component on the specified data channel as a float.
 int getInt(int index)
           Gets the value of the specified component as an int.
 int getInt(int channel, int index)
           Gets the value of the specified component as an int on the specified data channel.
 void getInt(int channel, int[] value, int offset)
           Gets the value of the AnimationValue on the specified data channel.
 void getInt(int[] value, int offset)
           Gets the value of the AnimationValue.
 int getPropertyComponentCount()
           Gets the property component size of the Animatable's target property.
 void setFloat(float[] value, int offset)
           Sets the value of the AnimationValue.
 void setFloat(int index, float value)
           Sets the value of the specified component.
 void setFloat(int channel, float[] value, int offset)
           Sets the value of the AnimationValue on the specified data channel.
 void setFloat(int channel, int index, float value)
           Sets the value of the specified component on the specified data channel.
 void setInt(int index, int value)
           Sets the value of the specified component.
 void setInt(int channel, int index, int value)
           Sets the value of the specified component on the specified data channel.
 void setInt(int channel, int[] value, int offset)
           Sets the value of the AnimationValue on the specified data channel.
 void setInt(int[] value, int offset)
           Sets the value of the AnimationValue.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 



Method Detail

getChannelCount

public int getChannelCount()

Gets the number of data channels.

Returns:
the number of data channels in the AnimationKeyframeSequence.
Since:
BlackBerry API 6.0.0

getPropertyComponentCount

public int getPropertyComponentCount()

Gets the property component size of the Animatable's target property.

Returns:
the number of component values comprising the Animatable's target property.
Since:
BlackBerry API 6.0.0

getBuffer

public Buffer getBuffer()

Returns the data as a Buffer.

Returns:
Buffer.
Since:
BlackBerry API 6.0.0

getFloat

public float getFloat(int index)

Gets the value of the specified component as a float. Retrieves the value on the first data channel.

Parameters:
index - The index of the component to get the value from.
Returns:
The value for the given component.
Throws:
IllegalArgumentException - if index < 0 or index >= the property component count.
Since:
BlackBerry API 6.0.0

getFloat

public float getFloat(int channel,
                      int index)

Gets the value of the specified component on the specified data channel as a float.

Parameters:
channel - The data channel to get the value from.
index - The index of the component to get the value from..
Returns:
The value for the given component of the AnimationValue.
Throws:
IllegalArgumentException - if channel < 0 or channel >= the channel count.
IllegalArgumentException - if index < 0 or index >= the property component count.
Since:
BlackBerry API 6.0.0

setFloat

public void setFloat(int index,
                     float value)

Sets the value of the specified component. Sets the value on the first data channel.

Parameters:
index - The index of the component to set the value on.
value - The value to set.
Throws:
IllegalArgumentException - if index < 0 or index >= the property component count.
Since:
BlackBerry API 6.0.0

setFloat

public void setFloat(int channel,
                     int index,
                     float value)

Sets the value of the specified component on the specified data channel.

Parameters:
channel - The data channel to set the data on.
index - The index of the component to set the value on.
value - The value to set in the component.
Throws:
IllegalArgumentException - if channel < 0 or channel >= the channel count.
IllegalArgumentException - if index < 0 or index >= the property component count.
Since:
BlackBerry API 6.0.0

getFloat

public void getFloat(float[] value,
                     int offset)

Gets the value of the AnimationValue. Retrieves the value on the first data channel.

Parameters:
value - The array to populate with the values of the AnimationValue.
offset - The offset into the array to start populating at.
Throws:
IllegalArgumentException - if value is null.
IllegalArgumentException - if offset < 0.
IllegalArgumentException - if value.length < offset + the property component count.
Since:
BlackBerry API 6.0.0

getFloat

public void getFloat(int channel,
                     float[] value,
                     int offset)

Gets the value of the AnimationValue on the specified data channel.

Parameters:
channel - The data channel to get the value from.
value - The array to populate with the values of the AnimationValue.
offset - The offset into the array to start populating at.
Throws:
IllegalArgumentException - if channel < 0 or channel >= the channel count.
IllegalArgumentException - if value is null.
IllegalArgumentException - if offset < 0.
IllegalArgumentException - if value.length < offset + the property component count.
Since:
BlackBerry API 6.0.0

setFloat

public void setFloat(float[] value,
                     int offset)

Sets the value of the AnimationValue. Sets the value on the first data channel.

Parameters:
value - The array that contains the values to populate the AnimationValue with.
offset - The offset into the array to start copying from.
Throws:
IllegalArgumentException - if value is null.
IllegalArgumentException - if offset < 0.
IllegalArgumentException - if value.length < offset + the property component count.
Since:
BlackBerry API 6.0.0

setFloat

public void setFloat(int channel,
                     float[] value,
                     int offset)

Sets the value of the AnimationValue on the specified data channel.

Parameters:
channel - The data channel to set the data on.
value - The array that contains the values to populate the AnimationValue with.
offset - The offset into the array to start copying from.
Throws:
IllegalArgumentException - if channel < 0 or channel >= the channel count.
IllegalArgumentException - if value is null.
IllegalArgumentException - if offset < 0.
IllegalArgumentException - if value.length < offset + the property component count.
Since:
BlackBerry API 6.0.0

getInt

public int getInt(int index)

Gets the value of the specified component as an int.

Parameters:
index - The index of the component to get the value from.
Returns:
The value for the given component.
Throws:
IllegalArgumentException - if index < 0 or index >= the property component count.
Since:
BlackBerry API 6.0.0

getInt

public int getInt(int channel,
                  int index)

Gets the value of the specified component as an int on the specified data channel.

Parameters:
channel - The data channel to get the value from.
index - The index of the component to get the value from.
Returns:
The value for the given component.
Throws:
IllegalArgumentException - if channel < 0 or channel >= the channel count.
IllegalArgumentException - if index < 0 or index >= the property component count.
Since:
BlackBerry API 6.0.0

setInt

public void setInt(int index,
                   int value)

Sets the value of the specified component.

Parameters:
index - The index of the component to set the value on.
value - The value to set.
Throws:
IllegalArgumentException - if index < 0 or index >= the property component count.
Since:
BlackBerry API 6.0.0

setInt

public void setInt(int channel,
                   int index,
                   int value)

Sets the value of the specified component on the specified data channel.

Parameters:
channel - The data channel to set the data on.
index - The index of the component to set the value on.
value - The value to set.
Throws:
IllegalArgumentException - if channel < 0 or channel >= the channel count.
IllegalArgumentException - if index < 0 or index >= the property component count.
Since:
BlackBerry API 6.0.0

getInt

public void getInt(int[] value,
                   int offset)

Gets the value of the AnimationValue.

Parameters:
value - The array to populate with the values of the AnimationValue.
offset - The offset into the array to start populating at.
Throws:
IllegalArgumentException - if value is null.
IllegalArgumentException - if offset < 0.
IllegalArgumentException - if value.length < offset + the property component count.
Since:
BlackBerry API 6.0.0

getInt

public void getInt(int channel,
                   int[] value,
                   int offset)

Gets the value of the AnimationValue on the specified data channel.

Parameters:
channel - The data channel to get the value from.
value - The array to populate with the AnimationValue's values.
offset - The offset into the array to start populating at.
Throws:
IllegalArgumentException - if channel < 0 or channel >= the channel count.
IllegalArgumentException - if value is null.
IllegalArgumentException - if offset < 0.
IllegalArgumentException - if value.length < offset + the property component count.
Since:
BlackBerry API 6.0.0

setInt

public void setInt(int[] value,
                   int offset)

Sets the value of the AnimationValue.

Parameters:
value - The array to populate the AnimationValue's values with.
offset - The offset into the array to start copying from.
Throws:
IllegalArgumentException - if value is null.
IllegalArgumentException - if offset < 0 is negative.
IllegalArgumentException - if value.length < offset + the property component count.
Since:
BlackBerry API 6.0.0

setInt

public void setInt(int channel,
                   int[] value,
                   int offset)

Sets the value of the AnimationValue on the specified data channel.

Parameters:
channel - The data channel to set the data on.
value - The array to populate the AnimationValue's values with.
offset - The offset into the array to start copying from.
Throws:
IllegalArgumentException - if channel < 0 or channel >= the channel count.
IllegalArgumentException - if value is null.
IllegalArgumentException - if offset < 0.
IllegalArgumentException - if value.length < offset + the property component count.
Since:
BlackBerry API 6.0.0





Copyright 1999-2010 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Copyright 1993-2003 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. All Rights Reserved.
Copyright 2002-2003 Nokia Corporation All Rights Reserved.
Java is a trademark of Sun Microsystems, Inc.