Skip to content

Instantly share code, notes, and snippets.

@beta
Created October 6, 2016 05:52
Show Gist options
  • Save beta/5afd4a5e2156f2686280d2823a880c71 to your computer and use it in GitHub Desktop.
Save beta/5afd4a5e2156f2686280d2823a880c71 to your computer and use it in GitHub Desktop.
PropertyValuesHolder pvhIncreaseScaleX =
PropertyValuesHolder.ofFloat("scaleX", 1.0f, 0.8f);
PropertyValuesHolder pvhIncreaseScaleY =
PropertyValuesHolder.ofFloat("scaleY", 1.0f, 0.8f);
PropertyValuesHolder pvhDecreaseScaleX =
PropertyValuesHolder.ofFloat("scaleX", 0.8f, 1.0f);
PropertyValuesHolder pvhDecreaseScaleY =
PropertyValuesHolder.ofFloat("scaleY", 0.8f, 1.0f);
ObjectAnimator heartBeatIncreaseAnimator = ObjectAnimator.ofPropertyValuesHolder(
mImageView, pvhIncreaseScaleX, pvhIncreaseScaleY
);
heartBeatIncreaseAnimator.setStartDelay(1200);
heartBeatIncreaseAnimator.setDuration(100);
heartBeatIncreaseAnimator.setInterpolator(new AccelerateDecelerateInterpolator());
ObjectAnimator heartBeatDecreaseAnimator = ObjectAnimator.ofPropertyValuesHolder(
mImageView, pvhDecreaseScaleX, pvhDecreaseScaleY
);
heartBeatDecreaseAnimator.setDuration(100);
heartBeatDecreaseAnimator.setInterpolator(new AccelerateDecelerateInterpolator());
AnimatorSet heartBeatAnimatorSet = new AnimatorSet();
heartBeatAnimatorSet.playSequentially(heartBeatIncreaseAnimator, heartBeatDecreaseAnimator);
heartBeatAnimatorSet.start();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment