android.view.animation.BounceInterpolator Java Examples

The following examples show how to use android.view.animation.BounceInterpolator. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: WindowActivity.java    From GSYVideoPlayer with Apache License 2.0 6 votes vote down vote up
@OnClick({R.id.start_window, R.id.jump_other})
public void onViewClicked(View view) {
    switch (view.getId()) {
        case R.id.start_window:
            if (FloatWindow.get() != null) {
                return;
            }
            FloatPlayerView floatPlayerView = new FloatPlayerView(getApplicationContext());
            FloatWindow
                    .with(getApplicationContext())
                    .setView(floatPlayerView)
                    .setWidth(Screen.width, 0.4f)
                    .setHeight(Screen.width, 0.4f)
                    .setX(Screen.width, 0.8f)
                    .setY(Screen.height, 0.3f)
                    .setMoveType(MoveType.slide)
                    .setFilter(false)
                    .setMoveStyle(500, new BounceInterpolator())
                    .build();
            FloatWindow.get().show();
            break;
        case R.id.jump_other:
            startActivity(new Intent(this, EmptyActivity.class));
            break;
    }
}
 
Example #2
Source File: TranslationAnimator2.java    From AndroidSkinAnimator with MIT License 6 votes vote down vote up
@Override
public SkinAnimator apply(@NonNull View view, @Nullable final Action action) {
    this.targetView = view;
    preAnimator = ObjectAnimator.ofPropertyValuesHolder(targetView,
            PropertyValuesHolder.ofFloat("translationX",
                    view.getLeft(), view.getRight()))
            .setDuration(PRE_DURATION * 3);
    preAnimator.setInterpolator(new AccelerateInterpolator());
    afterAnimator = ObjectAnimator.ofPropertyValuesHolder(targetView,
            PropertyValuesHolder.ofFloat("translationX",
                    view.getLeft() - view.getWidth(), view.getLeft()))
            .setDuration(AFTER_DURATION * 3);
    afterAnimator.setInterpolator(new BounceInterpolator());

    preAnimator.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
            if (action != null) {
                action.action();
            }
            afterAnimator.start();
        }
    });
    return this;
}
 
Example #3
Source File: MaterialWaveView.java    From BitkyShop with MIT License 6 votes vote down vote up
@Override
public void onRefreshing(MaterialRefreshLayout br) {
    setHeadHeight((int) (Util.dip2px(getContext(), DefaulHeadHeight)));
    ValueAnimator animator = ValueAnimator.ofInt(getWaveHeight(),0);
    animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            Log.i("anim", "value--->" + (int) animation.getAnimatedValue());
            setWaveHeight((int) animation.getAnimatedValue());
            invalidate();
        }
    });
    animator.setInterpolator(new BounceInterpolator());
    animator.setDuration(200);
    animator.start();
}
 
Example #4
Source File: BaseDialog.java    From Aria with Apache License 2.0 6 votes vote down vote up
/**
 * 进场动画
 */
private void in() {
  int height = AndroidUtils.getScreenParams(getContext())[1];
  ValueAnimator animator = ValueAnimator.ofObject(new IntEvaluator(), -height / 2, 0);
  animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
    @Override public void onAnimationUpdate(ValueAnimator animation) {
      mWpm.y = (int) animation.getAnimatedValue();
      mWindow.setAttributes(mWpm);
    }
  });
  animator.setInterpolator(new BounceInterpolator()); //弹跳
  Animator alpha = ObjectAnimator.ofFloat(mRootView, "alpha", 0f, 1f);
  AnimatorSet set = new AnimatorSet();
  set.play(animator).with(alpha);
  set.setDuration(2000).start();
}
 
Example #5
Source File: PropertyAnimActivity.java    From AndroidStudyDemo with GNU General Public License v2.0 6 votes vote down vote up
public void testObjectAnimator(View v) {
    if (v.getId() == R.id.sdi_objectanimator_btn) {
        // 简单示例:View的横向移动
        ObjectAnimator.ofFloat(mAnimView, "translationX", 0.0f, -200.0f)
                .setDuration(C.Int.ANIM_DURATION * 2)
                .start();
    } else {
        // 复合示例:View弹性落下然后弹起,执行一次
        ObjectAnimator yBouncer = ObjectAnimator.ofFloat(mAnimView, "y", mAnimView.getY(), 400.0f);
        yBouncer.setDuration(C.Int.ANIM_DURATION * 2);
        // 设置插值器(用于调节动画执行过程的速度)
        yBouncer.setInterpolator(new BounceInterpolator());
        // 设置重复次数(缺省为0,表示不重复执行)
        yBouncer.setRepeatCount(1);
        // 设置重复模式(RESTART或REVERSE),重复次数大于0或INFINITE生效
        yBouncer.setRepeatMode(ValueAnimator.REVERSE);
        // 设置动画开始的延时时间(200ms)
        yBouncer.setStartDelay(200);
        yBouncer.start();
    }
}
 
Example #6
Source File: ObjectAnimatorCustomPropertyFragment.java    From AndroidAll with Apache License 2.0 6 votes vote down vote up
@Override
public void onClick(View v) {
    super.onClick(v);
    switch (v.getId()){
        case R.id.point_view:
            //ofInt方法后面的可变参数如果只传递一个参数
            //在没有定义getRadius方法的情况下会出现如下警告:
            //W/PropertyValuesHolder: Method getRadius() with type null not found on target class MyPointView
            //ObjectAnimator objectAnimator = ObjectAnimator.ofInt(viewPoint,"radius",200);

            ObjectAnimator objectAnimator = ObjectAnimator.ofInt(viewPoint,"radius",20,200);
            objectAnimator.setDuration(1000);
            objectAnimator.setInterpolator(new BounceInterpolator());
            objectAnimator.start();
            break;
    }
}
 
Example #7
Source File: CommonViewAnimationActivity.java    From Android-Animation-Set with Apache License 2.0 6 votes vote down vote up
private Animation getAnimationSet(boolean fromXML) {
    if (fromXML) {
        Animation animation = AnimationUtils.loadAnimation(this, R.anim.view_animation);
        return animation;
    } else {
        AnimationSet innerAnimationSet = new AnimationSet(true);
        innerAnimationSet.setInterpolator(new BounceInterpolator());
        innerAnimationSet.setStartOffset(1000);
        innerAnimationSet.addAnimation(getScaleAnimation());
        innerAnimationSet.addAnimation(getTranslateAnimation());

        AnimationSet animationSet = new AnimationSet(true);
        animationSet.setInterpolator(new LinearInterpolator());

        animationSet.addAnimation(getAlphaAnimation());
        animationSet.addAnimation(getRotateAnimation());
        animationSet.addAnimation(innerAnimationSet);

        return animationSet;
    }
}
 
Example #8
Source File: RecordVideoActivity.java    From TikTok with Apache License 2.0 6 votes vote down vote up
public void showCountDownLayout() {//显示倒计时动画
    View mCountDown3 = findViewById(R.id.tidal_pat_record_video_count_down_img_3);
    View mCountDown6 = findViewById(R.id.tidal_pat_record_video_count_down_img_6);
    View mCountDown9 = findViewById(R.id.tidal_pat_record_video_count_down_img_9);
    mCountDown3.setVisibility(View.VISIBLE);
    mCountDown6.setVisibility(View.VISIBLE);
    mCountDown9.setVisibility(View.VISIBLE);

    ArrayList<Animator> animators = new ArrayList<>();
    animators.add(AnimatorUtils
            .translationAnimator(mCountDown3, 0, -DensityUtils.dp2px(50), 0, 0, 400, new BounceInterpolator(), null));
    animators.add(AnimatorUtils.translationAnimator(mCountDown6, 0, -DensityUtils.dp2px(100), 0, 0, 400, new BounceInterpolator(), null));
    animators.add(AnimatorUtils.translationAnimator(mCountDown9, 0, -DensityUtils.dp2px(150), 0, 0, 400, new BounceInterpolator(), null));
    animators.add(AnimatorUtils.rotationAnimator(mCountDown3, 360, 0, 400, null));
    animators.add(AnimatorUtils.rotationAnimator(mCountDown6, 360, 0, 400, null));
    animators.add(AnimatorUtils.rotationAnimator(mCountDown9, 360, 0, 400, null));
    AnimatorUtils.playAnimatorArray(animators, AnimatorUtils.AnimatorPlayType.Together);
}
 
