Search in sources :

Example 46 with AccelerateDecelerateInterpolator

use of android.view.animation.AccelerateDecelerateInterpolator in project UltimateAndroid by cymcsg.

the class AndroidAnimationsDemoActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.android_animations_activity);
    mListView = (ListView) findViewById(R.id.list_items);
    mTarget = findViewById(R.id.hello_world);
    mAdapter = new EffectAdapter(this);
    mListView.setAdapter(mAdapter);
    // after start,just click mTarget view, rope is not init
    rope = YoYo.with(Techniques.FadeIn).duration(1000).playOn(mTarget);
    mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            Techniques technique = (Techniques) view.getTag();
            rope = YoYo.with(technique).duration(1200).interpolate(new AccelerateDecelerateInterpolator()).withListener(new Animator.AnimatorListener() {

                @Override
                public void onAnimationStart(Animator animation) {
                }

                @Override
                public void onAnimationEnd(Animator animation) {
                }

                @Override
                public void onAnimationCancel(Animator animation) {
                    Toast.makeText(AndroidAnimationsDemoActivity.this, "canceled", Toast.LENGTH_SHORT).show();
                }

                @Override
                public void onAnimationRepeat(Animator animation) {
                }
            }).playOn(mTarget);
        }
    });
    findViewById(R.id.hello_world).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            if (rope != null) {
                rope.stop(true);
            }
        }
    });
}
Also used : Techniques(com.marshalchen.common.uimodule.androidanimations.Techniques) View(android.view.View) AdapterView(android.widget.AdapterView) ListView(android.widget.ListView) Animator(com.marshalchen.common.uimodule.nineoldandroids.animation.Animator) AccelerateDecelerateInterpolator(android.view.animation.AccelerateDecelerateInterpolator) AdapterView(android.widget.AdapterView)

Example 47 with AccelerateDecelerateInterpolator

use of android.view.animation.AccelerateDecelerateInterpolator in project UltimateAndroid by cymcsg.

the class Sample2Activity method simulateErrorProgress.

private void simulateErrorProgress(final CircularProgressButton button) {
    ValueAnimator widthAnimation = ValueAnimator.ofInt(1, 99);
    widthAnimation.setDuration(1500);
    widthAnimation.setInterpolator(new AccelerateDecelerateInterpolator());
    widthAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {

        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            Integer value = (Integer) animation.getAnimatedValue();
            button.setProgress(value);
            if (value == 99) {
                button.setProgress(-1);
            }
        }
    });
    widthAnimation.start();
}
Also used : AccelerateDecelerateInterpolator(android.view.animation.AccelerateDecelerateInterpolator) ValueAnimator(android.animation.ValueAnimator)

Example 48 with AccelerateDecelerateInterpolator

use of android.view.animation.AccelerateDecelerateInterpolator in project appsly-android-rest by 47deg.

the class MainActivity method animateContent.

private void animateContent() {
    ViewHelper.setRotation(imageViewIcon, 20);
    ViewHelper.setTranslationY(imageViewIcon, -100);
    ViewHelper.setTranslationX(textViewCity, 100);
    ViewHelper.setAlpha(linearLayoutContent, 0);
    ViewHelper.setTranslationY(descriptionTempContent, 200);
    ViewHelper.setTranslationY(contentBottom, 200);
    animate(imageViewIcon).setDuration(300).setInterpolator(new AccelerateInterpolator()).translationY(0).setListener(new Animator.AnimatorListener() {

        @Override
        public void onAnimationStart(Animator animator) {
        }

        @Override
        public void onAnimationEnd(Animator animator) {
            iconFall(imageViewIcon, 10);
        }

        @Override
        public void onAnimationCancel(Animator animator) {
        }

        @Override
        public void onAnimationRepeat(Animator animator) {
        }
    }).start();
    animate(textViewCity).setDuration(1000).setInterpolator(new AccelerateDecelerateInterpolator()).translationX(0).start();
    animate(linearLayoutContent).setDuration(1000).alpha(1).start();
    animate(contentBottom).setDuration(1000).translationY(0).start();
    animate(descriptionTempContent).setDuration(1000).translationY(0).start();
}
Also used : Animator(com.nineoldandroids.animation.Animator) AccelerateInterpolator(android.view.animation.AccelerateInterpolator) AccelerateDecelerateInterpolator(android.view.animation.AccelerateDecelerateInterpolator)

Example 49 with AccelerateDecelerateInterpolator

use of android.view.animation.AccelerateDecelerateInterpolator in project Notes by Elder-Wu.

the class ExpandableTextView method startCollapseAnimator.

private void startCollapseAnimator() {
    int begin = mTvContent.getHeight();
    int end = mTvContent.getLineHeight() * mMaxLineCount;
    ValueAnimator valueAnimator = ValueAnimator.ofObject(new IntEvaluator(), begin, end);
    valueAnimator.setDuration(mTvContent.getLineCount() * (mHasAnimation ? 20 : 1));
    valueAnimator.setInterpolator(new AccelerateDecelerateInterpolator());
    valueAnimator.addListener(mAnimatorListener);
    valueAnimator.addUpdateListener(mAnimatorUpdateListener);
    valueAnimator.start();
}
Also used : IntEvaluator(android.animation.IntEvaluator) AccelerateDecelerateInterpolator(android.view.animation.AccelerateDecelerateInterpolator) ValueAnimator(android.animation.ValueAnimator)

Example 50 with AccelerateDecelerateInterpolator

use of android.view.animation.AccelerateDecelerateInterpolator in project Notes by Elder-Wu.

the class ExpandableTextView method startExpandAnimator.

private void startExpandAnimator() {
    int begin = mTvContent.getHeight();
    int end = mTvContent.getLineHeight() * mTvContent.getLineCount();
    ValueAnimator valueAnimator = ValueAnimator.ofObject(new IntEvaluator(), begin, end);
    valueAnimator.setDuration(mTvContent.getLineCount() * (mHasAnimation ? 20 : 1));
    valueAnimator.setInterpolator(new AccelerateDecelerateInterpolator());
    valueAnimator.addListener(mAnimatorListener);
    valueAnimator.addUpdateListener(mAnimatorUpdateListener);
    valueAnimator.start();
}
Also used : IntEvaluator(android.animation.IntEvaluator) AccelerateDecelerateInterpolator(android.view.animation.AccelerateDecelerateInterpolator) ValueAnimator(android.animation.ValueAnimator)

Aggregations

AccelerateDecelerateInterpolator (android.view.animation.AccelerateDecelerateInterpolator)165 ValueAnimator (android.animation.ValueAnimator)38 ObjectAnimator (android.animation.ObjectAnimator)31 Animator (android.animation.Animator)30 View (android.view.View)30 AnimatorSet (android.animation.AnimatorSet)22 Animation (android.view.animation.Animation)19 Handler (android.os.Handler)15 NonNull (android.support.annotation.NonNull)12 TranslateAnimation (android.view.animation.TranslateAnimation)12 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)11 AccelerateInterpolator (android.view.animation.AccelerateInterpolator)10 AlphaAnimation (android.view.animation.AlphaAnimation)10 ImageView (android.widget.ImageView)10 TextView (android.widget.TextView)10 Paint (android.graphics.Paint)9 DecelerateInterpolator (android.view.animation.DecelerateInterpolator)9 LinearInterpolator (android.view.animation.LinearInterpolator)9 ScaleAnimation (android.view.animation.ScaleAnimation)9 PropertyValuesHolder (android.animation.PropertyValuesHolder)8