-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtestTile.html
More file actions
204 lines (155 loc) · 5.3 KB
/
testTile.html
File metadata and controls
204 lines (155 loc) · 5.3 KB
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
<!doctype html>
<html class="no-js" lang="">
<head>
<meta charset="UTF-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>Untitled Document</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="apple-touch-icon" href="apple-touch-icon.png">
<!-- Place favicon.ico in the root directory -->
<script src="https://code.jquery.com/jquery-3.3.1.js" integrity="sha256-2Kok7MbOyxpgUVvAk/HJ2jigOSYS2auK4Pfzbm7uH60=" crossorigin="anonymous"></script>
<link rel="stylesheet" type="text/css" href="style.css">
<script>
var state = {
zoom: 0,
row: 0,
col: 0,
index: 0,
brightness: 0,
focus: 0
}
var slideTableSize = 4;
var tileSize = 128;
$(function() {
$("input").on("input", function(evt) {
var whichRange = $(evt.target).attr("name")
var value = $(evt.target).val() / 100;
console.log("state.zoom = ", state.zoom)
//console.log(whichRange, value)
state[whichRange] = value;
//console.log(state)
// state.index = 1 - state.index;
showSlide(state)
});
drawTable(0);
drawTable(1)
$("input").trigger("input")
});
function drawTable(index) {
var table = $("<table/>", {
id: "id_" + index
});
for (rowOffset = 0; rowOffset < slideTableSize; rowOffset++) {
var tr = $("<tr/>");
for (colOffset = 0; colOffset < slideTableSize; colOffset++) {
var quadIndex = (colOffset + (rowOffset * slideTableSize));
var td = $("<td/>");
var img = $("<img/>", {
"id": "d_" + index + "_" + quadIndex,
"class": "slideTile"
});
td.append(img);
tr.append(td);
}
table.append(tr)
}
$("#slide").append(table)
}
function showSlide(state) {
var numberOfColumns = Math.pow(2, Math.floor(state.zoom * 4) + 1);
// var slideOffsetRow = (state.row * tileSize) % tileSize;
// var slideOffsetColumn = (state.col * tileSize) % tileSize;
var folder = numberOfColumns / 2;
var currentRowRaw = numberOfColumns * state.row;
var currentColumnRaw = numberOfColumns * state.col;
var currentRow = Math.floor(currentRowRaw);
var currentColumn = Math.floor(currentColumnRaw);
var slideOffsetRow = tileSize * (currentRow - currentRowRaw);
var slideOffsetColumn = tileSize * (currentColumn - currentColumnRaw);
var illuminationBrightness = state.brightness;
var illumination = `rgba(${Math.min(232, 232* illuminationBrightness)}, ${Math.min(224, 224*illuminationBrightness)}, ${Math.min(152, 152*illuminationBrightness)}, 1)`;
var focus = state.focus;
// console.log(slideOffsetRow, slideOffsetColumn)
$("#slide table").attr("style", `left: ${slideOffsetColumn}px;top: ${slideOffsetRow}px`);
//$(".slideTile").attr("src", "")
for (rowOffset = 0; rowOffset < slideTableSize; rowOffset++) {
for (colOffset = 0; colOffset < slideTableSize; colOffset++) {
var image;
var rowWithOffset = currentRow + rowOffset - 1;
var colWithOffset = currentColumn + colOffset - 1;
var quadIndex = (colOffset + (rowOffset * slideTableSize));
var imgIndex = colWithOffset + (rowWithOffset * numberOfColumns);
image = "img/cells/" + folder + "/cell" + imgIndex.toString().padStart(4, "0") + ".png"
if (rowWithOffset >= numberOfColumns || colWithOffset >= numberOfColumns || colWithOffset < 0 || rowWithOffset < 0) {
image = "img/blankImage.png"
}
$("#d_" + state.index + "_" + quadIndex).attr("src", image)
$("#background").css("background-color", illumination)
$(".slideTile").css({
"filter": "blur(" + focus + "rem) brightness(" + (illuminationBrightness * 100) + "%) ",
});
console.log($("#background").css("fill"));
// $("##id_0").on("change", function() { // $("#id_0").css("fill", illumination); // });
}
}
}
</script>
<style>
/*
#slide img { border: 1px solid black; }*/
#slide td {
/* border: 1px solid black; */
padding: 0;
margin: 0;
}
#slide {
position: absolute;
top: 280px;
left: 80px;
}
#window {
left: -200px;
top: 90px;
position: absolute;
}
input {
width: 1200px;
}
#window img {}
#slide table {
position: absolute;
font-size: 0px;
border-spacing: 0;
border: 0px;
padding: 0;
margin: 0;
border-collapse: collapse;
}
#slideBed {
position: absolute;
top: 25%;
}
#background {
position: absolute;
z-index: -100;
width: 100%;
height: 100%;
}
</style>
</head>
<body>
<input type=range value="0" name="col" />
<input type=range value="0" name="row" />
<input type=range value="0" name="zoom" />
<input type=range value="0" name="brightness" />
<input type=range value="0" name="focus" />
<div id="slideBed">
<div id="slide">
</div>
<div id="window">
<img src="img/cells/window.png" /> </div>
</div>
<div id="background"> </div>
</body>
</html>