MotionSpec

open class MotionSpec

A motion spec contains multiple named motion timings.

Inflate an instance of MotionSpec from XML by creating a Property Animation resource in res/animator. The file must contain an <objectAnimator> or a <set> of object animators.

This class will store a map of String keys to MotionTiming values. Each animator's android:propertyName attribute will be used as the key, while the other attributes android:startOffset, android:duration, android:interpolator, android:repeatCount, and android:repeatMode will be used to create the MotionTiming instance.

A motion spec resource can either be an or a of multiple .


<set xmlns:android="http://schemas.android.com/apk/res/android">
  <objectAnimator
      android:propertyName="alpha"
      android:startOffset="0"
      android:duration="100"
      android:interpolator="@interpolator/mtrl_fast_out_slow_in"/>
  <objectAnimator
      android:propertyName="translation"
      android:startOffset="50"
      android:duration="150"/>
</set>

Constructors

Link copied to clipboard
constructor()

Functions

Link copied to clipboard
Inflates an instance of MotionSpec from the animator resource indexed in the given attributes array.
Link copied to clipboard
Inflates an instance of MotionSpec from the given animator resource.
Link copied to clipboard
open fun equals(o: Any): Boolean
Link copied to clipboard
open fun <T> getAnimator(@NonNull name: String, @NonNull target: T, @NonNull property: Property<T, out Any>): ObjectAnimator
Creates and returns an ObjectAnimator that animates the given property.
Link copied to clipboard
Get values for a property in this MotionSpec.
Link copied to clipboard
open fun getTiming(name: String): MotionTiming
Returns the MotionTiming with the given name, or throws IllegalArgumentException if it does not exist.
Link copied to clipboard
Returns the total duration of this motion spec, which is the maximum delay+duration of its motion timings.
Link copied to clipboard
open fun hashCode(): Int
Link copied to clipboard
Returns whether this motion spec contains a PropertyValuesHolder with the given name.
Link copied to clipboard
open fun hasTiming(name: String): Boolean
Returns whether this motion spec contains a MotionTiming with the given name.
Link copied to clipboard
Set values for a property in this MotionSpec.
Link copied to clipboard
open fun setTiming(name: String, @Nullable timing: MotionTiming)
Sets a MotionTiming with the given name.
Link copied to clipboard
open fun toString(): String