A Jetpack Compose based example to draw a mini Solar System on Canvas
? Cosmic Compose
Cosmic Compose is a minimal Android app made with Jetpack Compose. Everything has been drawn on
a 2D canvas, and animated using Compose’s animation API. Shading has been achieved using a few
hacks. ?
In a nutshell
The Light source, ie. Sun, is drawn using a simple Radial Gradient. Every other planet is a
different composable ‘placed’ at different locations on the screen. Within each planet, there are
(radius)^2 points being rendered. Each point has its own lightness and alpha value, which gives us
the shaded look.
Installation
You can find the latest apk in the Release section, or you can download from here