ViewPropertyAnimatorCompat

class ViewPropertyAnimatorCompat
kotlin.Any
   ↳ androidx.core.view.ViewPropertyAnimatorCompat

Summary

Public methods
ViewPropertyAnimatorCompat!

This method will cause the View's translationX property to be animated to the specified value.

Long

Returns the current duration of property animations.

Long

Returns the current startDelay of property animations.

ViewPropertyAnimatorCompat!
xBy(value: Float)

This method will cause the View's x property to be animated by the specified value.

ViewPropertyAnimatorCompat!
z(value: Float)

This method will cause the View's z property to be animated to the specified value.

ViewPropertyAnimatorCompat!
x(value: Float)

This method will cause the View's x property to be animated to the specified value.

ViewPropertyAnimatorCompat!
scaleXBy(value: Float)

This method will cause the View's scaleX property to be animated by the specified value.

ViewPropertyAnimatorCompat!

This method will cause the View's translationY property to be animated by the specified value.

ViewPropertyAnimatorCompat!
withEndAction(runnable: Runnable!)

Specifies an action to take place when the next animation ends.

ViewPropertyAnimatorCompat!
rotation(value: Float)

This method will cause the View's rotation property to be animated to the specified value.

ViewPropertyAnimatorCompat!

Sets the startDelay for the underlying animator that animates the requested properties.

Unit

Cancels all property animations that are currently running or pending.

ViewPropertyAnimatorCompat!
alpha(value: Float)

This method will cause the View's alpha property to be animated to the specified value.

ViewPropertyAnimatorCompat!

This method will cause the View's translationZ property to be animated to the specified value.

Unit

Starts the currently pending property animations immediately.

Interpolator!

Returns the timing interpolator that this animation uses.

ViewPropertyAnimatorCompat!
rotationY(value: Float)

This method will cause the View's rotationY property to be animated to the specified value.

ViewPropertyAnimatorCompat!
scaleX(value: Float)

This method will cause the View's scaleX property to be animated to the specified value.

ViewPropertyAnimatorCompat!
zBy(value: Float)

This method will cause the View's z property to be animated by the specified value.

ViewPropertyAnimatorCompat!

Sets a listener for events in the underlying Animators that run the property animations.

ViewPropertyAnimatorCompat!

Sets the interpolator for the underlying animator that animates the requested properties.

ViewPropertyAnimatorCompat!

This method will cause the View's rotationX property to be animated by the specified value.

ViewPropertyAnimatorCompat!

This method will cause the View's translationY property to be animated to the specified value.

ViewPropertyAnimatorCompat!

Specifies an action to take place when the next animation runs.

ViewPropertyAnimatorCompat!
y(value: Float)

This method will cause the View's y property to be animated to the specified value.

ViewPropertyAnimatorCompat!
scaleYBy(value: Float)

This method will cause the View's scaleY property to be animated by the specified value.

ViewPropertyAnimatorCompat!
yBy(value: Float)

This method will cause the View's y property to be animated by the specified value.

ViewPropertyAnimatorCompat!

This method will cause the View's translationZ property to be animated by the specified value.

ViewPropertyAnimatorCompat!

This method will cause the View's translationX property to be animated by the specified value.

ViewPropertyAnimatorCompat!
setDuration(value: Long)

Sets the duration for the underlying animator that animates the requested properties.

ViewPropertyAnimatorCompat!

Sets a listener for update events in the underlying Animator that runs the property animations.

ViewPropertyAnimatorCompat!

The View associated with this ViewPropertyAnimator will have its layer type set to View#LAYER_TYPE_HARDWARE for the duration of the next animation.

ViewPropertyAnimatorCompat!
alphaBy(value: Float)

This method will cause the View's alpha property to be animated by the specified value.

ViewPropertyAnimatorCompat!
scaleY(value: Float)

This method will cause the View's scaleY property to be animated to the specified value.

ViewPropertyAnimatorCompat!
rotationX(value: Float)

This method will cause the View's rotationX property to be animated to the specified value.

ViewPropertyAnimatorCompat!
rotationBy(value: Float)

This method will cause the View's rotation property to be animated by the specified value.

ViewPropertyAnimatorCompat!

This method will cause the View's rotationY property to be animated by the specified value.

Public methods

translationX

fun translationX(value: Float): ViewPropertyAnimatorCompat!

This method will cause the View's translationX property to be animated to the specified value. Animations already running on the property will be canceled.

Parameters
value Float: The value to be animated to.
Return
ViewPropertyAnimatorCompat!: This object, allowing calls to methods in this class to be chained.

getDuration

fun getDuration(): Long

Returns the current duration of property animations. If the duration was set on this object, that value is returned. Otherwise, the default value of the underlying Animator is returned.

