Search in sources :

Example 6 with AnimatorSet

use of android.animation.AnimatorSet in project UltimateAndroid by cymcsg.

the class RippleBackgroundActivity method foundDevice.

private void foundDevice() {
    AnimatorSet animatorSet = new AnimatorSet();
    animatorSet.setDuration(400);
    animatorSet.setInterpolator(new AccelerateDecelerateInterpolator());
    ArrayList<Animator> animatorList = new ArrayList<Animator>();
    ObjectAnimator scaleXAnimator = ObjectAnimator.ofFloat(foundDevice, "ScaleX", 0f, 1.2f, 1f);
    animatorList.add(scaleXAnimator);
    ObjectAnimator scaleYAnimator = ObjectAnimator.ofFloat(foundDevice, "ScaleY", 0f, 1.2f, 1f);
    animatorList.add(scaleYAnimator);
    animatorSet.playTogether(animatorList);
    foundDevice.setVisibility(View.VISIBLE);
    animatorSet.start();
}
Also used : ObjectAnimator(android.animation.ObjectAnimator) Animator(android.animation.Animator) ObjectAnimator(android.animation.ObjectAnimator) ArrayList(java.util.ArrayList) AccelerateDecelerateInterpolator(android.view.animation.AccelerateDecelerateInterpolator) AnimatorSet(android.animation.AnimatorSet)

Example 7 with AnimatorSet

use of android.animation.AnimatorSet in project AnimationEasingFunctions by daimajia.

the class MyActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_my);
    mEasingList = (ListView) findViewById(R.id.easing_list);
    mAdapter = new EasingAdapter(this);
    mEasingList.setAdapter(mAdapter);
    mTarget = findViewById(R.id.target);
    mHistory = (DrawView) findViewById(R.id.history);
    mEasingList.setOnItemClickListener(new AdapterView.OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
            mHistory.clear();
            Skill s = (Skill) view.getTag();
            AnimatorSet set = new AnimatorSet();
            mTarget.setTranslationX(0);
            mTarget.setTranslationY(0);
            set.playTogether(Glider.glide(s, 1200, ObjectAnimator.ofFloat(mTarget, "translationY", 0, dipToPixels(MyActivity.this, -(160 - 3))), new BaseEasingMethod.EasingListener() {

                @Override
                public void on(float time, float value, float start, float end, float duration) {
                    mHistory.drawPoint(time, duration, value - dipToPixels(MyActivity.this, 60));
                }
            }));
            set.setDuration(1200);
            set.start();
        }
    });
}
Also used : BaseEasingMethod(com.daimajia.easing.BaseEasingMethod) AnimatorSet(android.animation.AnimatorSet) View(android.view.View) AdapterView(android.widget.AdapterView) ListView(android.widget.ListView) Skill(com.daimajia.easing.Skill) AdapterView(android.widget.AdapterView)

Example 8 with AnimatorSet

use of android.animation.AnimatorSet in project ActivityAnimationLib by dkmeteor.

the class SplitEffect method animate.

public void animate(final Activity destActivity, final int duration) {
    final Interpolator interpolator = new DecelerateInterpolator();
    destActivity.getWindow().setFlags(WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED, WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED);
    new Handler().post(new Runnable() {

        @Override
        public void run() {
            mSetAnim = new AnimatorSet();
            mTopImage.setLayerType(View.LAYER_TYPE_HARDWARE, null);
            mBottomImage.setLayerType(View.LAYER_TYPE_HARDWARE, null);
            mSetAnim.addListener(new Animator.AnimatorListener() {

                @Override
                public void onAnimationStart(Animator animation) {
                }

                @Override
                public void onAnimationEnd(Animator animation) {
                    clean(destActivity);
                }

                @Override
                public void onAnimationCancel(Animator animation) {
                    clean(destActivity);
                }

                @Override
                public void onAnimationRepeat(Animator animation) {
                }
            });
            Animator anim1 = ObjectAnimator.ofFloat(mTopImage, "translationY", mTopImage.getHeight() * -1);
            Animator anim2 = ObjectAnimator.ofFloat(mBottomImage, "translationY", mBottomImage.getHeight());
            if (interpolator != null) {
                anim1.setInterpolator(interpolator);
                anim2.setInterpolator(interpolator);
            }
            mSetAnim.setDuration(duration);
            mSetAnim.playTogether(anim1, anim2);
            mSetAnim.start();
        }
    });
}
Also used : DecelerateInterpolator(android.view.animation.DecelerateInterpolator) ObjectAnimator(android.animation.ObjectAnimator) Animator(android.animation.Animator) Handler(android.os.Handler) Interpolator(android.view.animation.Interpolator) DecelerateInterpolator(android.view.animation.DecelerateInterpolator) AnimatorSet(android.animation.AnimatorSet)

