Search in sources :

Example 61 with PropertyValuesHolder

use of android.animation.PropertyValuesHolder in project PageIndicatorView by romandanylyk.

the class FillAnimation method with.

@NonNull
public FillAnimation with(int colorStartValue, int colorEndValue, int radiusValue, int strokeValue) {
    if (animator != null && hasChanges(colorStartValue, colorEndValue, radiusValue, strokeValue)) {
        startColor = colorStartValue;
        endColor = colorEndValue;
        radiusPx = radiusValue;
        strokePx = strokeValue;
        PropertyValuesHolder colorHolder = createColorPropertyHolder(false);
        PropertyValuesHolder reverseColorHolder = createColorPropertyHolder(true);
        PropertyValuesHolder radiusHolder = createRadiusPropertyHolder(false);
        PropertyValuesHolder radiusReverseHolder = createRadiusPropertyHolder(true);
        PropertyValuesHolder strokeHolder = createStrokePropertyHolder(false);
        PropertyValuesHolder strokeReverseHolder = createStrokePropertyHolder(true);
        animator.setValues(colorHolder, reverseColorHolder, radiusHolder, radiusReverseHolder, strokeHolder, strokeReverseHolder);
    }
    return this;
}
Also used : PropertyValuesHolder(android.animation.PropertyValuesHolder) NonNull(android.support.annotation.NonNull)

Example 62 with PropertyValuesHolder

use of android.animation.PropertyValuesHolder in project PageIndicatorView by romandanylyk.

the class FillAnimation method createRadiusPropertyHolder.

@NonNull
private PropertyValuesHolder createRadiusPropertyHolder(boolean isReverse) {
    String propertyName;
    int startRadiusValue;
    int endRadiusValue;
    if (isReverse) {
        propertyName = ANIMATION_RADIUS_REVERSE;
        startRadiusValue = radiusPx / 2;
        endRadiusValue = radiusPx;
    } else {
        propertyName = ANIMATION_RADIUS;
        startRadiusValue = radiusPx;
        endRadiusValue = radiusPx / 2;
    }
    PropertyValuesHolder holder = PropertyValuesHolder.ofInt(propertyName, startRadiusValue, endRadiusValue);
    holder.setEvaluator(new IntEvaluator());
    return holder;
}
Also used : IntEvaluator(android.animation.IntEvaluator) PropertyValuesHolder(android.animation.PropertyValuesHolder) NonNull(android.support.annotation.NonNull)

Example 63 with PropertyValuesHolder

use of android.animation.PropertyValuesHolder in project PageIndicatorView by romandanylyk.

the class ScaleAnimation method createScalePropertyHolder.

@NonNull
private PropertyValuesHolder createScalePropertyHolder(boolean isReverse) {
    String propertyName;
    int startRadiusValue;
    int endRadiusValue;
    if (isReverse) {
        propertyName = ANIMATION_SCALE_REVERSE;
        startRadiusValue = radiusPx;
        endRadiusValue = (int) (radiusPx * scaleFactor);
    } else {
        propertyName = ANIMATION_SCALE;
        startRadiusValue = (int) (radiusPx * scaleFactor);
        endRadiusValue = radiusPx;
    }
    PropertyValuesHolder holder = PropertyValuesHolder.ofInt(propertyName, startRadiusValue, endRadiusValue);
    holder.setEvaluator(new IntEvaluator());
    return holder;
}
Also used : IntEvaluator(android.animation.IntEvaluator) PropertyValuesHolder(android.animation.PropertyValuesHolder) NonNull(android.support.annotation.NonNull)

Example 64 with PropertyValuesHolder

use of android.animation.PropertyValuesHolder in project PageIndicatorView by romandanylyk.

the class ScaleAnimation method with.

@NonNull
public ScaleAnimation with(int colorStartValue, int colorEndValue, int radiusValue, float scaleFactorValue) {
    if (animator != null && hasChanges(colorStartValue, colorEndValue, radiusValue, scaleFactorValue)) {
        startColor = colorStartValue;
        endColor = colorEndValue;
        radiusPx = radiusValue;
        scaleFactor = scaleFactorValue;
        PropertyValuesHolder colorHolder = createColorPropertyHolder(false);
        PropertyValuesHolder reverseColorHolder = createColorPropertyHolder(true);
        PropertyValuesHolder scaleHolder = createScalePropertyHolder(false);
        PropertyValuesHolder scaleReverseHolder = createScalePropertyHolder(true);
        animator.setValues(colorHolder, reverseColorHolder, scaleHolder, scaleReverseHolder);
    }
    return this;
}
Also used : PropertyValuesHolder(android.animation.PropertyValuesHolder) NonNull(android.support.annotation.NonNull)

Example 65 with PropertyValuesHolder

use of android.animation.PropertyValuesHolder in project PageIndicatorView by romandanylyk.

the class SlideAnimation method createColorPropertyHolder.

private PropertyValuesHolder createColorPropertyHolder() {
    PropertyValuesHolder holder = PropertyValuesHolder.ofInt(ANIMATION_X_COORDINATE, xStartCoordinate, xEndCoordinate);
    holder.setEvaluator(new IntEvaluator());
    return holder;
}
Also used : IntEvaluator(android.animation.IntEvaluator) PropertyValuesHolder(android.animation.PropertyValuesHolder)

Aggregations

PropertyValuesHolder (android.animation.PropertyValuesHolder)210 ObjectAnimator (android.animation.ObjectAnimator)144 Animator (android.animation.Animator)96 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)70 ValueAnimator (android.animation.ValueAnimator)64 Paint (android.graphics.Paint)33 AnimatorSet (android.animation.AnimatorSet)25 NonNull (android.support.annotation.NonNull)18 LinearInterpolator (android.view.animation.LinearInterpolator)18 Interpolator (android.view.animation.Interpolator)16 ArrayList (java.util.ArrayList)16 ViewGroup (android.view.ViewGroup)14 View (android.view.View)12 IntEvaluator (android.animation.IntEvaluator)11 Point (android.graphics.Point)11 Keyframe (android.animation.Keyframe)10 TimeAnimator (android.animation.TimeAnimator)10 Path (android.graphics.Path)10 AccelerateDecelerateInterpolator (android.view.animation.AccelerateDecelerateInterpolator)8 Rect (android.graphics.Rect)7