Skip to content

Instantly share code, notes, and snippets.

@tunjid
Created October 28, 2018 17:08
Show Gist options
  • Save tunjid/95c679af193e63da2eac33a622420e0c to your computer and use it in GitHub Desktop.
Save tunjid/95c679af193e63da2eac33a622420e0c to your computer and use it in GitHub Desktop.
animator.addIndicatorWatcher((indicator, position, fraction, totalTranslation) -> {
double radians = Math.PI * fraction;
float sine = (float) -Math.sin(radians);
float cosine = (float) Math.cos(radians);
float maxScale = Math.max(Math.abs(cosine), 0.4F);
ImageView currentIndicator = animator.getIndicatorAt(position);
currentIndicator.setScaleX(maxScale);
currentIndicator.setScaleY(maxScale);
indicator.setTranslationY(indicatorSize * sine);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment