android.view.animation.AnimationSet
Represents a group of Animations that should be played together.
The transformation of each individual animation are composed
together into a single transform.
If AnimationSet sets any properties that its children also set
(for example, duration or fillBefore), the values of AnimationSet
override the child values.
Summary
| |
|
|
Value |
|
| int |
ABSOLUTE |
The specified dimension is an absolute number of pixels. |
0 |
0x00000000 |
| int |
NO_REPEAT |
Don't do anything when the animation ends. |
0 |
0x00000000 |
| 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 |
REPEAT |
Replay the animation from the beginning. |
1 |
0x00000001 |
| int |
REVERSE |
Replay the animation backwards (then forwards again). |
2 |
0x00000002 |
mCycleFlip,
mDurationMillis,
mEnded,
mFillAfter,
mFillBefore,
mInitialized,
mInterpolator,
mListener,
mRepeatMode,
mStartOffsetMillis,
mStartTimeMillis,
mStarted
Public Constructors
Public Methods
applyTransformation,
ensureInterpolator,
getDuration,
getFillAfter,
getFillBefore,
getInterpolator,
getRepeatMode,
getStartOffset,
getStartTime,
getTransformation,
initialize,
isEnded,
isInitialized,
isStarted,
reset,
resolveSize,
scaleCurrentDuration,
setAnimationListener,
setDuration,
setFillAfter,
setFillBefore,
setInterpolator,
setInterpolator,
setRepeatMode,
setStartOffset,
setStartTime,
start,
startNow,
willChangeTargetViewBounds,
willChangeTransformationMatrix
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait
Details
Public Constructors
Constructor used whan an AnimationSet is loaded from a resource.
Parameters
| context
| Application context to use |
| attrs
| Attribute set from which to read values
|
public
AnimationSet(boolean shareInterpolator)
Constructor to use when building an AnimationSet from code
Parameters
| shareInterpolator
| Pass true if all of the animations in this set
should use the interpolator assocciated with this AnimationSet.
Pass false if each animation should use its own interpolator.
|
Public Methods
public
void
addAnimation(Animation a)
Add a child animation to this animation set.
The transforms of the child animations are applied in the order
that they were added
public
List
getAnimations()
Returns
- All the child animations in this AnimationSet. Note that
this may include other AnimationSets, which are not expanded.
public
long
getDuration()
The duration of an AnimationSet is defined to be the
duration of the longest child animation.
public
long
getStartTime()
When this animation was started
public
boolean
getTransformation(long currentTime, Transformation t)
The transformation of an animation set is the concatenation of all of its
component animations
Parameters
| currentTime
| Where we are in the animation. This is wall clock
time. |
| t
| A tranformation object that is provided by the
caller and will be filled in by the animation. |
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
|
public
void
scaleCurrentDuration(float scale)
How much to scale the duration by.
Parameters
| scale
| The amount to scale the duration.
|
public
void
setDuration(long durationMillis)
Sets the duration of every child animation.
Parameters
| durationMillis
| the duration of the animation, in milliseconds, for
every child in this set
|
public
void
setFillAfter(boolean fillAfter)
If fillAfter is true, the transformation that this animation performed
will persist when it is finished. Defaults to true if not set.
Note that this applies when using an
AnimationSet to chain
animations. The transformation is not applied before the AnimationSet
itself starts.
Parameters
| fillAfter
| true if the animation should apply its transformation after it ends
|
public
void
setFillBefore(boolean fillBefore)
If fillBefore is true, this animation will apply its transformation
before the start time of the animation. Defaults to false if not set.
Note that this applies when using an
AnimationSet to chain
animations. The transformation is not applied before the AnimationSet
itself starts.
Parameters
| fillBefore
| true if the animation should apply its transformation before it starts
|
public
void
setRepeatMode(int repeatMode)
Defines what this animation should do when it reaches the end.
Defaults to NO_REPEAT
Parameters
| repeatMode
| One of NO_REPEAT, REPEAT, or REVERSE
|
public
void
setStartOffset(long startOffset)
When this animation should start relative to the start time. This is most
useful when composing complex animations using an
AnimationSet
where some of the animations components start at different times.
Parameters
| startOffset
| When this Animation should start, in milliseconds from
the start time of the root AnimationSet.
|
public
void
setStartTime(long startTimeMillis)
Sets the start time of this animation and all child animations
Parameters
| startTimeMillis
| the start time in milliseconds
|
public
boolean
willChangeTargetViewBounds()
Indicates whether or not this animation will affect the current
bounds of the target view. For instance, a fade animation will not
affect the bounds whereas a scale animation will.
public
boolean
willChangeTransformationMatrix()
Indicates whether or not this animation will affect the transformation
matrix. For instance, a fade animation will not affect the matrix whereas
a scale animation will.