android.view.animation.TranslateAnimation
An animation that controls the position of an object. See the
full package description for details and
sample code.
Summary
|
|
|
Value |
|
int |
ABSOLUTE |
The specified dimension is an absolute number of pixels. |
0 |
0x00000000 |
int |
INFINITE |
Repeat the animation indefinitely. |
-1 |
0xffffffff |
int |
RELATIVE_TO_PARENT |
The specified dimension holds a float and should be multiplied by the
height or width of the parent of the object being animated. |
2 |
0x00000002 |
int |
RELATIVE_TO_SELF |
The specified dimension holds a float and should be multiplied by the
height or width of the object being animated. |
1 |
0x00000001 |
int |
RESTART |
When the animation reaches the end and the repeat count is INFINTE_REPEAT
or a positive value, the animation restarts from the beginning. |
1 |
0x00000001 |
int |
REVERSE |
When the animation reaches the end and the repeat count is INFINTE_REPEAT
or a positive value, the animation plays backward (and then forward again). |
2 |
0x00000002 |
int |
START_ON_FIRST_FRAME |
Can be used as the start time to indicate the start time should be the current
time when getTransformation(long, Transformation) is invoked for the
first animation frame. |
-1 |
0xffffffff |
int |
ZORDER_BOTTOM |
Requests that the content being animated be forced under all other
content for the duration of the animation. |
-1 |
0xffffffff |
int |
ZORDER_NORMAL |
Requests that the content being animated be kept in its current Z
order. |
0 |
0x00000000 |
int |
ZORDER_TOP |
Requests that the content being animated be forced on top of all other
content for the duration of the animation. |
1 |
0x00000001 |
Public Constructors
|
|
|
|
|
|
TranslateAnimation(Context context, AttributeSet attrs) |
|
|
|
|
|
|
TranslateAnimation(float fromXDelta, float toXDelta, float fromYDelta, float toYDelta) |
|
|
|
|
|
|
TranslateAnimation(int fromXType, float fromXValue, int toXType, float toXValue, int fromYType, float fromYValue, int toYType, float toYValue) |
Public Methods
|
|
|
|
|
void |
initialize(int width, int height, int parentWidth, int parentHeight) |
Protected Methods
applyTransformation,
ensureInterpolator,
getDuration,
getFillAfter,
getFillBefore,
getInterpolator,
getRepeatCount,
getRepeatMode,
getStartOffset,
getStartTime,
getTransformation,
getZAdjustment,
hasEnded,
hasStarted,
initialize,
isInitialized,
reset,
resolveSize,
restrictDuration,
scaleCurrentDuration,
setAnimationListener,
setDuration,
setFillAfter,
setFillBefore,
setInterpolator,
setInterpolator,
setRepeatCount,
setRepeatMode,
setStartOffset,
setStartTime,
setZAdjustment,
start,
startNow,
willChangeBounds,
willChangeTransformationMatrix
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait
Details
Public Constructors
public
TranslateAnimation(Context context, AttributeSet attrs)
Constructor used whan an ScaleAnimation is loaded from a resource.
Parameters
context
| Application context to use |
attrs
| Attribute set from which to read values
|
public
TranslateAnimation(float fromXDelta, float toXDelta, float fromYDelta, float toYDelta)
Constructor to use when building a ScaleAnimation from code
Parameters
fromXDelta
| Change in X coordinate to apply at the start of the
animation |
toXDelta
| Change in X coordinate to apply at the end of the
animation |
fromYDelta
| Change in Y coordinate to apply at the start of the
animation |
toYDelta
| Change in Y coordinate to apply at the end of the
animation
|
public
TranslateAnimation(int fromXType, float fromXValue, int toXType, float toXValue, int fromYType, float fromYValue, int toYType, float toYValue)
Constructor to use when building a ScaleAnimation from code
Parameters
fromXType
| Specifies how fromXValue should be interpreted. One of
Animation.ABSOLUTE, Animation.RELATIVE_TO_SELF, or
Animation.RELATIVE_TO_PARENT. |
fromXValue
| Change in X coordinate to apply at the start of the
animation. This value can either be an absolute number if fromXType
is ABSOLUTE, or a percentage (where 1.0 is 100%) otherwise. |
toXType
| Specifies how toXValue should be interpreted. One of
Animation.ABSOLUTE, Animation.RELATIVE_TO_SELF, or
Animation.RELATIVE_TO_PARENT. |
toXValue
| Change in X coordinate to apply at the end of the
animation. This value can either be an absolute number if toXType
is ABSOLUTE, or a percentage (where 1.0 is 100%) otherwise. |
fromYType
| Specifies how fromYValue should be interpreted. One of
Animation.ABSOLUTE, Animation.RELATIVE_TO_SELF, or
Animation.RELATIVE_TO_PARENT. |
fromYValue
| Change in Y coordinate to apply at the start of the
animation. This value can either be an absolute number if fromYType
is ABSOLUTE, or a percentage (where 1.0 is 100%) otherwise. |
toYType
| Specifies how toYValue should be interpreted. One of
Animation.ABSOLUTE, Animation.RELATIVE_TO_SELF, or
Animation.RELATIVE_TO_PARENT. |
toYValue
| Change in Y coordinate to apply at the end of the
animation. This value can either be an absolute number if toYType
is ABSOLUTE, or a percentage (where 1.0 is 100%) otherwise.
|
Public Methods
public
void
initialize(int width, int height, int parentWidth, int parentHeight)
Initialize this animation with the dimensions of the object being
animated as well as the objects parents. (This is to support animation
sizes being specifed relative to these dimensions.)
Objects that interpret a Animations should call this method when
the sizes of the object being animated and its parent are known, and
before calling getTransformation(long, Transformation).
Parameters
width
| Width of the object being animated |
height
| Height of the object being animated |
parentWidth
| Width of the animated object's parent |
parentHeight
| Height of the animated object's parent
|
Protected Methods
protected
void
applyTransformation(float interpolatedTime, Transformation t)
Helper for getTransformation. Subclasses should implement this to apply
their transforms given an interpolation value. Implementations of this
method should always replace the specified Transformation or document
they are doing otherwise.
Parameters
interpolatedTime
| The value of the normalized time (0.0 to 1.0)
after it has been run through the interpolation function. |
t
| The Transofrmation object to fill in with the current
transforms.
|