-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
107 lines (89 loc) · 2.27 KB
/
index.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
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<div class="row">
<div class="left">
<div id="sliders"></div>
</div>
<div class="right">
<img src="image.png" id="template" style="display:none;">
<canvas id="image" width="800" height="2100" style="float:right;"></canvas>
</div>
</div>
</body>
<script>
const state = new Array(20).fill(6)
const sliders = document.getElementById("sliders")
for (let i = 0; i < 20; i++) {
const slider = document.createElement("p")
slider.innerHTML = '<input type="range" min="1" max="10" value="6" class="slider" id=`slider${i}`></div>'
sliders.appendChild(slider)
const sl = slider.children[0]
sl.oninput = function () {
state[i] = sl.value
load()
}
}
function load() {
var ctx = document.getElementById("image").getContext("2d")
var template = document.getElementById("template")
ctx.drawImage(template, 0, 0, 800, 2100)
ctx.fillStyle = "#ffffff80"
for (let i = 0; i < 20; i++) {
ctx.fillRect(80 * state[i] - 80, 105 * i, 80, 105)
}
}
window.onload = () => load()
</script>
<style>
body {
size: 100%;
margin: 0%;
padding: 2%;
background-color: #000000ff;
}
p {
font-family: font;
font-size: 24px;
text-align: center;
}
.row {
display: flex;
}
.column {
float: left;
}
.left {
width: 10%;
}
.right {
width: 90%;
}
.slider {
-webkit-appearance: none;
width: 100%;
height: 16px;
border-radius: 8px;
background: #404040ff;
outline: none;
margin-top: 28px;
margin-bottom: 28px;
}
.slider::-webkit-slider-thumb {
width: 24px;
height: 24px;
border-radius: 50%;
background: #00c0ffff;
cursor: pointer;
}
.slider::-moz-range-thumb {
width: 24px;
height: 24px;
border-radius: 50%;
background: #00c0ffff;
cursor: pointer;
}
</style>
</html>