|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.rim.device.api.animation.AnimatedVector
public class AnimatedVector
Defines an animatable vector. It is a general purpose animation target.
This class supports animation of multi-channel animation data with a maximum component size of AnimationKeyframeSequence.PROPERTY_COUNT_MAX
.
// Vector data. float[] rgb = {1.0, 0.0, 0.0}; // Create a vector with one channel of data, and a property component size of three. AnimatedVector vector = new AnimatedVector(1, 3, rgb, 0); // Create an animation targetting the vector. Animation vectorAnimation = animator.addAnimation(vector, AnimatedVector.ANIMATION_PROPERTY_VECTOR, 3, new float[] {0.0f, 0.5f, 1.0f}, 0, new float[] {1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f}, 0, Animation.EASINGCURVE_ELASTIC_OUT, 1000L);
The vector can now be used to represent the desired animatable property. In this case, the vector represents color and the animation is a three keyframe animation that will animate the vector from red, to green, to blue.
Field Summary | ||
---|---|---|
static int |
ANIMATION_PROPERTY_VECTOR
Constant that represents the Animatable property. |
Constructor Summary | ||
---|---|---|
AnimatedVector(float[] array)
Class constructor that initializes the vector with a float array. |
||
AnimatedVector(int componentCount,
float[] array,
int offset)
Class constructor. |
||
AnimatedVector(int channelCount,
int componentCount,
float[] array,
int offset)
Constructor. |
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. |
|
Buffer |
getBuffer()
Gets the data as a Buffer . |
|
void |
getFloat(float[] value,
int offset)
Gets the value of the AnimatedVector . |
|
float |
getFloat(int index)
Gets the value for the given component of the AnimatedVector as a float . |
|
void |
getFloat(int channel,
float[] value,
int offset)
Gets the value of the AnimatedVector on the specified data channel. |
|
float |
getFloat(int channel,
int index)
Gets the value for the given component of the AnimatedVector as a float on the specified data channel. |
|
int |
getInt(int index)
Gets the value of the specified component of the AnimatedVector as an int . |
|
int |
getInt(int channel,
int index)
Gets the value of the specified component of the AnimatedVector as an int on the specified data channel. |
|
void |
getInt(int channel,
int[] value,
int offset)
Gets the value of the AnimatedVector on the specified data channel. |
|
void |
getInt(int[] value,
int offset)
Gets the value of the AnimatedVector . |
|
void |
setAnimationValue(int property,
AnimationValue value)
Sets the value or values of the specified property. |
|
void |
setFloat(float[] value,
int offset)
Sets the value of the AnimatedVector . |
|
void |
setFloat(int index,
float value)
Sets the value of the specified component of the AnimatedVector . |
|
void |
setFloat(int channel,
float[] value,
int offset)
Sets the value of the AnimatedVector on the specified data channel. |
|
void |
setFloat(int channel,
int index,
float value)
Sets the value of the specified component of the AnimatedVector on the specified data channel. |
|
void |
setInt(int index,
int value)
Sets the value of the specified component of the AnimatedVector . |
|
void |
setInt(int channel,
int index,
int value)
Sets the value for the given component of the AnimatedVector on the specified data channel. |
|
void |
setInt(int channel,
int[] value,
int offset)
Sets the value of the AnimatedVector on the specified data channel. |
|
void |
setInt(int[] value,
int offset)
Sets the value of the AnimatedVector . |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static int ANIMATION_PROPERTY_VECTOR
Constructor Detail |
---|
public AnimatedVector(float[] array)
Class constructor that initializes the vector with a float
array.
array
- The array of data to populate the AnimatedVector
with.
IllegalArgumentException
- if array
is null
.
IllegalArgumentException
- if array.length == 0
or array.length > AnimationKeyframeSequence.PROPERTY_COUNT_MAX
.public AnimatedVector(int componentCount, float[] array, int offset)
Class constructor.
componentCount
- The number of components that comprise the AnimatedVector
.array
- The array of data to populate the AnimatedVector
with.offset
- The offset into the given array.
IllegalArgumentException
- if componentCount < 1
or componentCount > AnimationKeyframeSequence.PROPERTY_COUNT_MAX
.}
IllegalArgumentException
- if array
is null
IllegalArgumentException
- if offset < 0
.
IllegalArgumentException
- if array.length - componentCount + offset < 1
or
array.length - componentCount + offset > AnimationKeyframeSequence.PROPERTY_COUNT_MAX
.public AnimatedVector(int channelCount, int componentCount, float[] array, int offset)
The length of the array being passed in must be at least channelCount
* componentCount
+ offset
.
channelCount
- The number data channels on the AnimatedVector
.componentCount
- The number of components that comprise the AnimatedVector
.array
- The array of data to populate the AnimatedVector
with.offset
- The offset into the given array.
IllegalArgumentException
- if channelCount < 1
.
IllegalArgumentException
- if componentCount < 1
or componentCount > AnimationKeyframeSequence.PROPERTY_COUNT_MAX
.
IllegalArgumentException
- if array
is null
.
IllegalArgumentException
- if offset < 0
.
IllegalArgumentException
- if array.length - offset < 1
or array.length - offset > AnimationKeyframeSequence.PROPERTY_COUNT_MAX
.Method Detail |
---|
public Buffer getBuffer()
Buffer
.
Buffer
.public float getFloat(int index)
AnimatedVector
as a float
.
index
- The index of the component to get the value from.
AnimatedVector
.
IllegalArgumentException
- if index < 0
or index >=
the component count.public float getFloat(int channel, int index)
AnimatedVector
as a float
on the specified data channel.
channel
- The data channel to get the value from.index
- The index of the component to get the value from.
AnimatedVector
.
IllegalArgumentException
- if channel < 0
or channel >=
the channel count.
IllegalArgumentException
- if index < 0
or index >=
the component count.public void setFloat(int index, float value)
Sets the value of the specified component of the AnimatedVector
.
index
- The index of the component to set the value on.value
- The value to set in the component of the AnimatedVector
.
IllegalArgumentException
- if index < 0
or index >=
the component count.public void setFloat(int channel, int index, float value)
Sets the value of the specified component of the AnimatedVector
on the specified data channel.
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 of the AnimatedVector
.
IllegalArgumentException
- if channel < 0
or channel >=
the channel count.
IllegalArgumentException
- if index < 0
or index >=
the component count.public void getFloat(float[] value, int offset)
Gets the value of the AnimatedVector
.
value
- The array to populate with the AnimatedVector
's values.offset
- The offset into the array to start populating at.
IllegalArgumentException
- if value
is null
.
IllegalArgumentException
- if offset < 0
.
IllegalArgumentException
- if value.length < offset +
the component count.public void getFloat(int channel, float[] value, int offset)
AnimatedVector
on the specified data channel.
channel
- The data channel to get the value from.value
- The array to populate with the AnimatedVector
's values.offset
- The offset into the array to start populating at; must be non-negative.
IllegalArgumentException
- if channel < 0
or channel >=
the channel count.
IllegalArgumentException
- if value
is null
.
IllegalArgumentException
- if offset < 0
.
IllegalArgumentException
- if value.length < offset +
the component count.public void setFloat(float[] value, int offset)
Sets the value of the AnimatedVector
.
value
- The array to populate the AnimatedVector
's values with.offset
- The offset into the array to start copying from.
IllegalArgumentException
- if value
is null
.
IllegalArgumentException
- if offset < 0
.
IllegalArgumentException
- if value.length < offset +
the component count and offset
.public void setFloat(int channel, float[] value, int offset)
Sets the value of the AnimatedVector
on the specified data channel.
channel
- The data channel to set the data on.value
- The array to populate the AnimatedVector
's values with.offset
- The offset into the array to start copying from.
IllegalArgumentException
- if channel < 0
or channel >=
the channel count.
IllegalArgumentException
- if value
is null
.
IllegalArgumentException
- if offset < 0
.
IllegalArgumentException
- if value.length < offset +
the component count.public int getInt(int index)
Gets the value of the specified component of the AnimatedVector
as an int
.
index
- The index of the component to get the value from.
AnimatedVector
.
IllegalArgumentException
- if index < 0
or index >=
the component count.public int getInt(int channel, int index)
Gets the value of the specified component of the AnimatedVector
as an int
on the specified data channel.
channel
- The data channel to get the value from.index
- The index of the component to get the value from.
AnimatedVector
.
IllegalArgumentException
- if channel < 0
or channel >=
the channel count.
IllegalArgumentException
- if index< 0
or index >=
the component count.public void setInt(int index, int value)
Sets the value of the specified component of the AnimatedVector
.
index
- The index of the component to set the value on.value
- The value to set in the component of the AnimatedVector
.
IllegalArgumentException
- if index < 0
or index >=
the component count.public void setInt(int channel, int index, int value)
Sets the value for the given component of the AnimatedVector
on the specified data channel.
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 of the AnimatedVector
.
IllegalArgumentException
- if channel < 0
or channel >=
the channel count.
IllegalArgumentException
- if index < 0
or index >=
the component count.public void getInt(int[] value, int offset)
Gets the value of the AnimatedVector
.
value
- The array to populate with the AnimatedVector
's values.offset
- The offset into the array to start populating at.
IllegalArgumentException
- if value
is null
.
IllegalArgumentException
- if offset < 0
.
IllegalArgumentException
- if value.length < offset +
the component count.public void getInt(int channel, int[] value, int offset)
Gets the value of the AnimatedVector
on the specified data channel.
channel
- The data channel to get the value from.value
- The array to populate with the AnimatedVector
's values.offset
- The offset into the array to start populating at.
IllegalArgumentException
- if channel < 0
or channel >=
the channel count.
IllegalArgumentException
- if value
is null
.
IllegalArgumentException
- if offset < 0
.
IllegalArgumentException
- if value.length < offset +
the component count.public void setInt(int[] value, int offset)
Sets the value of the AnimatedVector
.
value
- The array to populate the AnimatedVector
's values with.offset
- The offset into the array to start copying from.
IllegalArgumentException
- if value
is null
.
IllegalArgumentException
- if offset < 0
.
IllegalArgumentException
- if value.length < offset +
the component count.public void setInt(int channel, int[] value, int offset)
Sets the value of the AnimatedVector
on the specified data channel.
channel
- The data channel to set the data on.value
- The array to populate the AnimatedVector
's values with.offset
- The offset into the array to start copying from.
IllegalArgumentException
- if channel < 0
or channel >=
the channel count.
IllegalArgumentException
- if value
is null
.
IllegalArgumentException
- if offset < 0
.
IllegalArgumentException
- if value.length < offset +
the component count.public void getAnimationValue(int property, AnimationValue value)
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.
getAnimationValue
in interface Animatable
property
- The property to get the current value or values of.value
- An AnimationValue
used to store the returned property values.Animatable.getAnimationValue(int,AnimationValue)
public void setAnimationValue(int property, AnimationValue value)
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.
setAnimationValue
in interface Animatable
property
- The property to set the current value or values of.value
- The AnimationValue
used to specify the value or values to set.Animatable.setAnimationValue(int,AnimationValue)
public int getAnimationPropertyComponentCount(int property)
Animatable
Gets the number of components of the specified property.
The implementer must define the component size of every animatable property defined for theAnimatable
.
getAnimationPropertyComponentCount
in interface Animatable
property
- The property to retrieve the component count for.
Animatable.getAnimationPropertyComponentCount(int)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
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.