Pebble Discs - deconstructed
With Pebble 2.0 coming out very soon, I can release a new watchface I’ve built: Discs. Discs is available on the app store, but you’ll have to search for it. Unfortunately, pebble has no web access to their app store (only on the apps) and no way to link into the app store AFAICT.
As you can see above, this is a minimalistic watchface. It doesn’t have that many components; thus it should be a great candidate to deconstruct.
To make this watchface, we will create four discs, drawn on top of each other. The first and second are stationary in the center of the screen, while the third and fourth rotate about the center as time passes.
Here we declare our Layer
s to hold our discs and set up their drawing order.
This is the “magic” function that creates a moving watchface effect. tick_handler
runs every second and notifies the watch to redraw our hour and minute layers. Now all we must do is draw each disc.
Here we draw the face disc (center is similar) and hour disc (minute is similar). The face disc never moves, so we just draw it in the center. For the hour disc, we must calculate its angle using the current time and calculate its position based on that angle using a trigonometric helper function.
Boom. We’ve got a beautiful minimalistic watchface.. Everything else is boilerplate. Check out the full code and go make your own watchface.