"second" hand
This commit is contained in:
@@ -7,6 +7,8 @@ using Toybox.Time.Gregorian;
|
||||
|
||||
class DecimalWatchFaceView extends WatchUi.WatchFace {
|
||||
|
||||
var isHighPowerMode = true; // Track if we're in high power mode
|
||||
|
||||
function initialize() {
|
||||
WatchFace.initialize();
|
||||
}
|
||||
@@ -50,10 +52,12 @@ class DecimalWatchFaceView extends WatchUi.WatchFace {
|
||||
|
||||
// The user has just looked at their watch. Timers and animations may be started here.
|
||||
function onExitSleep() {
|
||||
isHighPowerMode = true;
|
||||
}
|
||||
|
||||
// Terminate any active timers and prepare for slow updates.
|
||||
function onEnterSleep() {
|
||||
isHighPowerMode = false;
|
||||
}
|
||||
|
||||
// Compute decimal time from current clock time
|
||||
@@ -124,7 +128,7 @@ class DecimalWatchFaceView extends WatchUi.WatchFace {
|
||||
dc.fillCircle(centerX, centerY, 5);
|
||||
}
|
||||
|
||||
// Draw both hour and minute hands for current decimal time
|
||||
// Draw hour, minute, and second hands for current decimal time
|
||||
function drawHand(dc, decimalTime) {
|
||||
var width = dc.getWidth();
|
||||
var height = dc.getHeight();
|
||||
@@ -143,6 +147,17 @@ class DecimalWatchFaceView extends WatchUi.WatchFace {
|
||||
var minuteAngleRad = Math.toRadians(minuteAngle);
|
||||
var minuteHandLength = radius - 45; // Longer hand
|
||||
|
||||
// Calculate second hand (shows finer detail, 100 rotations per day)
|
||||
// Only visible in high power mode
|
||||
var secondFractionalPart = (decimalTime * 10.0) - (decimalTime * 10.0).toNumber();
|
||||
var secondAngle = secondFractionalPart * 360.0 - 90.0;
|
||||
var secondHandLength = radius - 35; // Longest hand
|
||||
|
||||
// Draw second hand first (if in high power mode), so it appears behind other hands
|
||||
if (isHighPowerMode) {
|
||||
drawSingleHand(dc, centerX, centerY, secondAngle, secondHandLength, 2, Graphics.COLOR_DK_GRAY);
|
||||
}
|
||||
|
||||
// Draw minute hand (longer, thinner)
|
||||
drawSingleHand(dc, centerX, centerY, minuteAngle, minuteHandLength, 4, Graphics.COLOR_WHITE);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user