Skip to content

Instantly share code, notes, and snippets.

@v3n3
Created June 22, 2017 21:26
Show Gist options
  • Save v3n3/31e02b3ca64ec9e9b32abc7ed514c410 to your computer and use it in GitHub Desktop.
Save v3n3/31e02b3ca64ec9e9b32abc7ed514c410 to your computer and use it in GitHub Desktop.
public class NinetyDegRotationTransition implements FabulousTransition {
private static final int MAIN_FAB_ANIMATION_DURATION = 200;
@NotNull
@Override
public AnimatorSet getClosingAnimation(@NotNull View element, float destX, float destY) {
AnimatorSet anim = new AnimatorSet();
ObjectAnimator fabX = ObjectAnimator.ofFloat(element, View.ROTATION, 0);
fabX.setDuration(MAIN_FAB_ANIMATION_DURATION);
anim.play(fabX);
return anim;
}
@NotNull
@Override
public AnimatorSet getOpeningAnimation(@NotNull View element, float destX, float destY) {
AnimatorSet anim = new AnimatorSet();
ObjectAnimator fabX = ObjectAnimator.ofFloat(element, View.ROTATION, 90);
fabX.setDuration(MAIN_FAB_ANIMATION_DURATION);
anim.play(fabX);
return anim;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment