Animation
abstract class Animation : Cloneable
| kotlin.Any | |
| ↳ | android.view.animation.Animation |
Abstraction for an Animation that can be applied to Views, Surfaces, or other objects. See the animation package.
Summary
| Nested classes | |
|---|---|
| abstract |
An animation listener receives notifications from an animation. |
| open |
Utility class to parse a string description of a size. |
| Constants | |
|---|---|
| static Int |
The specified dimension is an absolute number of pixels. |
| static Int |
Repeat the animation indefinitely. |
| static Int |
The specified dimension holds a float and should be multiplied by the height or width of the parent of the object being animated. |
| static Int |
The specified dimension holds a float and should be multiplied by the height or width of the object being animated. |
| static Int |
When the animation reaches the end and the repeat count is INFINTE_REPEAT or a positive value, the animation restarts from the beginning. |
| static Int |
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). |
| static Int |
Can be used as the start time to indicate the start time should be the current time when |
| static Int |
Requests that the content being animated be forced under all other content for the duration of the animation. |
| static Int |
Requests that the content being animated be kept in its current Z order. |
| static Int |
Requests that the content being animated be forced on top of all other content for the duration of the animation. |
| Public constructors | |
|---|---|
|
Creates a new animation with a duration of 0ms, the default interpolator, with fillBefore set to true and fillAfter set to false |
|
Animation(context: Context!, attrs: AttributeSet!)Creates a new animation whose parameters come from the specified context and attributes set. |
|
| Public methods | |
|---|---|
| open Unit |
cancel()Cancel the animation. |
| open Long |
Compute a hint at how long the entire animation may last, in milliseconds. |
| open Int |
Returns the background color to show behind the animating windows. |
| open Int |
Returns the background color behind the animation. |
| open Boolean |
Return value of |
| open Long |
How long this animation should last |
| open Boolean |
If fillAfter is true, this animation will apply its transformation after the end time of the animation. |
| open Boolean |
If fillBefore is true, this animation will apply its transformation before the start time of the animation. |
| open Interpolator! |
Gets the acceleration curve type for this animation. |
| open Int |
Defines how many times the animation should repeat. |
| open Int |
Defines what this animation should do when it reaches the end. |
| open Boolean |
If showBackdrop is |
| open Long |
When this animation should start, relative to StartTime |
| open Long |
When this animation should start. |
| open Boolean |
getTransformation(currentTime: Long, outTransformation: Transformation!)Gets the transformation to apply at a specified point in time. |
| open Boolean |
getTransformation(currentTime: Long, outTransformation: Transformation!, scale: Float)Gets the transformation to apply at a specified point in time. |
| open Int |
Returns the Z ordering mode to use while running the animation as previously set by |
| open Boolean |
hasEnded()Indicates whether this animation has ended or not. |
| open Boolean |
Indicates whether this animation has started or not. |
| open Unit |
initialize(width: Int, height: Int, parentWidth: Int, parentHeight: Int)Initialize this animation with the dimensions of the object being animated as well as the objects parents. |
| open Boolean |
If fillEnabled is true, this animation will apply the value of fillBefore. |
| open Boolean |
Whether or not the animation has been initialized. |
| open Unit |
reset()Reset the initialization state of this animation. |
| open Unit |
restrictDuration(durationMillis: Long)Ensure that the duration that this animation will run is not longer than durationMillis. |
| open Unit |
scaleCurrentDuration(scale: Float)How much to scale the duration by. |
| open Unit |
setAnimationListener(listener: Animation.AnimationListener!)Binds an animation listener to this animation. |
| open Unit |
setBackdropColor(backdropColor: Int)Set the color to use for the backdrop shown behind the animating windows. |
| open Unit |
setBackgroundColor(bg: Int)Set background behind animation. |
| open Unit |
setDetachWallpaper(detachWallpaper: Boolean)If detachWallpaper is true, and this is a window animation of a window that has a wallpaper background, then the window will be detached from the wallpaper while it runs. |
| open Unit |
setDuration(durationMillis: Long)How long this animation should last. |
| open Unit |
setFillAfter(fillAfter: Boolean)If fillAfter is true, the transformation that this animation performed will persist when it is finished. |
| open Unit |
setFillBefore(fillBefore: Boolean)If fillBefore is true, this animation will apply its transformation before the start time of the animation. |
| open Unit |
setFillEnabled(fillEnabled: Boolean)If fillEnabled is true, the animation will apply the value of fillBefore. |
| open Unit |
setInterpolator(context: Context!, resID: Int)Sets the acceleration curve for this animation. |
| open Unit |
Sets the acceleration curve for this animation. |
| open Unit |
setRepeatCount(repeatCount: Int)Sets how many times the animation should be repeated. |
| open Unit |
setRepeatMode(repeatMode: Int)Defines what this animation should do when it reaches the end. |
| open Unit |
setShowBackdrop(showBackdrop: Boolean)If showBackdrop is |
| open Unit |
setStartOffset(startOffset: Long)When this animation should start relative to the start time. |
| open Unit |
setStartTime(startTimeMillis: Long)When this animation should start. |
| open Unit |
setZAdjustment(zAdjustment: Int)Set the Z ordering mode to use while running the animation. |
| open Unit |
start()Convenience method to start the animation the first time |
| open Unit |
startNow()Convenience method to start the animation at the current time in milliseconds. |
| open Boolean |
Indicates whether or not this animation will affect the bounds of the animated view. |
| open Boolean |
Indicates whether or not this animation will affect the transformation matrix. |
| Protected methods | |
|---|---|
| open Unit |
applyTransformation(interpolatedTime: Float, t: Transformation!)Helper for getTransformation. |
| open Animation |
clone()Creates and returns a copy of this object. |
| open Unit |
Gurantees that this animation has an interpolator. |
| open Unit |
finalize()Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. |
| open Float |
The scale factor is set by the call to |
| open Float |
resolveSize(type: Int, value: Float, size: Int, parentSize: Int)Convert the information in the description of a size to an actual dimension |
Constants
ABSOLUTE
static val ABSOLUTE: Int
The specified dimension is an absolute number of pixels.
Value: 0RELATIVE_TO_PARENT
static val RELATIVE_TO_PARENT: Int
The specified dimension holds a float and should be multiplied by the height or width of the parent of the object being animated.
Value: 2RELATIVE_TO_SELF
static val RELATIVE_TO_SELF: Int
The specified dimension holds a float and should be multiplied by the height or width of the object being animated.
Value: 1RESTART
static val RESTART: Int
When the animation reaches the end and the repeat count is INFINTE_REPEAT or a positive value, the animation restarts from the beginning.
Value: 1REVERSE
static val REVERSE: Int
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).
Value: 2START_ON_FIRST_FRAME
static val START_ON_FIRST_FRAME: Int
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. This can is useful for short animations.
Value: -1ZORDER_BOTTOM
static val ZORDER_BOTTOM: Int
Requests that the content being animated be forced under all other content for the duration of the animation.
Value: -1ZORDER_NORMAL
static val ZORDER_NORMAL: Int
Requests that the content being animated be kept in its current Z order.
Value: 0ZORDER_TOP
static val ZORDER_TOP: Int
Requests that the content being animated be forced on top of all other content for the duration of the animation.
Value: 1Public constructors
Animation
Animation()
Creates a new animation with a duration of 0ms, the default interpolator, with fillBefore set to true and fillAfter set to false
Animation
Animation(
context: Context!,
attrs: AttributeSet!)
Creates a new animation whose parameters come from the specified context and attributes set.
| Parameters | |
|---|---|
context |
Context!: the application environment |
attrs |
AttributeSet!: the set of attributes holding the animation parameters |
Public methods
cancel
open fun cancel(): Unit
Cancel the animation. Cancelling an animation invokes the animation listener, if set, to notify the end of the animation. If you cancel an animation manually, you must call reset() before starting the animation again.
See Also
computeDurationHint
open fun computeDurationHint(): Long
Compute a hint at how long the entire animation may last, in milliseconds. Animations can be written to cause themselves to run for a different duration than what is computed here, but generally this should be accurate.
getBackdropColor
open fun getBackdropColor(): Int
Returns the background color to show behind the animating windows. Will only show the background if showBackdrop was set to true. See setShowBackdrop(boolean).
| Return | |
|---|---|
Int |
The backdrop color. If 0, the backdrop color will not apply. |
getBackgroundColor
open fungetBackgroundColor(): Int
Deprecated: None of window animations are running with background color.
Returns the background color behind the animation.
See Also
getDetachWallpaper
open fungetDetachWallpaper(): Boolean
Deprecated: All window animations are running with detached wallpaper.
Return value of setDetachWallpaper(boolean).
getDuration
open fun getDuration(): Long
How long this animation should last
| Return | |
|---|---|
Long |
the duration in milliseconds of the animation |
getFillAfter
open fun getFillAfter(): Boolean
If fillAfter is true, this animation will apply its transformation after the end time of the animation.
| Return | |
|---|---|
Boolean |
true if the animation applies its transformation after it ends |
getFillBefore
open fun getFillBefore(): Boolean
If fillBefore is true, this animation will apply its transformation before the start time of the animation. If fillBefore is false and fillEnabled is true, the transformation will not be applied until the start time of the animation.
| Return | |
|---|---|
Boolean |
true if the animation applies its transformation before it starts |
getInterpolator
open fun getInterpolator(): Interpolator!
Gets the acceleration curve type for this animation.
| Return | |
|---|---|
Interpolator! |
the Interpolator associated to this animation |
getRepeatCount
open fun getRepeatCount(): Int
Defines how many times the animation should repeat. The default value is 0.
| Return | |
|---|---|
Int |
the number of times the animation should repeat, or INFINITE |
getRepeatMode
open fun getRepeatMode(): Int
Defines what this animation should do when it reaches the end.
| Return | |
|---|---|
Int |
either one of REVERSE or RESTART |
getShowBackdrop
open fun getShowBackdrop(): Boolean
If showBackdrop is true and this animation is applied on a window, then the windows in the animation will animate with the background associated with this window behind them. If no backdrop color is explicitly set, the backdrop's color comes from the android.R.styleable#Theme_colorBackground that is applied to this window through its theme. If multiple animating windows have showBackdrop set to true during an animation, the top most window with showBackdrop set to true and a valid background color takes precedence.
| Return | |
|---|---|
Boolean |
if a backdrop should be shown behind the animating windows. |
getStartOffset
open fun getStartOffset(): Long
When this animation should start, relative to StartTime
| Return | |
|---|---|
Long |
the start offset in milliseconds |
getStartTime
open fun getStartTime(): Long
When this animation should start. If the animation has not startet yet, this method might return START_ON_FIRST_FRAME.
| Return | |
|---|---|
Long |
the time in milliseconds when the animation should start or START_ON_FIRST_FRAME |
getTransformation
open fun getTransformation(
currentTime: Long,
outTransformation: Transformation!
): Boolean
Gets the transformation to apply at a specified point in time. Implementations of this method should always replace the specified Transformation or document they are doing otherwise.
| Parameters | |
|---|---|
c | |