Return
Long: The duration of animations, in milliseconds.

getStartDelay

fun getStartDelay(): Long

Returns the current startDelay of property animations. If the startDelay was set on this object, that value is returned. Otherwise, the default value of the underlying Animator is returned.

Return
Long: The startDelay of animations, in milliseconds.

xBy

fun xBy(value: Float): ViewPropertyAnimatorCompat!

This method will cause the View's x property to be animated by the specified value. Animations already running on the property will be canceled.

Parameters
value Float: The amount to be animated by, as an offset from the current value.
Return
ViewPropertyAnimatorCompat!: This object, allowing calls to methods in this class to be chained.

z

fun z(value: Float): ViewPropertyAnimatorCompat!

This method will cause the View's z property to be animated to the specified value. Animations already running on the property will be canceled.

Prior to API 21, this method will do nothing.

Parameters
value Float: The amount to be animated by, as an offset from the current value.
Return
ViewPropertyAnimatorCompat!: This object, allowing calls to methods in this class to be chained.

x

fun x(value: Float): ViewPropertyAnimatorCompat!

This method will cause the View's x property to be animated to the specified value. Animations already running on the property will be canceled.

Parameters
value Float: The value to be animated to.
Return
ViewPropertyAnimatorCompat!: This object, allowing calls to methods in this class to be chained.

scaleXBy

fun scaleXBy(value: Float): ViewPropertyAnimatorCompat!

This method will cause the View's scaleX property to be animated by the specified value. Animations already running on the property will be canceled.

Parameters
value Float: The amount to be animated by, as an offset from the current value.
Return
ViewPropertyAnimatorCompat!: This object, allowing calls to methods in this class to be chained.

translationYBy

fun translationYBy(value: Float): ViewPropertyAnimatorCompat!

This method will cause the View's translationY property to be animated by the specified value. Animations already running on the property will be canceled.

Parameters
value Float: The amount to be animated by, as an offset from the current value.
Return
ViewPropertyAnimatorCompat!: This object, allowing calls to methods in this class to be chained.

withEndAction

fun withEndAction(runnable: Runnable!): ViewPropertyAnimatorCompat!

Specifies an action to take place when the next animation ends. The action is only run if the animation ends normally; if the ViewPropertyAnimator is canceled during that animation, the runnable will not run. This method, along with withStartAction(Runnable), is intended to help facilitate choreographing ViewPropertyAnimator animations with other animations or actions in the application.

For example, the following code animates a view to x=200 and then back to 0:

 Runnable endAction = new Runnable() { public void run() { view.animate().x(0); } }; view.animate().x(200).withEndAction(endAction); 

For API 14 and 15, this method will run by setting a listener on the ViewPropertyAnimatorCompat object and running the action in that listener's ViewPropertyAnimatorListener#onAnimationEnd(View) method.

Parameters
runnable Runnable!: The action to run when the next animation ends.
Return
ViewPropertyAnimatorCompat!: This object, allowing calls to methods in this class to be chained.

rotation

fun rotation(value: Float): ViewPropertyAnimatorCompat!

This method will cause the View's rotation property to be animated to the specified value. Animations already running on the property will be canceled.

Parameters
value Float: The value to be animated to.
Return
ViewPropertyAnimatorCompat!: This object, allowing calls to methods in this class to be chained.

setStartDelay

fun setStartDelay(value: Long): ViewPropertyAnimatorCompat!

Sets the startDelay for the underlying animator that animates the requested properties. By default, the animator uses the default value for ValueAnimator. Calling this method will cause the declared value to be used instead.

Parameters
value Long: The delay of ensuing property animations, in milliseconds. The value cannot be negative.
Return
ViewPropertyAnimatorCompat!: This object, allowing calls to methods in this class to be chained.

cancel

fun cancel(): Unit

Cancels all property animations that are currently running or pending.

alpha

fun alpha(value: Float): ViewPropertyAnimatorCompat!

This method will cause the View's alpha property to be animated to the specified value. Animations already running on the property will be canceled.

Parameters
value Float: The value to be animated to.
Return
ViewPropertyAnimatorCompat!: This object, allowing calls to methods in this class to be chained.

translationZ

fun translationZ(value: Float): ViewPropertyAnimatorCompat!

This method will cause the View's translationZ property to be animated to the specified value. Animations already running on the property will be canceled.

Prior to API 21, this method will do nothing.

Parameters
value Float: The amount to be animated by, as an offset from the current value.
Return
ViewPropertyAnimatorCompat!: This object, allowing calls to methods in this class to be chained.

start

fun start(): Unit

