MotionSpec
public
class
MotionSpec
extends Object
| java.lang.Object
|
| ↳ |
com.google.android.material.animation.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 <objectAnimator> or a <set> of multiple
<objectAnimator>.
<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>
Summary
Public methods |
static
MotionSpec
|
createFromAttribute(Context context, TypedArray attributes, int index)
Inflates an instance of MotionSpec from the animator resource indexed in the given attributes
array.
|
static
MotionSpec
|
createFromResource(Context context, int id)
Inflates an instance of MotionSpec from the given animator resource.
|
boolean
|
equals(Object o)
|
ObjectAnimator
|
getAnimator(String name, View view, Property<View, Float> property)
|
PropertyValuesHolder[]
|
getPropertyValues(String name)
|
MotionTiming
|
getTiming(String name)
Returns the MotionTiming with the given name, or throws IllegalArgumentException if it does not
exist.
|
long
|
getTotalDuration()
Returns the total duration of this motion spec, which is the maximum delay+duration of its
motion timings.
|
boolean
|
hasPropertyValues(String name)
Returns whether this motion spec contains a ERROR(/PropertyValuesHolder[]) with the given name.
|
boolean
|
hasTiming(String name)
Returns whether this motion spec contains a MotionTiming with the given name.
|
int
|
hashCode()
|
void
|
setPropertyValues(String name, PropertyValuesHolder[] values)
|
void
|
setTiming(String name, MotionTiming timing)
Sets a MotionTiming with the given name.
|
String
|
toString()
|
Inherited methods |
From
class
java.lang.Object
Object
|
clone()
|
boolean
|
equals(Object arg0)
|
void
|
finalize()
|
final
Class<?>
|
getClass()
|
int
|
hashCode()
|
final
void
|
notify()
|
final
void
|
notifyAll()
|
String
|
toString()
|
final
void
|
wait(long arg0, int arg1)
|
final
void
|
wait(long arg0)
|
final
void
|
wait()
|
|
Public constructors
Public methods
createFromAttribute
MotionSpec createFromAttribute (Context context,
TypedArray attributes,
int index)
Inflates an instance of MotionSpec from the animator resource indexed in the given attributes
array.
| Parameters |
context |
Context |
attributes |
TypedArray |
index |
int |
createFromResource
MotionSpec createFromResource (Context context,
int id)
Inflates an instance of MotionSpec from the given animator resource.
| Parameters |
context |
Context |
id |
int |
equals
boolean equals (Object o)
getAnimator
ObjectAnimator getAnimator (String name,
View view,
Property<View, Float> property)
| Parameters |
name |
String |
view |
View |
property |
Property |
getPropertyValues
PropertyValuesHolder[] getPropertyValues (String name)
| Returns |
PropertyValuesHolder[] |
|
getTiming
MotionTiming getTiming (String name)
Returns the MotionTiming with the given name, or throws IllegalArgumentException if it does not
exist.
getTotalDuration
long getTotalDuration ()
Returns the total duration of this motion spec, which is the maximum delay+duration of its
motion timings.
hasPropertyValues
boolean hasPropertyValues (String name)
Returns whether this motion spec contains a ERROR(/PropertyValuesHolder[]) with the given name.
hasTiming
boolean hasTiming (String name)
Returns whether this motion spec contains a MotionTiming with the given name.
setPropertyValues
void setPropertyValues (String name,
PropertyValuesHolder[] values)
| Parameters |
name |
String |
values |
PropertyValuesHolder |
setTiming
void setTiming (String name,
MotionTiming timing)
Sets a MotionTiming with the given name.
| Parameters |
name |
String |
timing |
MotionTiming |
toString
String toString ()