exercises/w6_clock/clock.js
2025-04-01 13:16:47 +09:00

45 lines
1.1 KiB
JavaScript

/*
* 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
};