Starts the currently pending property animations immediately. Calling start() is optional because all animations start automatically at the next opportunity. However, if the animations are needed to start immediately and synchronously (not at the time when the next event is processed by the hierarchy, which is when the animations would begin otherwise), then this method can be used.

getInterpolator

fun getInterpolator(): Interpolator!

Returns the timing interpolator that this animation uses.

Return
Interpolator!: The timing interpolator for this animation.

rotationY

fun rotationY(value: Float): ViewPropertyAnimatorCompat!

This method will cause the View's rotationY property to be animated to the specified value. Animations already running on the property will be canceled.

Parameters
value Float: The value to be animated to.
Return
ViewPropertyAnimatorCompat!: This object, allowing calls to methods in this class to be chained.

scaleX

fun scaleX(value: Float): ViewPropertyAnimatorCompat!

This method will cause the View's scaleX property to be animated to the specified value. Animations already running on the property will be canceled.

Parameters
value Float: The value to be animated to.
Return
ViewPropertyAnimatorCompat!: This object, allowing calls to methods in this class to be chained.

zBy

fun zBy(value: Float): ViewPropertyAnimatorCompat!

This method will cause the View's z property to be animated by the specified value. Animations already running on the property will be canceled.

Prior to API 21, this method will do nothing.

Parameters
value Float: The amount to be animated by, as an offset from the current value.
Return
ViewPropertyAnimatorCompat!: This object, allowing calls to methods in this class to be chained.

setListener

fun setListener(listener: ViewPropertyAnimatorListener!): ViewPropertyAnimatorCompat!

Sets a listener for events in the underlying Animators that run the property animations.

Parameters
listener ViewPropertyAnimatorListener!: The listener to be called with AnimatorListener events. A value of null removes any existing listener.
Return
ViewPropertyAnimatorCompat!: This object, allowing calls to methods in this class to be chained.

setInterpolator

fun setInterpolator(value: Interpolator!): ViewPropertyAnimatorCompat!

Sets the interpolator for the underlying animator that animates the requested properties. By default, the animator uses the default interpolator for ValueAnimator. Calling this method will cause the declared object to be used instead.

Parameters
value Interpolator!: The TimeInterpolator to be used for ensuing property animations.
Return
ViewPropertyAnimatorCompat!: This object, allowing calls to methods in this class to be chained.

rotationXBy

fun rotationXBy(value: Float): ViewPropertyAnimatorCompat!

This method will cause the View's rotationX property to be animated by the specified value. Animations already running on the property will be canceled.

Parameters
value Float: The amount to be animated by, as an offset from the current value.
Return
ViewPropertyAnimatorCompat!: This object, allowing calls to methods in this class to be chained.

translationY

fun translationY(value: Float): ViewPropertyAnimatorCompat!

This method will cause the View's translationY property to be animated to the specified value. Animations already running on the property will be canceled.

Parameters
value Float: The value to be animated to.
Return
ViewPropertyAnimatorCompat!: This object, allowing calls to methods in this class to be chained.

withStartAction

fun withStartAction(runnable: Runnable!): ViewPropertyAnimatorCompat!

Specifies an action to take place when the next animation runs. If there is a startDelay set on this ViewPropertyAnimator, then the action will run after that startDelay expires, when the actual animation begins. This method, along with withEndAction(Runnable), is intended to help facilitate choreographing ViewPropertyAnimator animations with other animations or actions in the application.

For API 14 and 15, this method will run by setting a listener on the ViewPropertyAnimatorCompat object and running the action in that listener's ViewPropertyAnimatorListener#onAnimationStart(View) method.

Parameters
runnable Runnable!: The action to run when the next animation starts.
Return
ViewPropertyAnimatorCompat!: This object, allowing calls to methods in this class to be chained.

y

fun y(value: Float): ViewPropertyAnimatorCompat!

This method will cause the View's y property to be animated to the specified value. Animations already running on the property will be canceled.

Parameters
value Float: The value to be animated to.
Return
ViewPropertyAnimatorCompat!: This object, allowing calls to methods in this class to be chained.

scaleYBy

fun scaleYBy(value: Float): ViewPropertyAnimatorCompat!

This method will cause the View's scaleY property to be animated by the specified value. Animations already running on the property will be canceled.

Parameters
value Float: The amount to be animated by, as an offset from the current value.
Return
ViewPropertyAnimatorCompat!: This object, allowing calls to methods in this class to be chained.

yBy

fun yBy(value: Float): ViewPropertyAnimatorCompat!

This method will cause the View's y property to be animated by the specified value. Animations already running on the property will be canceled.

Parameters
value Float: The amount to be animated by, as an offset from the current value.
Return
ViewPropertyAnimatorCompat!: This object, allowing calls to methods in this class to be chained.

translationZBy

