clock exercise 6.2

This commit is contained in:
Andrea Bianchi
2026-04-07 22:53:08 +09:00
parent 7ee7a5ea29
commit 13e99a84d5
3 changed files with 90 additions and 0 deletions

44
w6_2_clock/clock.js Normal file
View File

@@ -0,0 +1,44 @@
/*
* Clock Module
*/
/**
* @typedef Clock
* @type {object}
* @property {number} x - The x-coordinate of the clock center.
* @property {number} y - The y-coordinate of the clock center.
* @property {number} radius - The radius of the clock.
* @property {string} color - The color of the clock.
* @property {number} oneSecondMs - The interval in milliseconds for one second.
* @property {number} hours - The current hour.
* @property {number} minutes - The current minute.
* @property {number} seconds - The current second.
*/
const createClock = (color, oneSecondMs) => (x, y, radius) => {
// return a clock
};
// export const createSportsClock = createClock('#FFF000', 500);
// export const createStandardClock = createClock('#FFFFFF', 1000);
export const drawClock = (clock) => {
// draw the clock face
};
export function startClock(clock) {
// start animating the clock
}
export function stopClock(intervalId) {
// stop the clock
}
// Private Helpers
const tick = (clock) => {
// return a new clock that advances the time of 1 second
};
const drawClockHands = (x, y, alpha, length) => {
// draw the clock hands
};