Example #9
Source File: ClockView.java    From MiClockView with Apache License 2.0 6 votes vote down vote up
private void startNewSteadyAnim() {
	final String propertyNameRotateX = "canvasRotateX";
	final String propertyNameRotateY = "canvasRotateY";

	PropertyValuesHolder holderRotateX = PropertyValuesHolder.ofFloat(propertyNameRotateX, canvasRotateX, 0);
	PropertyValuesHolder holderRotateY = PropertyValuesHolder.ofFloat(propertyNameRotateY, canvasRotateY, 0);
	steadyAnim = ValueAnimator.ofPropertyValuesHolder(holderRotateX, holderRotateY);
	steadyAnim.setDuration(1000);
	steadyAnim.setInterpolator(new BounceInterpolator());
	steadyAnim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
		@Override
		public void onAnimationUpdate(ValueAnimator animation) {
			canvasRotateX = (float) animation.getAnimatedValue(propertyNameRotateX);
			canvasRotateY = (float) animation.getAnimatedValue(propertyNameRotateY);
		}
	});
	steadyAnim.start();
}
 
Example #10
Source File: CommonViewAnimationActivity.java    From Study_Android_Demo with Apache License 2.0 6 votes vote down vote up
private Animation getAnimationSet(boolean fromXML) {
    if (fromXML) {
        Animation animation = AnimationUtils.loadAnimation(this, R.anim.view_animation);
        return animation;
    } else {
        AnimationSet innerAnimationSet = new AnimationSet(true);
        innerAnimationSet.setInterpolator(new BounceInterpolator());
        innerAnimationSet.setStartOffset(1000);
        innerAnimationSet.addAnimation(getScaleAnimation());
        innerAnimationSet.addAnimation(getTranslateAnimation());

        AnimationSet animationSet = new AnimationSet(true);
        animationSet.setInterpolator(new LinearInterpolator());

        animationSet.addAnimation(getAlphaAnimation());
        animationSet.addAnimation(getRotateAnimation());
        animationSet.addAnimation(innerAnimationSet);

        return animationSet;
    }
}
 
Example #11
Source File: MaterialWaveView.java    From styT with Apache License 2.0 6 votes vote down vote up
@Override
public void onRefreshing(MaterialRefreshLayout br) {
    setHeadHeight((int) (Util.dip2px(getContext(), DefaulHeadHeight)));
    ValueAnimator animator = ValueAnimator.ofInt(getWaveHeight(),0);
    animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            Log.i("anim", "value--->" + (int) animation.getAnimatedValue());
            setWaveHeight((int) animation.getAnimatedValue());
            invalidate();
        }
    });
    animator.setInterpolator(new BounceInterpolator());
    animator.setDuration(200);
    animator.start();
}
 
Example #12
Source File: MaterialWaveView.java    From SprintNBA with Apache License 2.0 6 votes vote down vote up
@Override
public void onRefreshing(MaterialRefreshLayout br) {
    setHeadHeight((int) (Util.dip2px(getContext(), DefaulHeadHeight)));
    ValueAnimator animator = ValueAnimator.ofInt(getWaveHeight(),0);
    animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            //Log.i("anim", "value--->" + (int) animation.getAnimatedValue());
            setWaveHeight((int) animation.getAnimatedValue());
            invalidate();
        }
    });
    animator.setInterpolator(new BounceInterpolator());
    animator.setDuration(200);
    animator.start();
}
 
