Search in sources :

Example 96 with PropertyValuesHolder

use of android.animation.PropertyValuesHolder in project TextSurface by elevenetc.

the class Slide method start.

@Override
public void start(@Nullable final IEndListener listener) {
    text.setAlpha(255);
    PropertyValuesHolder hHolder = null;
    PropertyValuesHolder vHolder = null;
    float fromX = 0;
    float toX = 0;
    float fromY = 0;
    float toY = 0;
    if ((side & Side.LEFT) == side) {
        if (toShow) {
            fromX = -text.getWidth();
        } else {
            toX = -text.getWidth();
        }
        hHolder = PropertyValuesHolder.ofFloat("xOffset", fromX, toX);
    } else if ((side & Side.RIGHT) == side) {
        if (toShow) {
            fromX = text.getWidth();
        } else {
            toX = text.getWidth();
        }
        hHolder = PropertyValuesHolder.ofFloat("xOffset", fromX, toX);
    }
    if ((side & Side.TOP) == side) {
        if (toShow) {
            fromY = -text.getHeight();
        } else {
            toY = -text.getHeight();
        }
        vHolder = PropertyValuesHolder.ofFloat("yOffset", fromY, toY);
    } else if ((side & Side.BOTTOM) == side) {
        if (toShow) {
            fromY = text.getHeight();
        } else {
            toY = text.getHeight();
        }
        vHolder = PropertyValuesHolder.ofFloat("yOffset", fromY, toY);
    }
    if (hHolder != null && vHolder != null) {
        animator = ObjectAnimator.ofPropertyValuesHolder(this, hHolder, vHolder);
    } else if (hHolder != null) {
        animator = ObjectAnimator.ofPropertyValuesHolder(this, hHolder);
    } else {
        animator = ObjectAnimator.ofPropertyValuesHolder(this, vHolder);
    }
    animator.setInterpolator(new FastOutSlowInInterpolator());
    Utils.addEndListener(this, animator, new IEndListener() {

        @Override
        public void onAnimationEnd(ISurfaceAnimation animation) {
            text.removeEffect(Slide.this);
            if (!toShow)
                text.setAlpha(0);
            if (listener != null)
                listener.onAnimationEnd(Slide.this);
        }
    });
    animator.setDuration(duration);
    animator.addUpdateListener(this);
    animator.start();
}
Also used : ISurfaceAnimation(su.levenetc.android.textsurface.interfaces.ISurfaceAnimation) FastOutSlowInInterpolator(android.support.v4.view.animation.FastOutSlowInInterpolator) PropertyValuesHolder(android.animation.PropertyValuesHolder) IEndListener(su.levenetc.android.textsurface.interfaces.IEndListener)

Example 97 with PropertyValuesHolder

use of android.animation.PropertyValuesHolder in project TextSurface by elevenetc.

the class TransSurface method start.

@Override
public void start(@Nullable final IEndListener listener) {
    float fromX = camera.getTransX();
    float fromY = camera.getTransY();
    float toX;
    float toY;
    if (textPivot == null) {
        toX = camera.getTransX() + dx;
        toY = camera.getTransY() + dy;
    } else {
        toX = textPivot.getPosition().getRelativeX(pivot, textPivot, true) * camera.getScale() * -1;
        toY = textPivot.getPosition().getRelativeY(pivot, textPivot, true) * camera.getScale() * -1;
    }
    debugTranslation(fromX, fromY, toX, toY);
    PropertyValuesHolder dxHolder = PropertyValuesHolder.ofFloat("transX", fromX, toX);
    PropertyValuesHolder dyHolder = PropertyValuesHolder.ofFloat("transY", fromY, toY);
    animator = ObjectAnimator.ofPropertyValuesHolder(camera, dxHolder, dyHolder);
    animator.setInterpolator(new FastOutSlowInInterpolator());
    Utils.addEndListener(this, animator, listener);
    animator.setDuration(duration);
    animator.addUpdateListener(this);
    animator.start();
}
Also used : FastOutSlowInInterpolator(android.support.v4.view.animation.FastOutSlowInInterpolator) PropertyValuesHolder(android.animation.PropertyValuesHolder)

Example 98 with PropertyValuesHolder

