Chaining Rotate, Merge, and Ripple Reveal: A Custom Android SplashView
The state-per-phase approach keeps onDraw clean and makes each phase independently testable, and the ripple reveal uses stroke-width math instead of clipping APIs, which simplifies drawing and keeps the animation GPU friendly.
A complete SplashView implementation splits its animation into three phases, each handled by its own state class (RotateState, MergeState, ExpandState). The first phase draws six colored balls at positions computed from a rotating angle and uses a ValueAnimator with a LinearInterpolator to spin them 720 degrees over about 2.4 seconds. When that finishes, MergeState animates the orbit radius from the ball size to a larger maxRadius using an OvershootInterpolator, then calls animator.reverse() to pull the balls back in, creating a springy gathering motion.
The final phase produces the reveal effect by drawing a growing hollow circle. Its stroke width shrinks from mDistance to zero as holeRadius increases from circleRadius to mDistance, which effectively masks out the background and reveals the underlying layout. All coordinates, like centerX and centerY, are computed in onSizeChanged; the diagonal half mDistance serves as the maximum spread distance. The example code is hosted on GitHub.
The state pattern here is a clean alternative to a single animator managing all phases; it isolates animation timing and draw logic per phase, making it easy to add new effects.
Using OvershootInterpolator on the radius gives the merge a springy bounce that builds anticipation for the reveal, a subtle but effective motion cue.
The ripple reveal is implemented purely with stroke width and radius math, avoiding Canvas.clipPath or BitmapShader, which keeps the drawing simple and GPU friendly.