Class ModelAnimator.PropertyValuesHolder
- java.lang.Object
-
- com.google.ar.sceneform.animation.ModelAnimator.PropertyValuesHolder
-
- Enclosing class:
- ModelAnimator
public static class ModelAnimator.PropertyValuesHolder extends java.lang.Object
This class holds information about a property and the values that that property should take during an animation.PropertyValuesHolder objects can be used to create animations with ObjectAnimator or that operate on several different properties in parallel.
Warning:
Using this PropertyValuesHolder is very useful for targeting multiple time or frame properties of multiple animations inside a same ObjectAnimator model
and insure a less consuming
Choreographer.FrameCallback
than usingAnimatorSet.playTogether(android.animation.Animator...)
but If you want to use the
ObjectAnimator.setAutoCancel(boolean)
functionality, you have to take care of this :ObjectAnimator.hasSameTargetAndProperties(Animator anim) { PropertyValuesHolder[] theirValues = ((ObjectAnimator) anim).getValues(); if (((ObjectAnimator) anim).getTarget() == getTarget() && mValues.length == theirValues.length) { for (int i = 0; i < mValues.length; ++i) { PropertyValuesHolder pvhMine = mValues[i]; PropertyValuesHolder pvhTheirs = theirValues[i]; if (pvhMine.getPropertyName() == null || !pvhMine.getPropertyName().equals(pvhTheirs.getPropertyName())) { return false; } } return true; } }
- See Also:
ObjectAnimator
-
-
Constructor Summary
Constructors Constructor Description PropertyValuesHolder()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static android.animation.PropertyValuesHolder
ofAnimation(ModelAnimation animation)
Constructs and returns a PropertyValuesHolder for a targetedModelAnimation
.static android.animation.PropertyValuesHolder
ofAnimationFraction(ModelAnimation animation, float... fractions)
Constructs and returns a PropertyValuesHolder for a targetedModelAnimation
with a given set of fraction values.static android.animation.PropertyValuesHolder
ofAnimationFraction(java.lang.String animationName, float... fractions)
Constructs and returns a PropertyValuesHolder for a targetedModelAnimation
with a given set of fraction values.static android.animation.PropertyValuesHolder
ofAnimationFrame(ModelAnimation animation, int... frames)
Constructs and returns a PropertyValuesHolder for a targetedModelAnimation
with a given set of frame values.static android.animation.PropertyValuesHolder
ofAnimationFrame(java.lang.String animationName, int... frames)
Constructs and returns a PropertyValuesHolder for a targetedModelAnimation
with a given set of fame values.static android.animation.PropertyValuesHolder
ofAnimationTime(ModelAnimation animation, float... times)
Constructs and returns a PropertyValuesHolder for a targetedModelAnimation
with a given set of time values.static android.animation.PropertyValuesHolder
ofAnimationTime(java.lang.String animationName, float... times)
Constructs and returns a PropertyValuesHolder for a targeted animation set of time values.
-
-
-
Method Detail
-
ofAnimation
public static android.animation.PropertyValuesHolder ofAnimation(ModelAnimation animation)
Constructs and returns a PropertyValuesHolder for a targetedModelAnimation
. This method applies by default this to the returned ObjectAnimator :- The duration value to the
ModelAnimation.getDuration()
in order to match the original animation speed. - The interpolator to
LinearInterpolator
in order to match the natural animation interpolation.
- Parameters:
animation
- The animation of interest- Returns:
- The constructed PropertyValuesHolder object.
- The duration value to the
-
ofAnimationTime
public static android.animation.PropertyValuesHolder ofAnimationTime(java.lang.String animationName, float... times)
Constructs and returns a PropertyValuesHolder for a targeted animation set of time values.- Parameters:
animationName
- The string name of the animation.
This name should correspond to the one defined and exported in the model.
Typically the action name defined in the 3D creation software.ModelAnimation.getName()
times
- The elapsed times (between 0 andModelAnimation.getDuration()
that theModelAnimation
will animate between.- Returns:
- The constructed PropertyValuesHolder object.
- See Also:
ofAnimationTime(ModelAnimation, float...)
-
ofAnimationTime
public static android.animation.PropertyValuesHolder ofAnimationTime(ModelAnimation animation, float... times)
Constructs and returns a PropertyValuesHolder for a targetedModelAnimation
with a given set of time values.- A single value implies that that value is the one being animated to starting from the
actual value on the provided
ModelAnimation
. - Two values imply a starting and ending values.
- More than two values imply a starting value, values to animate through along the way, and an ending value (these values will be distributed evenly across the duration of the animation).
The properties (time, frame,... position) are applied to the
AnimatableModel
This method applies by default this to the returned ObjectAnimator :- The duration value to the
ModelAnimation.getDuration()
in order to match the original animation speed. - The interpolator to
LinearInterpolator
in order to match the natural animation interpolation.
- Parameters:
animation
- The animation of interesttimes
- The elapsed times (between 0 andModelAnimation.getDuration()
that theModelAnimation
will animate between.- Returns:
- The constructed PropertyValuesHolder object.
- A single value implies that that value is the one being animated to starting from the
actual value on the provided
-
ofAnimationFrame
public static android.animation.PropertyValuesHolder ofAnimationFrame(java.lang.String animationName, int... frames)
Constructs and returns a PropertyValuesHolder for a targetedModelAnimation
with a given set of fame values.- Parameters:
animationName
- The string name of the animation.
This name should correspond to the one defined and exported in the model.
Typically the action name defined in the 3D creation software.ModelAnimation.getName()
frames
- The frame numbers (between 0 andModelAnimation.getFrameCount()
that theModelAnimation
will animate between.- Returns:
- The constructed PropertyValuesHolder object.
- See Also:
ofAnimationFrame(String, int...)
-
ofAnimationFrame
public static android.animation.PropertyValuesHolder ofAnimationFrame(ModelAnimation animation, int... frames)
Constructs and returns a PropertyValuesHolder for a targetedModelAnimation
with a given set of frame values.- A single value implies that that value is the one being animated to starting from the
actual value on the provided
ModelAnimation
. - Two values imply a starting and ending values.
- More than two values imply a starting value, values to animate through along the way, and an ending value (these values will be distributed evenly across the duration of the animation).
The properties (time, frame,... position) are applied to the
AnimatableModel
This method applies by default this to the returned ObjectAnimator :- The duration value to the
ModelAnimation.getDuration()
in order to match the original animation speed. - The interpolator to
LinearInterpolator
in order to match the natural animation interpolation.
- Parameters:
animation
- The animation of interestframes
- The frame numbers (between 0 andModelAnimation.getFrameCount()
that theModelAnimation
will animate between.- Returns:
- The constructed PropertyValuesHolder object.
- A single value implies that that value is the one being animated to starting from the
actual value on the provided
-
ofAnimationFraction
public static android.animation.PropertyValuesHolder ofAnimationFraction(java.lang.String animationName, float... fractions)
Constructs and returns a PropertyValuesHolder for a targetedModelAnimation
with a given set of fraction values.- Parameters:
animationName
- The string name of the animation.
This name should correspond to the one defined and exported in the model.
Typically the action name defined in the 3D creation software.ModelAnimation.getName()
fractions
- The fractions (percentage) (between 0 and 1)- Returns:
- The constructed PropertyValuesHolder object.
- See Also:
ofAnimationFraction(ModelAnimation, float...)
-
ofAnimationFraction
public static android.animation.PropertyValuesHolder ofAnimationFraction(ModelAnimation animation, float... fractions)
Constructs and returns a PropertyValuesHolder for a targetedModelAnimation
with a given set of fraction values.- A single value implies that that value is the one being animated to starting from the
actual value on the provided
ModelAnimation
. - Two values imply a starting and ending values.
- More than two values imply a starting value, values to animate through along the way, and an ending value (these values will be distributed evenly across the duration of the animation).
The properties (time, frame,... position) are applied to the
AnimatableModel
This method applies by default this to the returned ObjectAnimator :- The duration value to the
ModelAnimation.getDuration()
in order to match the original animation speed. - The interpolator to
LinearInterpolator
in order to match the natural animation interpolation.
- Parameters:
animation
- The animation of interestfractions
- The fractions (percentage) (between 0 and 1)- Returns:
- The constructed PropertyValuesHolder object.
- A single value implies that that value is the one being animated to starting from the
actual value on the provided
-
-