Example 9 with AnimatorSet

use of android.animation.AnimatorSet in project kickmaterial by byoutline.

the class AnimatorUtils method getScaleAnimator.

public static AnimatorSet getScaleAnimator(View view, float startScale, float endScale) {
    AnimatorSet set = new AnimatorSet();
    ObjectAnimator scaleXAnimator = ObjectAnimator.ofFloat(view, View.SCALE_X, startScale, endScale);
    ObjectAnimator scaleYAnimator = ObjectAnimator.ofFloat(view, View.SCALE_Y, startScale, endScale);
    set.playTogether(scaleXAnimator, scaleYAnimator);
    return set;
}
Also used : ObjectAnimator(android.animation.ObjectAnimator) AnimatorSet(android.animation.AnimatorSet)

Example 10 with AnimatorSet

use of android.animation.AnimatorSet in project kickmaterial by byoutline.

the class CircleTransition method createAnimator.

@Override
public Animator createAnimator(final ViewGroup sceneRoot, TransitionValues startValues, final TransitionValues endValues) {
    if (startValues == null || endValues == null) {
        return null;
    }
    Rect startBounds = (Rect) startValues.values.get(PROPERTY_BOUNDS);
    Rect endBounds = (Rect) endValues.values.get(PROPERTY_BOUNDS);
    boolean boundsEqual = startBounds == null || endBounds == null || startBounds.equals(endBounds);
    if (boundsEqual) {
        return null;
    }
    int[] sceneRootLoc = new int[2];
    sceneRoot.getLocationInWindow(sceneRootLoc);
    int[] startLoc = (int[]) startValues.values.get(PROPERTY_POSITION);
    final View startView = getStartView(sceneRoot, startValues, sceneRootLoc, startLoc);
    final View endView = endValues.view;
    endView.setAlpha(0f);
    Path circlePath = getMovePath(endValues, startView, sceneRootLoc, startLoc, endView);
    Animator circleAnimator = ObjectAnimator.ofFloat(startView, View.TRANSLATION_X, View.TRANSLATION_Y, circlePath);
    circleAnimator.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            startView.setVisibility(View.INVISIBLE);
            endView.setAlpha(1f);
            sceneRoot.getOverlay().remove(startView);
        }
    });
    AnimatorSet moveSet = new AnimatorSet();
    float scaleRatio = ((float) endView.getWidth()) / startView.getWidth();
    ObjectAnimator scaleXAnimator = ObjectAnimator.ofFloat(startView, View.SCALE_X, 1, scaleRatio);
    ObjectAnimator scaleYAnimator = ObjectAnimator.ofFloat(startView, View.SCALE_Y, 1, scaleRatio);
    moveSet.playTogether(circleAnimator, scaleXAnimator, scaleYAnimator);
    return moveSet;
}
Also used : Path(android.graphics.Path) Rect(android.graphics.Rect) ObjectAnimator(android.animation.ObjectAnimator) Animator(android.animation.Animator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) ObjectAnimator(android.animation.ObjectAnimator) AnimatorSet(android.animation.AnimatorSet) View(android.view.View)

Aggregations

AnimatorSet (android.animation.AnimatorSet)480 ObjectAnimator (android.animation.ObjectAnimator)336 Animator (android.animation.Animator)278 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)139 View (android.view.View)107 ValueAnimator (android.animation.ValueAnimator)103 DecelerateInterpolator (android.view.animation.DecelerateInterpolator)52 ArrayList (java.util.ArrayList)47 Rect (android.graphics.Rect)43 ViewGroup (android.view.ViewGroup)42 ImageView (android.widget.ImageView)36 TextView (android.widget.TextView)32 PropertyValuesHolder (android.animation.PropertyValuesHolder)25 Paint (android.graphics.Paint)25 AccelerateInterpolator (android.view.animation.AccelerateInterpolator)25 AccelerateDecelerateInterpolator (android.view.animation.AccelerateDecelerateInterpolator)23 Bitmap (android.graphics.Bitmap)17 LinearInterpolator (android.view.animation.LinearInterpolator)15 OvershootInterpolator (android.view.animation.OvershootInterpolator)15 Point (android.graphics.Point)14