use of android.animation.PropertyValuesHolder in project XRecyclerView by jianghejie.

the class SquareSpinIndicator method createAnimation.

@Override
public List<Animator> createAnimation() {
    List<Animator> animators = new ArrayList<>();
    PropertyValuesHolder rotation5 = PropertyValuesHolder.ofFloat("rotationX", 0, 180, 180, 0, 0);
    PropertyValuesHolder rotation6 = PropertyValuesHolder.ofFloat("rotationY", 0, 0, 180, 180, 0);
    ObjectAnimator animator = ObjectAnimator.ofPropertyValuesHolder(getTarget(), rotation6, rotation5);
    animator.setInterpolator(new LinearInterpolator());
    animator.setRepeatCount(-1);
    animator.setDuration(2500);
    animator.start();
    animators.add(animator);
    return animators;
}
Also used : ObjectAnimator(android.animation.ObjectAnimator) Animator(android.animation.Animator) LinearInterpolator(android.view.animation.LinearInterpolator) ObjectAnimator(android.animation.ObjectAnimator) ArrayList(java.util.ArrayList) PropertyValuesHolder(android.animation.PropertyValuesHolder)

Example 99 with PropertyValuesHolder

use of android.animation.PropertyValuesHolder in project XRecyclerView by jianghejie.

the class TriangleSkewSpinIndicator method createAnimation.

@Override
public List<Animator> createAnimation() {
    List<Animator> animators = new ArrayList<>();
    PropertyValuesHolder rotation5 = PropertyValuesHolder.ofFloat("rotationX", 0, 180, 180, 0, 0);
    PropertyValuesHolder rotation6 = PropertyValuesHolder.ofFloat("rotationY", 0, 0, 180, 180, 0);
    ObjectAnimator animator = ObjectAnimator.ofPropertyValuesHolder(getTarget(), rotation6, rotation5);
    animator.setInterpolator(new LinearInterpolator());
    animator.setRepeatCount(-1);
    animator.setDuration(2500);
    animator.start();
    animators.add(animator);
    return animators;
}
Also used : ObjectAnimator(android.animation.ObjectAnimator) Animator(android.animation.Animator) LinearInterpolator(android.view.animation.LinearInterpolator) ObjectAnimator(android.animation.ObjectAnimator) ArrayList(java.util.ArrayList) PropertyValuesHolder(android.animation.PropertyValuesHolder)

Example 100 with PropertyValuesHolder

use of android.animation.PropertyValuesHolder in project XRecyclerView by jianghejie.

the class BallPulseRiseIndicator method createAnimation.

@Override
public List<Animator> createAnimation() {
    PropertyValuesHolder rotation6 = PropertyValuesHolder.ofFloat("rotationX", 0, 360);
    ObjectAnimator animator = ObjectAnimator.ofPropertyValuesHolder(getTarget(), rotation6);
    animator.setInterpolator(new LinearInterpolator());
    animator.setRepeatCount(-1);
    animator.setDuration(1500);
    animator.start();
    List<Animator> animators = new ArrayList<>();
    animators.add(animator);
    return animators;
}
Also used : ObjectAnimator(android.animation.ObjectAnimator) Animator(android.animation.Animator) LinearInterpolator(android.view.animation.LinearInterpolator) ObjectAnimator(android.animation.ObjectAnimator) ArrayList(java.util.ArrayList) PropertyValuesHolder(android.animation.PropertyValuesHolder)

Aggregations

PropertyValuesHolder (android.animation.PropertyValuesHolder)192 ObjectAnimator (android.animation.ObjectAnimator)141 Animator (android.animation.Animator)94 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)70 ValueAnimator (android.animation.ValueAnimator)64 Paint (android.graphics.Paint)33 AnimatorSet (android.animation.AnimatorSet)25 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 Point (android.graphics.Point)11 Keyframe (android.animation.Keyframe)10 TimeAnimator (android.animation.TimeAnimator)10 Path (android.graphics.Path)10 NonNull (android.support.annotation.NonNull)9 AccelerateDecelerateInterpolator (android.view.animation.AccelerateDecelerateInterpolator)8 Rect (android.graphics.Rect)7 AnimatorUpdateListener (android.animation.ValueAnimator.AnimatorUpdateListener)6