Example #13
Source File: CoverManager.java    From SmartSwipe with Apache License 2.0 6 votes vote down vote up
private void initShuttersConsumerBeforeAddToWrapper() {
    shuttersConsumer = new ShuttersConsumer()
            .setRefreshable(true)
            .setLeavesCount(4)
            .setScrimColor(0xAF000000)
            .setRefreshFrameRate(30)
            .setMaxSettleDuration(MAX_SETTLE_DURATION)
            .setOpenDistance(SmartSwipe.dp2px(100, coverView.getContext()))
            .setOverSwipeFactor(2F)
            .setInterpolator(new BounceInterpolator())
            .enableAllDirections()
            .setWidth(width)
            .setHeight(height)
            .addListener(swipeListener)
    ;
}
 
Example #14
Source File: PopupWonView.java    From AndroidAnimationExercise with Apache License 2.0 6 votes vote down vote up
private void animateStar(final View view, int delay) {
	ObjectAnimator alpha = ObjectAnimator.ofFloat(view, "alpha", 0, 1f);
	alpha.setDuration(100);
	ObjectAnimator scaleX = ObjectAnimator.ofFloat(view, "scaleX", 0, 1f);
	ObjectAnimator scaleY = ObjectAnimator.ofFloat(view, "scaleY", 0, 1f);
	AnimatorSet animatorSet = new AnimatorSet();
	animatorSet.playTogether(alpha, scaleX, scaleY);
	animatorSet.setInterpolator(new BounceInterpolator());
	animatorSet.setStartDelay(delay);
	animatorSet.setDuration(600);
	view.setLayerType(View.LAYER_TYPE_HARDWARE, null);
	animatorSet.start();
	
	mHandler.postDelayed(new Runnable() {
		
		@Override
		public void run() {
			Music.showStar();
		}
	}, delay);
}
 
Example #15
Source File: MaterialWaveView.java    From MousePaint with MIT License 6 votes vote down vote up
@Override
public void onRefreshing(MaterialRefreshLayout br) {
    setHeadHeight((int) (Util.dip2px(getContext(), DefaulHeadHeight)));
    ValueAnimator animator = ValueAnimator.ofInt(getWaveHeight(),0);
    animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            Log.i("anim", "value--->" + (int) animation.getAnimatedValue());
            setWaveHeight((int) animation.getAnimatedValue());
            invalidate();
        }
    });
    animator.setInterpolator(new BounceInterpolator());
    animator.setDuration(200);
    animator.start();
}
 
Example #16
Source File: MenuFragment.java    From AndroidAnimationExercise with Apache License 2.0 6 votes vote down vote up
private void startTootipAnimation() {
	ObjectAnimator scaleY = ObjectAnimator.ofFloat(mTooltip, "scaleY", 0.8f);
	scaleY.setDuration(200);
	ObjectAnimator scaleYBack = ObjectAnimator.ofFloat(mTooltip, "scaleY", 1f);
	scaleYBack.setDuration(500);
	scaleYBack.setInterpolator(new BounceInterpolator());
	final AnimatorSet animatorSet = new AnimatorSet();
	animatorSet.setStartDelay(1000);
	animatorSet.playSequentially(scaleY, scaleYBack);
	animatorSet.addListener(new AnimatorListenerAdapter() {
		@Override
		public void onAnimationEnd(Animator animation) {
			animatorSet.setStartDelay(2000);
			animatorSet.start();
		}
	});
	mTooltip.setLayerType(View.LAYER_TYPE_HARDWARE, null);
	animatorSet.start();
}
 
