T - This generic should be instantiated with a concrete subclass of BaseAdditiveAnimator. It is used to access the builder methods across hierarchies.
Example:
public class MyViewAnimator extends BaseAdditiveAnimator<MyViewAnimator, View>
V - The type of object to be animated.public abstract class BaseAdditiveAnimator<T extends BaseAdditiveAnimator,V> extends AnimationSequence
SubclassableAdditiveViewAnimator for examples).| Modifier and Type | Field and Description |
|---|---|
protected at.wirecube.additiveanimations.additive_animator.AdditiveAnimationAccumulator |
mAnimationAccumulator |
protected at.wirecube.additiveanimations.additive_animator.AdditiveAnimatorGroup |
mAnimatorGroup
Indicates which animation group this animator belongs to.
|
protected TimeInterpolator |
mCurrentCustomInterpolator |
protected V |
mCurrentTarget |
protected T |
mParent |
protected at.wirecube.additiveanimations.additive_animator.RunningAnimationsManager<V> |
mRunningAnimationsManager |
protected long |
sequenceDelay
Delay set by the animation sequence this animator is a part of.
|
protected long |
staggerDelay
Delay set when using
targets(List, long) to create animations. |
| Constructor and Description |
|---|
BaseAdditiveAnimator() |
| Modifier and Type | Method and Description |
|---|---|
T |
action(AnimationAction<V> animationAction) |
T |
addEndAction(AnimationEndListener r) |
T |
addListener(Animator.AnimatorListener listener) |
T |
addPauseListener(Animator.AnimatorPauseListener listener) |
T |
addStartAction(Runnable r) |
T |
addTarget(V v)
Deprecated.
Use
#target(V) instead. |
T |
addUpdateListener(ValueAnimator.AnimatorUpdateListener listener) |
protected T |
animate(AdditiveAnimation animation) |
protected T |
animate(AdditiveAnimation animation,
boolean propagateToParentAnimators)
Handles some bookkeeping for adding the given animation to the list of running animations.
|
protected T |
animate(Property<V,Float> property,
float target) |
protected T |
animate(Property<V,Float> property,
float target,
TypeEvaluator<Float> evaluator) |
protected T |
animate(Property<V,Float> property,
Path p,
PathEvaluator.PathMode mode,
PathEvaluator sharedEvaluator) |
protected T |
animatePropertiesAlongPath(Property<V,Float> xProperty,
Property<V,Float> yProperty,
Property<V,Float> rotationProperty,
Path path) |
T |
animateProperty(float target,
FloatProperty<V> customProperty)
Deprecated.
Use
property(float, FloatProperty) instead. |
T |
animateProperty(float target,
TypeEvaluator<Float> evaluator,
FloatProperty<V> property)
Deprecated.
Use
property(float, TypeEvaluator, FloatProperty) instead. |
protected T |
animatePropertyBy(Property<V,Float> property,
float by,
boolean byValueCanBeUsedByParentAnimators)
TODO: documentation of byValueCanBeUsedByParentAnimators
|
static <V> void |
apply(AnimationAction<V> action,
List<V> targets) |
static <V> void |
apply(AnimationAction<V> action,
V... targets)
Immediately applies the animation action to the given targets.
|
protected void |
applyCustomProperties(Map<String,Float> tempProperties,
V target) |
static void |
cancelAnimation(List<Object> targets,
String animationTag) |
static void |
cancelAnimation(Object target,
String animationTag) |
static <T> void |
cancelAnimation(T target,
Property<T,Float> property) |
static void |
cancelAnimationsForObject(Object target) |
static void |
cancelAnimationsForObjects(Object... targets) |
static <T extends Collection<? extends Object>> |
cancelAnimationsInCollection(T targets) |
protected AdditiveAnimation<V> |
createAnimation(Property<V,Float> property,
float targetValue) |
protected AdditiveAnimation<V> |
createAnimation(Property<V,Float> property,
float targetValue,
TypeEvaluator<Float> evaluator) |
protected AdditiveAnimation<V> |
createAnimation(Property<V,Float> property,
Path path,
PathEvaluator.PathMode mode,
PathEvaluator sharedEvaluator) |
protected T |
createChildWithDelayAfterParentStart(long delay,
boolean isStagger) |
protected T |
createChildWithRawDelay(long delay) |
abstract Float |
getCurrentPropertyValue(String propertyName)
Returns the actual value of the animation target with the given name.
|
protected V |
getCurrentTarget() |
protected Float |
getQueuedPropertyValue(String propertyName)
Returns the last value that was queued for animation whose animation has not yet started.
|
protected at.wirecube.additiveanimations.additive_animator.RunningAnimationsManager<V> |
getRunningAnimationsManager() |
float |
getTargetPropertyValue(Property<V,Float> property)
Finds the last target value of the property with the given name, or returns `property.get()`
if the property isn't animating at the moment.
|
Float |
getTargetPropertyValue(String propertyName)
Finds the last target value of the property with the given name, if it was ever animated.
|
long |
getTotalDurationInSequence() |
protected ValueAnimator |
getValueAnimator() |
protected void |
initValueAnimatorIfNeeded() |
protected abstract T |
newInstance()
Factory method for creation of subclass instances.
|
abstract void |
onApplyChanges()
This method will be called when the current frame has been calculated.
|
T |
property(float target,
FloatProperty<V> customProperty) |
T |
property(float target,
FloatProperty<V> customProperty,
boolean by) |
T |
property(float target,
TypeEvaluator<Float> evaluator,
FloatProperty<V> property) |
protected void |
runIfParentIsInSameAnimationGroup(Runnable r) |
protected T |
self() |
static void |
setDefaultDuration(long defaultDuration)
Globally sets the default animation duration to use for all AdditiveAnimator instances.
|
static void |
setDefaultInterpolator(TimeInterpolator interpolator)
Globally sets the default interpolator to use for all AdditiveAnimator instances.
|
void |
setDelayInSequence(long delay) |
T |
setDuration(long duration) |
T |
setInterpolator(TimeInterpolator interpolator) |
protected T |
setParent(T other)
Copies all relevant attributes, including (ONLY) current target from `other` to self.
|
T |
setRepeatCount(int repeatCount) |
T |
setRepeatMode(int repeatMode) |
static void |
setsDefaultInterpolator(TimeInterpolator interpolator)
Deprecated.
This method name contains a typo. Use
setDefaultInterpolator(TimeInterpolator) instead. |
T |
setStartDelay(long startDelay) |
void |
start() |
T |
state(AnimationState<V> state) |
T |
switchDuration(long durationMillis) |
T |
switchInterpolator(TimeInterpolator newInterpolator)
Switches to the given interpolator only for all following animations.
|
T |
switchToDefaultInterpolator() |
T |
target(V v)
Sets the current animation target.
|
T |
targets(List<V> vs)
Used to animate the same property of multiple views.
|
T |
targets(List<V> vs,
long stagger)
Used to animate the same property of multiple views, with a delay before each element.
|
T |
targets(V... vs)
Used to animate the same property of multiple views.
|
T |
then()
Creates a new animator configured to start after the current animator with the current target
that was configured with this animator.
|
T |
thenBeforeEnd(long millisBeforeEnd)
Creates a new animator configured to start after
delayBeforeEnd milliseconds before the previous animation finishes
with the last used target and interpolator. |
T |
thenDelayAfterEnd(long delayAfterEnd)
Creates a new animator configured to start after
delayAfterEnd milliseconds after the previous animation has ended
with the last used target and interpolator. |
T |
thenWithDelay(long delay)
Creates a new animator configured to start after
delay milliseconds from now
with the last used target and interpolator. |
playSequentially, playSequentially, playTogether, playTogether, playWithDelayBetweenAnimationsprotected T extends BaseAdditiveAnimator mParent
protected V mCurrentTarget
@Nullable protected at.wirecube.additiveanimations.additive_animator.RunningAnimationsManager<V> mRunningAnimationsManager
protected at.wirecube.additiveanimations.additive_animator.AdditiveAnimationAccumulator mAnimationAccumulator
protected TimeInterpolator mCurrentCustomInterpolator
protected long staggerDelay
targets(List, long) to create animations.
Added to the delay set by setStartDelay(long) and sequenceDelay.
Will be considered in getTotalDuration().protected long sequenceDelay
setStartDelay(long) and the delay introduced by the stagger parameter of
targets(List, long).
Will be considered in getTotalDuration().protected at.wirecube.additiveanimations.additive_animator.AdditiveAnimatorGroup mAnimatorGroup
protected T self()
@NonNull protected final at.wirecube.additiveanimations.additive_animator.RunningAnimationsManager<V> getRunningAnimationsManager()
public static void cancelAnimationsForObject(Object target)
public static void cancelAnimationsForObjects(Object... targets)
public static <T extends Collection<? extends Object>> void cancelAnimationsInCollection(T targets)
protected void initValueAnimatorIfNeeded()
protected ValueAnimator getValueAnimator()
@Deprecated public T addTarget(V v)
#target(V) instead.#target(V), which should be used instead.public float getTargetPropertyValue(Property<V,Float> property)
public Float getTargetPropertyValue(String propertyName)
public abstract Float getCurrentPropertyValue(String propertyName)
protected Float getQueuedPropertyValue(String propertyName)
public abstract void onApplyChanges()
protected void applyCustomProperties(Map<String,Float> tempProperties, V target)
protected V getCurrentTarget()
protected final AdditiveAnimation<V> createAnimation(Property<V,Float> property, float targetValue)
protected final AdditiveAnimation<V> createAnimation(Property<V,Float> property, float targetValue, TypeEvaluator<Float> evaluator)
protected final AdditiveAnimation<V> createAnimation(Property<V,Float> property, Path path, PathEvaluator.PathMode mode, PathEvaluator sharedEvaluator)
protected final T animate(AdditiveAnimation animation, boolean propagateToParentAnimators)
animation - The animation to be added to the running animations.propagateToParentAnimators - Whether or not this animation will be propagated to the parent animators.
You can set it to `false` if you propagate the animation manually to the other animators in this group.
If you fail to propagate the animation correctly, targets(List, long) will not work with that animation.
(If you don't know what that means, you should probably just pass `true` and have the base implementation take care of it.)protected final T animate(AdditiveAnimation animation)
protected final T animate(Property<V,Float> property, Path p, PathEvaluator.PathMode mode, PathEvaluator sharedEvaluator)
protected final T animate(Property<V,Float> property, float target, TypeEvaluator<Float> evaluator)
protected final T animatePropertyBy(Property<V,Float> property, float by, boolean byValueCanBeUsedByParentAnimators)
protected final T animatePropertiesAlongPath(Property<V,Float> xProperty, Property<V,Float> yProperty, Property<V,Float> rotationProperty, Path path)
public T animateProperty(float target, TypeEvaluator<Float> evaluator, FloatProperty<V> property)
property(float, TypeEvaluator, FloatProperty) instead.property(float, TypeEvaluator, FloatProperty), which should be used instead.public T property(float target, TypeEvaluator<Float> evaluator, FloatProperty<V> property)
public T animateProperty(float target, FloatProperty<V> customProperty)
property(float, FloatProperty) instead.property(float, FloatProperty), which should be used instead.public T property(float target, FloatProperty<V> customProperty)
public T property(float target, FloatProperty<V> customProperty, boolean by)
public T state(AnimationState<V> state)
public T action(AnimationAction<V> animationAction)
public static <V> void apply(AnimationAction<V> action, V... targets)
public static <V> void apply(AnimationAction<V> action, List<V> targets)
public static void setDefaultDuration(long defaultDuration)
setDuration(long) on a specific instance.@Deprecated public static void setsDefaultInterpolator(TimeInterpolator interpolator)
setDefaultInterpolator(TimeInterpolator) instead.public static void setDefaultInterpolator(TimeInterpolator interpolator)
setInterpolator(TimeInterpolator) on a specific instance.public T target(V v)
start():
new AdditiveAnimator().target(view1).x(100).target(view2).y(200).start()
If you want to animate the same property of multiple views, use targets(Object[]) or targets(List, long)public T targets(@NonNull V... vs)
new AdditiveAnimator().targets(textView, button).alpha(0).start()public T targets(@NonNull List<V> vs)
new AdditiveAnimator().targets(myViewList).alpha(0).start()public T targets(@NonNull List<V> vs, long stagger)
new AdditiveAnimator().targets(Arrays.asList(textView, button), 100).translationYBy(100).alpha(0).start()public T addUpdateListener(ValueAnimator.AnimatorUpdateListener listener)
public T addPauseListener(Animator.AnimatorPauseListener listener)
public T addListener(Animator.AnimatorListener listener)
public T addEndAction(AnimationEndListener r)
public T setStartDelay(long startDelay)
public T setDuration(long duration)
public T switchDuration(long durationMillis)
public T setInterpolator(TimeInterpolator interpolator)
public T switchToDefaultInterpolator()
public T setRepeatCount(int repeatCount)
public T setRepeatMode(int repeatMode)
public T switchInterpolator(TimeInterpolator newInterpolator)
protected abstract T newInstance()
public T then()
public T thenWithDelay(long delay)
delay milliseconds from now
with the last used target and interpolator.public T thenDelayAfterEnd(long delayAfterEnd)
delayAfterEnd milliseconds after the previous animation has ended
with the last used target and interpolator.public T thenBeforeEnd(long millisBeforeEnd)
delayBeforeEnd milliseconds before the previous animation finishes
with the last used target and interpolator.protected T createChildWithRawDelay(long delay)
protected T createChildWithDelayAfterParentStart(long delay, boolean isStagger)
public long getTotalDurationInSequence()
getTotalDurationInSequence in class AnimationSequencepublic void setDelayInSequence(long delay)
setDelayInSequence in class AnimationSequencepublic void start()
start in class AnimationSequenceprotected T setParent(T other)
protected void runIfParentIsInSameAnimationGroup(Runnable r)