Android ValueAnimator - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android ValueAnimator class.

This code example shows how to use the following methods:addUpdateListener, reverse, setInterpolator
 
        private void createAnimation() { 
            if (bounceAnim == null) {
                bounceAnim = ObjectAnimator.ofFloat(ball, "y", ball.getY(), getHeight() - 50f).
                        setDuration(1500); 
                bounceAnim.setInterpolator(new AccelerateInterpolator(2f));
                bounceAnim.addUpdateListener(this);
            } 
        } 
 
        public void startAnimation() { 
            createAnimation(); 
            bounceAnim.start();
        } 
 
        public void reverseAnimation() { 
            createAnimation(); 
            bounceAnim.reverse();
        } 
 

7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:addUpdateListener, setInterpolator, start
 
        private void createAnimation() { 
            if (bounceAnim == null) {
                bounceAnim = ObjectAnimator.ofFloat(ball, "y", ball.getY(), getHeight() - 50f).
                        setDuration(1500); 
                bounceAnim.setInterpolator(new AccelerateInterpolator(2f));
                bounceAnim.addUpdateListener(this);
            } 
        } 
 
        public void startAnimation() { 
            createAnimation(); 
            bounceAnim.start();
        } 
 
        public void reverseAnimation() { 
            createAnimation(); 
            bounceAnim.reverse();
        } 
 
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:addUpdateListener, setDuration, start
            if (bounceAnim == null) {
                XYHolder startXY = new XYHolder(0f, 0f);
                XYHolder endXY = new XYHolder(300f, 500f);
                bounceAnim = ObjectAnimator.ofObject(ballHolder, "xY",
                        new XYEvaluator(), endXY);
                bounceAnim.setDuration(1500);
                bounceAnim.addUpdateListener(this);
            } 
        } 
 
        public void startAnimation() { 
            createAnimation(); 
            bounceAnim.start();
        } 
 
        private ShapeHolder createBall(float x, float y) {
            OvalShape circle = new OvalShape();
            circle.resize(50f, 50f);
            ShapeDrawable drawable = new ShapeDrawable(circle);
            ShapeHolder shapeHolder = new ShapeHolder(drawable);
7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:start, cancel
                post(new Runnable() { public void run() {
                    reset(); 
                    startAnimation(); 
                } }); 
            } else { 
                mAnim.start();
            } 
        } 
 
        public void stopAnimation() { 
            if (mAnim != null) mAnim.cancel();
        } 
 
        @Override 
        protected void onDetachedFromWindow() { 
            super.onDetachedFromWindow(); 
            stopAnimation(); 
        } 
 
        @Override 
7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:addUpdateListener, setCurrentPlayTime, setInterpolator
 
        private void createAnimation() { 
            if (bounceAnim == null) {
                bounceAnim = ObjectAnimator.ofFloat(ball, "y",
                        ball.getY(), getHeight() - BALL_SIZE).setDuration(1500);
                bounceAnim.setInterpolator(new BounceInterpolator());
                bounceAnim.addUpdateListener(this);
            } 
        } 
 
        public void startAnimation() { 
            createAnimation(); 
            bounceAnim.start();
        } 
 
        public void seek(long seekTime) {
            createAnimation(); 
            bounceAnim.setCurrentPlayTime(seekTime);
        } 
 

7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:setDuration, start, addUpdateListener
8
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:setFloatValues, start
    public void setPingMode(int mode) {
        mPingMode = mode;
    } 
 
    public void startSaving() { 
        mFadeAnimator.setFloatValues(0, 1);
        mFadeAnimator.start();
    } 
 
    public void stopSaving() { 
        mFadeAnimator.setFloatValues(1, 0);
        mFadeAnimator.start();
    } 
 
    public void notifyOrientationChanged(int angle) {
        mOrientation = angle;
    } 
 
    @Override 
    public void onDraw(Canvas canvas) {
7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getAnimatedValue
            } 
        }); 
        mAnimator.addUpdateListener(new AnimatorUpdateListener() {
            @Override 
            public void onAnimationUpdate(ValueAnimator animation) {
                mAnimationProgress = (Float) animation.getAnimatedValue();
                invalidate();
            } 
        }); 
        mAnimator.start();
    } 
} 
7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:addUpdateListener, setInterpolator, start
 
        private void createAnimation() { 
            if (bounceAnim == null) {
                bounceAnim = ObjectAnimator.ofFloat(ball, "y",
                        ball.getY(), getHeight() - BALL_SIZE).setDuration(1500);
                bounceAnim.setInterpolator(new BounceInterpolator());
                bounceAnim.addUpdateListener(this);
            } 
        } 
 
        public void startAnimation() { 
            createAnimation(); 
            bounceAnim.start();
        } 
 
        public void seek(long seekTime) {
            createAnimation(); 
            bounceAnim.setCurrentPlayTime(seekTime);
        } 
 
7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:start, cancel
                post(new Runnable() { public void run() {
                    reset(); 
                    startAnimation(); 
                } }); 
            } else { 
                mAnim.start();
            } 
        } 
 
        public void stopAnimation() { 
            if (mAnim != null) mAnim.cancel();
        } 
 
        @Override 
        protected void onDetachedFromWindow() { 
            super.onDetachedFromWindow(); 
            stopAnimation(); 
        } 
 
        @Override 
7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java

Related Android ValueAnimator Questions & Answers:

See Code Examples for Android ValueAnimator Methods: