-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathage_style.js
63 lines (51 loc) · 1.25 KB
/
age_style.js
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
let size = 86;
let columns = Array.from(document.getElementsByClassName('column'));
let d, c;
let classList = ['visible', 'close', 'far', 'far', 'distant', 'distant'];
let use24HourClock = true;
function padClock(p, n) {
return p + ('0' + n).slice(-2);
}
function getClock() {
d = new Date();
return [
use24HourClock ? d.getHours() : (d.getHours() % 12 || 12),
d.getMinutes(),
d.getSeconds()
]
.reduce(padClock, '');
}
function getClass(n, i2) {
return classList.find((class_, classIndex) => Math.abs(n - i2) === classIndex) || '';
}
let _n = 0;
function get_n() {
_n += 1;
if (_n == 10)
_n = 0;
return _n;
}
/*
setInterval(
() => {
columns.forEach((ele, i) => {
n = get_n();
let offset = -n * size;
ele.style.transform = `translateY(calc(50vh + ${offset}px - ${size / 2}px))`;
Array.from(ele.children).forEach((ele2, i2) => {
ele2.className = 'num ' + getClass(n, i2);
});
});
}
, 1000);
*/
//console.log("cols", columns)
function set_col(index, number) {
n = number
let offset = -n * size;
columns[index].style.transform = `translateY(calc(50vh + ${offset}px - ${size / 2}px))`;
Array.from(columns[index].children).forEach((ele2, i2) => {
ele2.className = 'num ' + getClass(n, i2);
});
}
//console.log("age style js imported")