feat: More private methods for HippieClock

This commit is contained in:
sthag 2026-03-01 20:05:50 +01:00
parent d0fde7cc6a
commit 91df239a42

View file

@ -33,10 +33,10 @@ tags:
this.parts = this.#createContext(['background', 'hands']); this.parts = this.#createContext(['background', 'hands']);
this.shapes = []; this.shapes = [];
this.init(); this.#init();
} }
init() { #init() {
this.addRing('seconds', 1, 21, 60, `rgb(250, 216, 3)`); this.addRing('seconds', 1, 21, 60, `rgb(250, 216, 3)`);
this.addRing('minutes', .9, 46, 60, `rgb(242, 175, 19)`); this.addRing('minutes', .9, 46, 60, `rgb(242, 175, 19)`);
this.addRing('hours', .8, 6, this.options.h24 ? 24 : 12, `rgb(211, 10, 81)`); this.addRing('hours', .8, 6, this.options.h24 ? 24 : 12, `rgb(211, 10, 81)`);
@ -47,14 +47,14 @@ tags:
this.addRing('month', .3, 10, 12, `rgb(107, 199, 217)`); this.addRing('month', .3, 10, 12, `rgb(107, 199, 217)`);
this.addRing('moon', .2, 4, 8, `rgb(82, 190, 209)`); this.addRing('moon', .2, 4, 8, `rgb(82, 190, 209)`);
this.resize(); this.#resize();
window.addEventListener('resize', () => this.resize()); window.addEventListener('resize', () => this.#resize());
console.debug(this); console.debug(this);
console.debug(this.getTime()); console.debug(this.getTime());
} }
resize() { #resize() {
this.parts.forEach(part => { this.parts.forEach(part => {
this.updateOptions({size: Math.floor(this.getSize().value * 0.9)}) this.updateOptions({size: Math.floor(this.getSize().value * 0.9)})