Skip to content

Instantly share code, notes, and snippets.

@patrick-elmquist
Last active August 18, 2019 12:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save patrick-elmquist/779f40697fa2f4d15b6869eb48cc6c5e to your computer and use it in GitHub Desktop.
Save patrick-elmquist/779f40697fa2f4d15b6869eb48cc6c5e to your computer and use it in GitHub Desktop.
Frame by frame #3
private float calculateArcSize(float animationProgress) {
final double adjustedProgress = Math.sin(animationProgress * Math.PI);
// ARC_MAX_DEGREES is the maximum size the arc will have in degrees.
// ARC_MAX_DEGREES = 180 means that at it's largest it will cover
// half the circle.
return (float) adjustedProgress * -ARC_MAX_DEGREES;
}
private float calculateArcStart(float animationProgress) {
final float deceleratedProgress = mDecelerateInterpolator.getInterpolation(animationProgress);
// ARC_START_OFFSET_DEGREES is used to offset the starting position,
// -90 makes the top of the view the starting point.
return ARC_START_OFFSET_DEGREES + deceleratedProgress * DEGREES_IN_CIRCLE;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment