-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtach.html
771 lines (733 loc) · 18.9 KB
/
tach.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
<!doctype html>
<meta charset='utf-8'/>
<meta name='viewport' content='width=device-width, initial-scale=1'/>
<meta name='theme-color' content='#000000'/>
<title>
Biel chronograph & tachymeter
</title>
<style type='text/css'>
*, *::before, *::after {
box-sizing: border-box;
}
:root {
accent-color: var(--accent);
color-scheme: dark;
}
body {
background: #000;
overflow: hidden;
}
body, .btn, input, select {
color: #FFF;
font-family: Roboto, sans-serif;
font-size: 1em;
margin: 0;
}
details {
opacity: 0.5;
}
input, select, .label, summary {
padding: 0 .5em;
}
input {
width: 100%;
}
select {
min-width: 8rem;
}
summary {
cursor:pointer;
list-style: none;
user-select: none;
}
text {text-anchor:middle;fill:var(--text);}
.abs { position:absolute; }
.btn {
border-color: rgba(0, 0, 0, .5);
border-style: outset;
border-width: 0px;
cursor: pointer;
padding: 0 .5em;
text-decoration: none;
}
.column { display: flex; flex-direction: column; }
.cursive {font-family: 'Dancing Script', cursive; letter-spacing: -1px; font-style:italic; }
.home {
border-color: inherit;
border-width: 1px 1px 0 0;
position: absolute;
right:0;
text-align: right;
top:0;
width: 50%;
}
.hotkey { text-decoration: underline dotted; }
.mono {font-family: 'Roboto Mono', monospace;}
.row { display: flex; }
.sans {font-family: Roboto, sans-serif;}
.svg {
margin: 0 auto;
max-height: 100vh;
}
.thick { line-height: 3em; }
.wide { width: 100vw; }
</style>
<!-- <img src="file:///C:/Users/r/Downloads/img/.png" -->
<!-- style="display:block; height:auto; position:absolute; width:auto;"> -->
<div style='position:absolute;top:0;bottom:0;left:0;right:0;display:flex;align-content: center;'>
<svg version="1.1" viewBox="100 100 1848 1848" xmlns="http://www.w3.org/2000/svg" class='svg'>
<rect id="canvas" x="0" y="0" width="2048" height="2048" fill="none"/>
<circle id="edge" style="fill:var(--edge);" r="924" cx="1024" cy="1024"/>
<circle id="bezel" style="fill:var(--bezel);" r="912" cx="1024" cy="1024"/>
<circle id="dial" style="fill:var(--dial);" r="780" cx="1024" cy="1024"/>
<g class="sans" style="fill:var(--bezel_mark);font-size:60px;">
<path id="tach-curve" pathLength="2" d="M 1024, 224 a 800,800 0 0,1 500,180" fill="none"/>
<text>
<textPath href="#tach-curve" startOffset="1"
>TACHYMÈTRE</textPath>
</text>
<text x="1024" y="200">60</text>
<text x="641" y="294" style="text-anchor:end;">65</text>
<text x="380" y="510" style="text-anchor:end;">70</text>
<text x="240" y="769" dominant-baseline="central" style="text-anchor:end;">75</text>
<text x="200" y="1024" dominant-baseline="central" style="text-anchor:end;">80</text>
<text x="231" y="1249" dominant-baseline="central" style="text-anchor:end;">85</text>
<text x="310" y="1436" dominant-baseline="hanging" style="text-anchor:end;">90</text>
<text x="540" y="1691" dominant-baseline="hanging">I00</text>
<text x="792" y="1815" dominant-baseline="hanging">II0</text>
<text x="1024" y="1848" dominant-baseline="hanging">I20</text>
<text x="1221" y="1824" dominant-baseline="hanging">I30</text>
<text x="1382" y="1766" dominant-baseline="hanging">I40</text>
<text x="1508" y="1691" dominant-baseline="hanging">I50</text>
<text x="1607" y="1607" dominant-baseline="hanging">I60</text>
<text x="1682" y="1521" dominant-baseline="hanging">I70</text>
<text x="1738" y="1436" dominant-baseline="hanging">I80</text>
<text x="1779" y="1355" dominant-baseline="hanging">I90</text>
<text x="1808" y="1279" dominant-baseline="hanging">200</text>
<text x="1843" y="1110" dominant-baseline="hanging" style="translate:0 12px">225</text>
<text x="1846" y="972" style="translate: 0 -12px">250</text>
<text x="1832" y="860" style="translate: 0 -12px">275</text>
<text x="1808" y="769" style="translate: 0 -6px">300</text>
<text x="1750" y="634">350</text>
<text x="1691" y="540">400</text>
<text x="1588" y="423">500</text>
</g>
<g id="chrono_hours" class="sans" transform="translate(1024,1316)" style="fill:var(--bezel_mark);font-size:60px;">
<circle style="fill:var(--subdial);" r="192"/>
<text x="160" y="0" dominant-baseline="central" style="text-anchor:end;">3</text>
<text x="0" y="160">6</text>
<text x="-160" y="0" dominant-baseline="central" style="text-anchor:start;">9</text>
<text x="0" y="-160" dominant-baseline="hanging">12</text>
</g>
<g id="sub_seconds" class="sans" transform="translate(732,1024)" style="fill:var(--bezel_mark);font-size:60px;">
<circle style="fill:var(--subdial);" r="192"/>
<text x="139" y="80" style="text-anchor:end;">20</text>
<text x="-138" y="80" style="text-anchor:start;">40</text>
<text x="0" y="-160" dominant-baseline="hanging">60</text>
</g>
<g id="chrono_minutes" class="sans" transform="translate(1316,1024)" style="fill:var(--bezel_mark);font-size:60px;">
<circle style="fill:var(--subdial);" r="192"/>
<text x="139" y="80" style="text-anchor:end;">10</text>
<text x="-139" y="80" style="text-anchor:start;">20</text>
<text x="0" y="-160" dominant-baseline="hanging">30</text>
</g>
<text x="1024" y="700" style="font:bold 110px Times, serif;">
Θ
</text>
<text transform="translate(1024 774) scale(1.25 1)"
class="mono"
style="font-size:80px;">
THETA
</text>
<text class="cursive"
style="font-size:50px;"
transform="translate(1030 845) scale(1.5 1)">
<tspan style="font-size:1.5em;">S</tspan><tspan dy="-10">pacewalker</tspan>
</text>
<text id="desc" x="1024" y="890" class="sans" style="font-size:34px;letter-spacing:3px;text-transform:uppercase;">
</text>
<path id="curve" pathLength="2" d="M 1024, 294 a 746,746 0 1,0 5,0" fill="none"/>
<text class="mono" style="font-size:24px;">
<textPath href="#curve" startOffset="1"
>HTML<tspan style="font-size:12px;"> </tspan>MADE</textPath>
</text>
</svg>
<canvas id='face-static' class='abs'></canvas>
<canvas id='face' class='abs'></canvas>
</div>
<details class='abs column wide'>
<summary accesskey='s' title='Settings' class='btn thick'>☰</summary>
<a href='..' accesskey='h' class='btn home thick'>
<span class='hotkey'>H</span>ome
</a>
<label class='row thick'>
<span class='label'><span class='hotkey'>O</span>ffset</span>
<input id='offset' accesskey='o' value='0' type='range' onInput='synchronize()'>
</label>
<label class='row thick'>
<span class='label'><span class='hotkey'>C</span>hrono Offset</span>
<input id='chrono_offset' accesskey='c' value='0' type='range' onInput='synchronize()'>
</label>
<label class='row thick'>
<span class='label'><span class='hotkey'>T</span>heme</span>
<select id='theme' accesskey='t' onChange='setTheme(this.value)'></select>
</label>
</details>
<script type='text/javascript'>
const _ = void 0
const doc = document
const $ = document.querySelector.bind(document)
const eid = document.getElementById.bind(document)
const bps = 3
const delay = 1000 / bps
let palettes
const color_palettes = {
desc: 'Professional',
bezel: '#000000',
dial: '#000000',
edge: '#C0C0C0',
highlight: '#9DE5B3',
mark: '#FFFFFF',
subdial: '#101010',
text: '#FFFFFF',
}
const themes = {
'Black': {
},
'Blue': {
desc: 'Neptune',
bezel: '#001830',
dial: '#002040',
highlight: '#C0FFFF',
subdial: '#001830',
},
'Gray': {
desc: 'Mercury',
bezel: '#303030',
dial: '#404040',
highlight: '#D0FFD0',
subdial: '#303030',
},
'Purple': {
desc: 'Nebula',
bezel: '#300030',
dial: '#400040',
highlight: '#78F8F8',
subdial: '#300030',
},
'Purple-Dark': {
desc: 'Cosmos',
bezel: '#301020',
dial: '#100810',
edge: '#D2A67F',
highlight: '#C0F080',
mark: '#D2A67F',
subdial: '#201020',
text: '#D2A67F',
},
'Red': {
desc: 'Mars',
bezel: '#300000',
dial: '#400000',
highlight: '#E0E0E0',
subdial: '#300000',
},
'Yellow': {
desc: 'Saturn',
bezel: '#F0E070',
dial: '#F0F080',
edge: '#806040',
highlight: '#C0A040',
mark: '#402020',
text: '#303000',
subdial: '#F0E070',
},
}
const chrono_max = 43200e3
const scale = 1024
const width = 128
const height = width
const half = width / 2
const ratio = half / scale
const bezel_r = 50
const tach_r = bezel_r + 1.5
const bezel_mark_len = 9.5
const bezel_mark_r = .5
const dash = 1.2
const hour_r_rect = 32
const hour_len = 10
const hour_thick = 1
const lw = .5
const lw_2 = lw / 2
const lwhyp_2 = (2 * lw**2) ** .5 / 2
const minute_len = 10
const minute_len_five = 2
const minute_r = half * 720/scale
const minute_thick = 0.2
const minute_thick_five = 0.3
const shadowBlur = .5
const shadowOffset = .25
const tach_length = 4
const tach_thick = lw_2
const thick = .2
const tw_gap = 2.5
const sub_r = 192 * ratio
const arm_w = 2
const arm_w2 = 3
const base_h = 1.5
const base_w = 4
const cstw = 1.5
const fudge = .5
const lume_inset = 2
const lume_inset_arm = .75
const minute_hand_w = 2.5
const stem_w = 1.5
const sub_hand_w = 1
const chrono_hour_hand = [
[0, 0],
[10, 0],
[11.5, sub_hand_w/2],
[10, sub_hand_w],
[0, sub_hand_w],
[0, 0],
]
const chrono_minute_hand = [
[0, 0],
[10, 0],
[11.5, sub_hand_w/2],
[10, sub_hand_w],
[0, sub_hand_w],
[0, 0],
]
const chr_sec_tail = [
[-cstw, 0],
[0, -cstw],
[11, 0],
[0, cstw],
[-cstw, 0],
]
const chr_sec_head = [
[-2 - lwhyp_2, 0],
[0, -2 - lw_2],
[12.5, 0],
[0, 2 + lw_2],
[-2 - lwhyp_2, 0],
]
const chr_sec_head_lume = [
[-2 + lwhyp_2, 0],
[.17, -1.71],
[9.7, 0],
[.17, 1.71],
[-2 + lwhyp_2, 0],
]
const hour_hand = [
[0, 0],
[23, 0],
[26, minute_hand_w/2],
[23, minute_hand_w],
[0, minute_hand_w],
[0, 0],
]
const minute_hand = [
[0, 0],
[40, 0],
[43 + fudge, minute_hand_w/2],
[40, minute_hand_w],
[0, minute_hand_w],
[0, 0],
]
const chrono_minutes_el = eid('chrono_minutes')
const chrono_minutes = {
x: chrono_minutes_el.transform.baseVal[0].matrix.e * ratio,
y: chrono_minutes_el.transform.baseVal[0].matrix.f * ratio,
}
const chrono_hours_el = eid('chrono_hours')
const chrono_hours = {
x: chrono_hours_el.transform.baseVal[0].matrix.e * ratio,
y: chrono_hours_el.transform.baseVal[0].matrix.f * ratio,
}
const sub_seconds_el = eid('sub_seconds')
const sub_seconds = {
x: sub_seconds_el.transform.baseVal[0].matrix.e * ratio,
y: sub_seconds_el.transform.baseVal[0].matrix.f * ratio,
}
// zoom
let z = 1
const {cos, min, sin, tan} = Math
const tau = 2 * Math.PI
const tau_4 = tau / 4
const tau_12 = tau / 12
const tau_30 = tau / 30
const tau_60 = tau / 60
for(k in themes){
themes[k] = Object.assign({}, color_palettes, themes[k])
}
const colors = Object.keys(color_palettes)
eid('theme').innerHTML = Object.keys(themes).map(
t => `<option value='${t}'>${t.replaceAll('_',' ')}</option>`
).join('')
const face = eid('face')
const fc = face.getContext('2d')
const can = eid('face-static')
const c = can.getContext('2d')
const faces = [face, can]
const faces_c = [fc, c]
function resize(){
const canvas_el = eid('canvas')
const rect = canvas_el.getBoundingClientRect()
const scale = window.devicePixelRatio || 1
z = min(
(rect.height / height),
(rect.width / width),
)
faces.forEach(can =>{
can.height = height * scale * z
can.width = width * scale * z
can.style.left = rect.x + 'px'
can.style.top = rect.y + 'px'
can.style.height = rect.height+'px'
can.style.width = rect.width+'px'
})
faces_c.forEach(
c => c.scale(scale, scale)
)
display_static()
synchronize()
}
window.addEventListener('resize', resize)
const offset_el = eid('offset')
offset_el.setAttribute('max', 86400 * bps)
const chrono_offset_el = eid('chrono_offset')
chrono_offset_el.setAttribute('max', 43200 * bps)
function setTheme(theme){
palettes = themes[theme]
$(`#theme [value=${theme}]`).selected = true
eid('desc').innerHTML = palettes.desc
doc.documentElement.style.setProperty('--accent', palettes.highlight)
colors.forEach(color => {
doc.documentElement.style.setProperty('--'+color, palettes[color])
})
display_static()
synchronize()
}
function synchronize(){
window.clearTimeout(window.synchronizeTimeout)
const offset = parseInt(offset_el.value) * 1000 / bps
const chrono_offset = parseInt(chrono_offset_el.value) * 1000 / bps
let t = new Date(Date.now() + offset)
// t = new Date(new Date(2000,0,30,10,8,37,333).getTime() + offset)
display(t, chrono_offset)
const r = delay - (t % delay)
window.synchronizeTimeout = window.setTimeout(synchronize, r)
}
function shapec(c, path, x = 0, y = 0, m = 1, fill = true, beginPath = true){
m = m*z
beginPath && c.beginPath()
c.moveTo((path[0][0] + x)*m, (path[0][1] + y)*m)
for(i=1; i<path.length; ++i){
c.lineTo((path[i][0] + x)*m, (path[i][1] + y)*m)
}
fill && c.fill()
}
const shape = shapec.bind(null, c)
function shapep(){
const a = [...arguments]
a[5] = a[6] = false
shapec.apply(null, a)
}
function circle(r, x, y, m = 1){
m = m*z
c.beginPath()
c.arc(x*m, y*m, r*m, 0, tau)
c.fill()
}
function rot(a, [x,y]){
return [
x * cos(a) + y * sin(a),
y * cos(a) - x * sin(a),
]
}
const rect_my = (y, h) => ([
[0, -y],
[h, -y],
[h, y],
[0, y],
])
const tach_long = rect_my(tach_thick, tach_length)
const tach_short = rect_my(tach_thick, tach_length / 2)
function shadow_on(c){
c.shadowBlur = z*shadowBlur
c.shadowOffsetX = c.shadowOffsetY = z*shadowOffset
}
function shadow_off(c){
c.shadowBlur = 0
c.shadowOffsetX = 0
c.shadowOffsetY = 0
}
let chrono_align
function display(t, chrono_offset){
chrono_align ??= performance.now()
const hours = t.getHours()
const minutes = t.getMinutes()
const seconds = t.getSeconds() + t.getMilliseconds() / 1000
let chrono = (performance.now() - chrono_align)
chrono = (chrono - (chrono % delay) + chrono_offset) % chrono_max
fc.shadowColor = 'rgba(0,0,0,1)'
fc.fillStyle = palettes.mark
fc.strokeStyle = palettes.mark
fc.save()
fc.lineWidth = lw*z
fc.clearRect(0, 0, width*z, height*z)
fc.translate(half*z, half*z)
fc.rotate(-tau_4)
const hr = hours % 12
face.innerText = `The time is ${hr} hours, ${(minutes+'').padStart(2, '0')} minutes, and ${seconds} seconds`
// subdials
// second hand
fc.save()
shadow_on(fc)
fc.translate((half - sub_seconds.y) * z, (sub_seconds.x - half) * z)
fc.rotate(seconds * tau_60)
fc.beginPath()
fc.arc(0, 0, 2*z, 0, tau)
shapep(
fc,
[
[0, 0],
[10, 0],
[11.5, sub_hand_w/2],
[10, sub_hand_w],
[0, sub_hand_w],
[0, 0],
],
0, 0-sub_hand_w/2,
)
fc.fill()
stem(fc)
fc.restore()
// chrono minute hand (30)
fc.save()
fc.translate((half - chrono_minutes.y) * z, (chrono_minutes.x - half) * z)
fc.rotate(((chrono % 1800e3) / 1800e3) * tau)
shadow_on(fc)
fc.beginPath()
fc.arc(0, 0, 2*z, 0, tau)
shapep(fc, chrono_minute_hand, 0, -sub_hand_w/2)
fc.fill()
stem(fc)
fc.restore()
// chrono hour hand
fc.save()
fc.translate((half - chrono_hours.y) * z, (chrono_hours.x - half) * z)
fc.rotate((chrono / chrono_max) * tau)
shadow_on(fc)
fc.beginPath()
fc.arc(0, 0, 2*z, 0, tau)
shapep(fc, chrono_hour_hand, 0, -sub_hand_w/2)
fc.fill()
stem(fc)
fc.restore()
// hour hand
fc.save()
fc.rotate(
(hr / 12 + minutes / 720 + seconds / 43200) * tau,
)
shadow_on(fc)
fc.beginPath()
fc.arc(0, 0, 3.5*z, 0, tau)
shapep(fc, hour_hand, 0, -minute_hand_w/2)
fc.fill()
shadow_off(fc)
// hour lume
fc.lineWidth = 1.5*z
fc.strokeStyle = palettes.highlight
fc.beginPath()
fc.moveTo(6*z, 0)
fc.lineTo(22*z, 0)
fc.stroke()
fc.restore()
// minute hand
fc.save()
fc.rotate((minutes / 60 + seconds / 3600) * tau)
shadow_on(fc)
fc.beginPath()
fc.arc(0, 0, 2.75*z, 0, tau)
shapep(fc, minute_hand, 0, -minute_hand_w/2)
fc.fill()
shadow_off(fc)
// minute lume
fc.beginPath()
fc.moveTo(6*z, 0)
fc.lineTo(39*z, 0)
fc.lineWidth = 1.5*z
fc.strokeStyle = palettes.highlight
fc.stroke()
fc.restore()
// chrono second hand
fc.save()
fc.rotate(((chrono % 60e3) / 60e3) * tau)
shadow_on(fc)
fc.beginPath()
fc.arc(0, 0, 2*z, 0, tau)
// tip
shapep(fc, rect_my(.25, 13), 30)
// stick
shapep(fc, rect_my(.5, 38), -15)
shapep(fc, chr_sec_tail, -15)
shapep(fc, chr_sec_head, 23, 0)
fc.fill()
shadow_off(fc)
// lume
fc.fillStyle = palettes.highlight
fc.lineWidth = lw*z
shapec(fc, chr_sec_head_lume, 23, 0)
fc.restore()
stem(fc)
fc.restore()
}
function stem(c){
c.save()
shadow_on(c)
c.beginPath()
c.arc(0, 0, .375*z, 0, tau)
c.fill()
c.restore()
}
function display_static(){
c.clearRect(0, 0, width*z, height*z)
c.fillStyle = palettes.mark
c.strokeStyle = palettes.mark
c.lineWidth = lw*z
;[
60,65,70,75,80,85,90,
100,110,120,130,140,150,160,170,180,190,
200,225,250,275,
300,350,400,450,500,
].forEach(i => {
const a = -(60/i) * tau + tau_4
circle(
bezel_mark_r,
half + (bezel_r * cos(-a)),
half + (bezel_r * sin(-a)),
)
})
;[
135,125,115,105,95,
].forEach(i => {
const a = -(60/i) * tau + tau_4
const r = bezel_r - bezel_mark_r
shape(
tach_long.map(v => rot(a, v)),
half + (r * cos(-a)),
half + (r * sin(-a)),
)
})
Array(40).fill().map((_, i) => i + 60)
.filter(x => x % 5)
.forEach(i => {
const a = -(60/i) * tau + tau_4
const r = bezel_r - bezel_mark_r
shape(
tach_short.map(v => rot(a, v)),
half + (r * cos(-a)),
half + (r * sin(-a)),
)
})
Array(12).fill().map((_, i) => i*5)
.forEach(i => {
const a = -i * tau_60 + tau_4
shape(
rect_my(minute_thick_five, -minute_len_five).map(v => rot(a, v)),
half + (minute_r * cos(-a)),
half + (minute_r * sin(-a)),
)
})
Array(180).fill().map((_, i) => i)
.filter(x => x % 3)
.forEach(i => {
const a = -(i/3) * tau_60 + tau_4
shape(
rect_my(minute_thick, -minute_len_five).map(v => rot(a, v)),
half + (minute_r * cos(-a)),
half + (minute_r * sin(-a)),
)
})
Array(60).fill().map((_, i) => i)
.filter(x => x % 5)
.forEach(i => {
const a = -i * tau_60 + tau_4
shape(
rect_my(minute_thick, -minute_len).map(v => rot(a, v)),
half + (minute_r * cos(-a)),
half + (minute_r * sin(-a)),
)
})
// west
Array(12).fill().map((_, i) => i)
.forEach(i => {
const a = i * tau_12
let len = minute_len_five
if(!((i+1) % 4)){ len *= .5}
shape(
rect_my(minute_thick, -len).map(v => rot(a, v)),
sub_seconds.x + (sub_r * cos(-a)),
sub_seconds.y + (sub_r * sin(-a)),
)
})
// east
Array(30).fill().map((_, i) => i)
.forEach(i => {
const a = i * tau_30 + tau_4
let len = minute_len_five
if(!((i+5) % 10)){ len *= 1.5}
let thick = minute_thick
if(!((i) % 10)){ thick *= 1.5}
shape(
rect_my(thick, -len).map(v => rot(a, v)),
chrono_minutes.x + (sub_r * cos(-a)),
chrono_minutes.y + (sub_r * sin(-a)),
)
})
// chrono_hours
Array(12).fill().map((_, i) => i)
.forEach(i => {
const a = i * tau_12
let len = minute_len_five
if(!((i) % 3)){ len *= .5}
shape(
rect_my(minute_thick, -len).map(v => rot(a, v)),
chrono_hours.x + (sub_r * cos(-a)),
chrono_hours.y + (sub_r * sin(-a)),
)
})
// hour markers
c.lineCap = 'square'
c.strokeStyle = palettes.edge
c.fillStyle = palettes.highlight
Array(12).fill().map((_, i) => i+1)
.forEach(i => {
const a = -i * tau_12 + tau_4
shape(
rect_my(hour_thick, hour_len).map(v => rot(a, v)),
half + (hour_r_rect * cos(-a)),
half + (hour_r_rect * sin(-a)),
)
c.closePath()
c.fill()
})
;[-1,1].forEach(i => {
const a = -tau_4
const gap = tw_gap * i
const r = 1
const p = hour_r_rect + r
circle(r,
half + (p * cos(a)) + gap,
half + (p * sin(a)),
)
c.closePath()
c.fill()
})
}
setTheme('Black')
resize()
</script>