Search in sources :

Example 91 with PropertyValuesHolder

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

the class ScaleAnimation method createScalePropertyHolder.

@NonNull
protected PropertyValuesHolder createScalePropertyHolder(boolean isReverse) {
    String propertyName;
    int startRadiusValue;
    int endRadiusValue;
    if (isReverse) {
        propertyName = ANIMATION_SCALE_REVERSE;
        startRadiusValue = radius;
        endRadiusValue = (int) (radius * scaleFactor);
    } else {
        propertyName = ANIMATION_SCALE;
        startRadiusValue = (int) (radius * scaleFactor);
        endRadiusValue = radius;
    }
    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 92 with PropertyValuesHolder

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

the class SlideAnimation method createSlidePropertyHolder.

private PropertyValuesHolder createSlidePropertyHolder() {
    PropertyValuesHolder holder = PropertyValuesHolder.ofInt(ANIMATION_COORDINATE, coordinateStart, coordinateEnd);
    holder.setEvaluator(new IntEvaluator());
    return holder;
}
Also used : IntEvaluator(android.animation.IntEvaluator) PropertyValuesHolder(android.animation.PropertyValuesHolder)

Example 93 with PropertyValuesHolder

use of android.animation.PropertyValuesHolder in project Android-SpinKit by ybq.

the class SpriteAnimatorBuilder method build.

public ObjectAnimator build() {
    PropertyValuesHolder[] holders = new PropertyValuesHolder[fds.size()];
    int i = 0;
    for (Map.Entry<String, FrameData> fd : fds.entrySet()) {
        FrameData data = fd.getValue();
        Keyframe[] keyframes = new Keyframe[data.fractions.length];
        float[] fractions = data.fractions;
        float startF = fractions[startFrame];
        for (int j = startFrame; j < (startFrame + data.values.length); j++) {
            int key = j - startFrame;
            int vk = j % data.values.length;
            float fraction = fractions[vk] - startF;
            if (fraction < 0) {
                fraction = fractions[fractions.length - 1] + fraction;
            }
            if (data instanceof IntFrameData) {
                keyframes[key] = Keyframe.ofInt(fraction, (Integer) data.values[vk]);
            } else if (data instanceof FloatFrameData) {
                keyframes[key] = Keyframe.ofFloat(fraction, (Float) data.values[vk]);
            } else {
                keyframes[key] = Keyframe.ofObject(fraction, data.values[vk]);
            }
        }
        holders[i] = PropertyValuesHolder.ofKeyframe(data.property, keyframes);
        i++;
    }
    ObjectAnimator animator = ObjectAnimator.ofPropertyValuesHolder(sprite, holders);
    animator.setDuration(duration);
    animator.setRepeatCount(repeatCount);
    animator.setInterpolator(interpolator);
    return animator;
}
Also used : ObjectAnimator(android.animation.ObjectAnimator) Keyframe(android.animation.Keyframe) PropertyValuesHolder(android.animation.PropertyValuesHolder) Map(java.util.Map) HashMap(java.util.HashMap)

Example 94 with PropertyValuesHolder

use of android.animation.PropertyValuesHolder in project SmartCampus by Vegen.

the class AnimationUtils method showFromBottom.

public static void showFromBottom(View view) {
    PropertyValuesHolder p1 = PropertyValuesHolder.ofFloat("translationY", 0F);
    PropertyValuesHolder p2 = PropertyValuesHolder.ofFloat("alpha", 1f);
    ObjectAnimator.ofPropertyValuesHolder(view, p1, p2).setDuration(500).start();
}
Also used : PropertyValuesHolder(android.animation.PropertyValuesHolder)

Example 95 with PropertyValuesHolder

use of android.animation.PropertyValuesHolder in project SmartCampus by Vegen.

the class AnimationUtils method hideToBottom.

public static void hideToBottom(View view) {
    PropertyValuesHolder p1 = PropertyValuesHolder.ofFloat("translationY", view.getHeight());
    PropertyValuesHolder p2 = PropertyValuesHolder.ofFloat("alpha", 0f);
    ObjectAnimator.ofPropertyValuesHolder(view, p1, p2).setDuration(500).start();
}
Also used : 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