Example #17
Source File: PullDoorView.java    From LLApp with Apache License 2.0 6 votes vote down vote up
private void setupView() {

		// 这个Interpolator你可以设置别的 我这里选择的是有弹跳效果的Interpolator
		Interpolator polator = new BounceInterpolator();
		mScroller = new Scroller(mContext, polator);

		// 获取屏幕分辨率
		WindowManager wm = (WindowManager) (mContext
				.getSystemService(Context.WINDOW_SERVICE));
		DisplayMetrics dm = new DisplayMetrics();
		wm.getDefaultDisplay().getMetrics(dm);
		mScreenHeigh = dm.heightPixels;
		mScreenWidth = dm.widthPixels;

		// 这里你一定要设置成透明背景,不然会影响你看到底层布局
		this.setBackgroundColor(Color.argb(0, 0, 0, 0));
		mImgView = new ImageView(mContext);
		mImgView.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT,
				LayoutParams.MATCH_PARENT));
		mImgView.setScaleType(ImageView.ScaleType.FIT_XY);// 填充整个屏幕
		// mImgView.setImageResource(R.drawable.ic_launcher); // 默认背景
		mImgView.setBackgroundColor(Color.parseColor("#60000000"));
		addView(mImgView);
	}
 
Example #18
Source File: DefaultCardStreamAnimator.java    From android-play-places with Apache License 2.0 6 votes vote down vote up
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@Override
public ObjectAnimator getSwipeInAnimator(View view, float deltaX, float deltaY){

    float deltaXAbs = Math.abs(deltaX);

    float fractionCovered = 1.f - (deltaXAbs / view.getWidth());
    long duration = Math.abs((int) ((1 - fractionCovered) * 200 * mSpeedFactor));

    // Animate position and alpha of swiped item

    ObjectAnimator animator = ObjectAnimator.ofPropertyValuesHolder(view,
            PropertyValuesHolder.ofFloat("alpha", 1.f),
            PropertyValuesHolder.ofFloat("translationX", 0.f),
            PropertyValuesHolder.ofFloat("rotationY", 0.f));

    animator.setDuration(duration).setInterpolator(new BounceInterpolator());

    return  animator;
}
 
Example #19
Source File: DefaultCardStreamAnimator.java    From sensors-samples with Apache License 2.0 6 votes vote down vote up
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@Override
public ObjectAnimator getSwipeInAnimator(View view, float deltaX, float deltaY){

    float deltaXAbs = Math.abs(deltaX);

    float fractionCovered = 1.f - (deltaXAbs / view.getWidth());
    long duration = Math.abs((int) ((1 - fractionCovered) * 200 * mSpeedFactor));

    // Animate position and alpha of swiped item

    ObjectAnimator animator = ObjectAnimator.ofPropertyValuesHolder(view,
            PropertyValuesHolder.ofFloat("alpha", 1.f),
            PropertyValuesHolder.ofFloat("translationX", 0.f),
            PropertyValuesHolder.ofFloat("rotationY", 0.f));

    animator.setDuration(duration).setInterpolator(new BounceInterpolator());

    return  animator;
}
 