fun translationZBy(value: Float): ViewPropertyAnimatorCompat!

This method will cause the View's translationZ property to be animated by the specified value. Animations already running on the property will be canceled.

Prior to API 21, this method will do nothing.

Parameters
value Float: The amount to be animated by, as an offset from the current value.
Return
ViewPropertyAnimatorCompat!: This object, allowing calls to methods in this class to be chained.

translationXBy

fun translationXBy(value: Float): ViewPropertyAnimatorCompat!

This method will cause the View's translationX property to be animated by the specified value. Animations already running on the property will be canceled.

Parameters
value Float: The amount to be animated by, as an offset from the current value.
Return
ViewPropertyAnimatorCompat!: This object, allowing calls to methods in this class to be chained.

setDuration

fun setDuration(value: Long): ViewPropertyAnimatorCompat!

Sets the duration for the underlying animator that animates the requested properties. By default, the animator uses the default value for ValueAnimator. Calling this method will cause the declared value to be used instead.

Parameters
value Long: The length of ensuing property animations, in milliseconds. The value cannot be negative.
Return
ViewPropertyAnimatorCompat!: This object, allowing calls to methods in this class to be chained.

setUpdateListener

fun setUpdateListener(listener: ViewPropertyAnimatorUpdateListener!): ViewPropertyAnimatorCompat!

Sets a listener for update events in the underlying Animator that runs the property animations.

Prior to API 19, this method will do nothing.

Parameters
listener ViewPropertyAnimatorUpdateListener!: The listener to be called with update events. A value of null removes any existing listener.
Return
ViewPropertyAnimatorCompat!: This object, allowing calls to methods in this class to be chained.

withLayer

fun withLayer(): ViewPropertyAnimatorCompat!

The View associated with this ViewPropertyAnimator will have its layer type set to View#LAYER_TYPE_HARDWARE for the duration of the next animation. As stated in the documentation for View#LAYER_TYPE_HARDWARE, the actual type of layer used internally depends on the runtime situation of the view. If the activity and this view are hardware-accelerated, then the layer will be accelerated as well. If the activity or the view is not accelerated, then the layer will effectively be the same as View#LAYER_TYPE_SOFTWARE.

This state is not persistent, either on the View or on this ViewPropertyAnimator: the layer type of the View will be restored when the animation ends to what it was when this method was called, and this setting on ViewPropertyAnimator is only valid for the next animation. Note that calling this method and then independently setting the layer type of the View (by a direct call to View#setLayerType(int, android.graphics.Paint)) will result in some inconsistency, including having the layer type restored to its pre-withLayer() value when the animation ends.

For API 14 and 15, this method will run by setting a listener on the ViewPropertyAnimatorCompat object, setting a hardware layer in the listener's ViewPropertyAnimatorListener#onAnimationStart(View) method, and then restoring the orignal layer type in the listener's ViewPropertyAnimatorListener#onAnimationEnd(View) method.

Return
ViewPropertyAnimatorCompat!: This object, allowing calls to methods in this class to be chained.

alphaBy

fun alphaBy(value: Float): ViewPropertyAnimatorCompat!

This method will cause the View's alpha property to be animated by the specified value. Animations already running on the property will be canceled.

Parameters
value Float: The amount to be animated by, as an offset from the current value.
Return
ViewPropertyAnimatorCompat!: This object, allowing calls to methods in this class to be chained.

scaleY

fun scaleY(value: Float): ViewPropertyAnimatorCompat!

This method will cause the View's scaleY property to be animated to the specified value. Animations already running on the property will be canceled.

Parameters
value Float: The value to be animated to.
Return
ViewPropertyAnimatorCompat!: This object, allowing calls to methods in this class to be chained.

rotationX

fun rotationX(value: Float): ViewPropertyAnimatorCompat!

This method will cause the View's rotationX property to be animated to the specified value. Animations already running on the property will be canceled.

Parameters
value Float: The value to be animated to.
Return
ViewPropertyAnimatorCompat!: This object, allowing calls to methods in this class to be chained.

rotationBy

fun rotationBy(value: Float): ViewPropertyAnimatorCompat!

This method will cause the View's rotation property to be animated by the specified value. Animations already running on the property will be canceled.

Parameters
value Float: The amount to be animated by, as an offset from the current value.
Return
ViewPropertyAnimatorCompat!: This object, allowing calls to methods in this class to be chained.

rotationYBy

fun rotationYBy(value: Float): ViewPropertyAnimatorCompat!

This method will cause the View's rotationY property to be animated by the specified value. Animations already running on the property will be canceled.

Parameters
value Float: The amount to be animated by, as an offset from the current value.
Return
ViewPropertyAnimatorCompat!: This object, allowing calls to methods in this class to be chained.