Class KeyframeSet

java.lang.Object
icyllis.modernui.animation.KeyframeSet
All Implemented Interfaces:
Keyframes

public class KeyframeSet extends Object implements Keyframes
This class holds a collection of Keyframe objects and is called by ValueAnimator to calculate values between those keyframes for a given animation. The class internal to the animation package because it is an implementation detail of how Keyframes are stored and used.
  • Method Details

    • ofInt

      @Nonnull public static icyllis.modernui.animation.IntKeyframeSet ofInt(@Nonnull int... values)
    • ofFloat

      @Nonnull public static icyllis.modernui.animation.FloatKeyframeSet ofFloat(@Nonnull float... values)
    • ofObject

      @Nonnull public static Keyframes ofObject(@Nonnull Object... values)
    • ofKeyframe

      @Nonnull public static KeyframeSet ofKeyframe(@Nonnull Keyframe... keyframes)
    • setEvaluator

      public void setEvaluator(TypeEvaluator<?> evaluator)
      Description copied from interface: Keyframes
      Sets the TypeEvaluator to be used when calculating animated values. This object is required only for Keyframes that are not either IntKeyframes or FloatKeyframes, both of which assume their own evaluator to speed up calculations with those primitive types.
      Specified by:
      setEvaluator in interface Keyframes
      Parameters:
      evaluator - The TypeEvaluator to be used to calculate animated values.
    • copy

      public KeyframeSet copy()
      Specified by:
      copy in interface Keyframes
    • getValue

      public Object getValue(float fraction)
      Description copied from interface: Keyframes
      Gets the animated value, given the elapsed fraction of the animation (interpolated by the animation's interpolator) and the evaluator used to calculate in-between values. This function maps the input fraction to the appropriate keyframe interval and a fraction between them and returns the interpolated value. Note that the input fraction may fall outside the [0-1] bounds, if the animation's interpolator made that happen (e.g., a spring interpolation that might send the fraction past 1.0). We handle this situation by just using the two keyframes at the appropriate end when the value is outside those bounds.
      Specified by:
      getValue in interface Keyframes
      Parameters:
      fraction - The elapsed fraction of the animation
      Returns:
      The animated value.
    • getKeyframes

      public Keyframe[] getKeyframes()
      Specified by:
      getKeyframes in interface Keyframes
      Returns:
      The backing array of all Keyframes contained by this. This may return null if this is not made up of Keyframes.
    • toString

      public String toString()
      Overrides:
      toString in class Object