Example #20
Source File: SegmentedButtonGroup.java    From SegmentedButton with Apache License 2.0 6 votes vote down vote up
private void initInterpolations() {
    ArrayList<Class> interpolatorList = new ArrayList<Class>() {{
        add(FastOutSlowInInterpolator.class);
        add(BounceInterpolator.class);
        add(LinearInterpolator.class);
        add(DecelerateInterpolator.class);
        add(CycleInterpolator.class);
        add(AnticipateInterpolator.class);
        add(AccelerateDecelerateInterpolator.class);
        add(AccelerateInterpolator.class);
        add(AnticipateOvershootInterpolator.class);
        add(FastOutLinearInInterpolator.class);
        add(LinearOutSlowInInterpolator.class);
        add(OvershootInterpolator.class);
    }};

    try {
        interpolatorSelector = (Interpolator) interpolatorList.get(animateSelector).newInstance();
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
Example #21
Source File: AnimatedFragment.java    From SimpleRatingBar with Apache License 2.0 5 votes vote down vote up
private void startAnimations() {
  ratingBar1.getAnimationBuilder()
      .setRepeatCount(ValueAnimator.INFINITE)
      .setRepeatMode(ValueAnimator.REVERSE)
      .setInterpolator(new LinearInterpolator())
      .setRatingTarget(4)
      .start();

  ratingBar2.getAnimationBuilder()
      .setRepeatCount(ValueAnimator.INFINITE)
      .setRepeatMode(ValueAnimator.REVERSE)
      .setInterpolator(new AccelerateInterpolator(1.5f))
      .setRatingTarget(4)
      .start();

  ratingBar3.getAnimationBuilder()
      .setRepeatCount(ValueAnimator.INFINITE)
      .setRepeatMode(ValueAnimator.REVERSE)
      .setInterpolator(new DecelerateInterpolator(1.5f))
      .setRatingTarget(4)
      .setDuration(1500)
      .start();

  ratingBar4.getAnimationBuilder()
      .setRepeatCount(ValueAnimator.INFINITE)
      .setRepeatMode(ValueAnimator.RESTART)
      .setInterpolator(new BounceInterpolator())
      .setRatingTarget(4)
      .start();

  ratingBar5.getAnimationBuilder()
      .setRepeatCount(ValueAnimator.INFINITE)
      .setRepeatMode(ValueAnimator.RESTART)
      .setInterpolator(new OvershootInterpolator(2f))
      .setRatingTarget(4)
      .start();
}
 
Example #22
Source File: ButtonFloat.java    From meiShi with Apache License 2.0 5 votes vote down vote up
public void show(){
	ObjectAnimator animator = ObjectAnimator.ofFloat(ButtonFloat.this, "y", showPosition);
	animator.setInterpolator(new BounceInterpolator());
	animator.setDuration(1500);
	animator.start();
	isShow = true;
}
 
Example #23
Source File: ButtonFloat.java    From MoeGallery with GNU General Public License v3.0 5 votes vote down vote up
public void hide() {

        ObjectAnimator animator = ObjectAnimator.ofFloat(ButtonFloat.this, "y", hidePosition);
        animator.setInterpolator(new BounceInterpolator());
        animator.setDuration(1500);
        animator.start();

        isShow = false;
    }
 
Example #24
Source File: ButtonFloat.java    From MoeGallery with GNU General Public License v3.0 5 votes vote down vote up
public void show() {
    ObjectAnimator animator = ObjectAnimator.ofFloat(ButtonFloat.this, "y", showPosition);
    animator.setInterpolator(new BounceInterpolator());
    animator.setDuration(1500);
    animator.start();
    isShow = true;
}
 
Example #25
Source File: MultiFloatingActionButton.java    From ReadMark with Apache License 2.0 5 votes vote down vote up
private void bounceToShow(){
    for(int i=2; i<getChildCount(); i++){
        View view = getChildAt(i);
        view.setVisibility(VISIBLE);

        ObjectAnimator trans = ObjectAnimator.ofFloat(view, "translationY", 50f, 0);
        ObjectAnimator show = ObjectAnimator.ofFloat(view, "alpha", 0f, 1f);
        AnimatorSet set = new AnimatorSet();
        set.play(trans).with(show);
        set.setDuration(mAnimationDuration);
        set.setInterpolator(new BounceInterpolator());
        set.start();

    }
}
 
Example #26
Source File: RadioRealButtonGroup.java    From RadioRealButton with Apache License 2.0 5 votes vote down vote up
private void initInterpolations() {
    Class[] interpolations = {
            FastOutSlowInInterpolator.class,
            BounceInterpolator.class,
            LinearInterpolator.class,
            DecelerateInterpolator.class,
            CycleInterpolator.class,
            AnticipateInterpolator.class,
            AccelerateDecelerateInterpolator.class,
            AccelerateInterpolator.class,
            AnticipateOvershootInterpolator.class,
            FastOutLinearInInterpolator.class,
            LinearOutSlowInInterpolator.class,
            OvershootInterpolator.class};

    try {
        interpolatorText = (Interpolator) interpolations[animateTextsEnter].newInstance();
        interpolatorDrawablesEnter = (Interpolator) interpolations[animateDrawablesEnter].newInstance();
        interpolatorSelector = (Interpolator) interpolations[animateSelector].newInstance();

        interpolatorTextExit = (Interpolator) interpolations[animateTextsExit].newInstance();
        interpolatorDrawablesExit = (Interpolator) interpolations[animateDrawablesExit].newInstance();

    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
Example #27
Source File: SimpleRatingBar.java    From SimpleRatingBar with Apache License 2.0 5 votes vote down vote up
private AnimationBuilder(SimpleRatingBar ratingBar) {
  this.ratingBar = ratingBar;
  this.duration = 2000;
  this.interpolator = new BounceInterpolator();
  this.ratingTarget = ratingBar.getNumberOfStars();
  this.repeatCount = 1;
  this.repeatMode = ValueAnimator.REVERSE;
}
 
Example #28
Source File: DifficultySelectFragment.java    From AndroidAnimationExercise with Apache License 2.0 5 votes vote down vote up
private void animate(View... view) {
    AnimatorSet animatorSet = new AnimatorSet();
    Builder builder = animatorSet.play(new AnimatorSet());
    for (int i = 0; i < view.length; i++) {
        ObjectAnimator scaleX = ObjectAnimator.ofFloat(view[i], "scaleX", 0.8f, 1f);
        ObjectAnimator scaleY = ObjectAnimator.ofFloat(view[i], "scaleY", 0.8f, 1f);
        builder.with(scaleX).with(scaleY);
    }
    animatorSet.setDuration(500);
    animatorSet.setInterpolator(new BounceInterpolator());
    animatorSet.start();
}
 
Example #29
Source File: AlipaySuccessView.java    From AndroidAnimationExercise with Apache License 2.0 5 votes vote down vote up
private void SuccessAnim() {
    ObjectAnimator scaleXAnim = ObjectAnimator.ofFloat(this, "scaleX", 1.0f, 1.1f, 1.0f);
    ObjectAnimator scaleYAnim = ObjectAnimator.ofFloat(this, "scaleY", 1.0f, 1.1f, 1.0f);
    AnimatorSet set = new AnimatorSet();
    set.setDuration(3000);
    set.setInterpolator(new BounceInterpolator());
    set.playTogether(scaleXAnim, scaleYAnim);
    set.start();
}
 
Example #30
Source File: CircularProgressButton.java    From ProgressButton with Apache License 2.0 5 votes vote down vote up
private void animateIdleStateButtonAfterClick() {
    int textColorChangeDuration = 10;
    ObjectAnimator colorAnim = ObjectAnimator.ofInt(this, "textColor", getNormalColor(this.getTextColors()), mIdleStateTextColorAfterClick);
    colorAnim.setDuration(textColorChangeDuration);
    colorAnim.setEvaluator(new ArgbEvaluator());
    colorAnim.start();

    ObjectAnimator colorAnim1 = ObjectAnimator.ofInt(this, "textColor", mIdleStateTextColorAfterClick, getNormalColor(this.getTextColors()));
    colorAnim1.setDuration(0);
    colorAnim1.setStartDelay(IDLE_STATE_ANIMATION_DURATION_AFTER_CLICK - textColorChangeDuration);
    colorAnim1.setEvaluator(new ArgbEvaluator());
    colorAnim1.setInterpolator(new BounceInterpolator());
    colorAnim1.start();

    ObjectAnimator bgAnim = ObjectAnimator.ofInt(this, "backgroundColor", getNormalColor(mIdleColorState), mIdleStateBackgroundColorAfterClick);
    bgAnim.setDuration(0);
    bgAnim.setEvaluator(new ArgbEvaluator());
    bgAnim.start();

    int textSizeAnimationDuration = 150;
    ValueAnimator animator = ValueAnimator.ofFloat(textSize, textSize - textSize / 4);
    animator.setDuration(textSizeAnimationDuration);
    animator.setRepeatCount(1);
    animator.setRepeatMode(ValueAnimator.REVERSE);
    animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator valueAnimator) {
            float animatedValue = (float) valueAnimator.getAnimatedValue();
            setTextSize(animatedValue);
        }
    });

    animator.start();
}