-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
375 lines (363 loc) · 11.9 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
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<link rel="stylesheet" href="trf_style.css" />
<link rel="stylesheet" href="./utils/fa/all.min.css" />
<link rel="shortcut icon" href="./utils/favicon.png" type="image/x-icon" />
<script src="./utils/fa/all.min.js"></script>
<script src="./utils/jquery.min.js"></script>
<script src="./utils/typed.min.js"></script>
<title>3d-transform</title>
</head>
<body>
<div class="header">
# 3d transformations
<div class="tip"></div>
</div>
<div class="footer">
Made with love by Rohit Kaushal.
</div>
<div class="main">
<div class="scene">
<div class="box">
<div draggable="true" class="box__face box__face--front">front</div>
<div draggable="true" class="box__face box__face--back">back</div>
<div draggable="true" class="box__face box__face--right">right</div>
<div draggable="true" class="box__face box__face--left">left</div>
<div draggable="true" class="box__face box__face--top">top</div>
<div draggable="true" class="box__face box__face--bottom">bottom</div>
</div>
</div>
<div class="controls">
<div class="trigger"></div>
<div class="ctrl radio-group" style="grid-area: rd;">
<label class="radio">
<input
type="radio"
class="hidden"
name="rotate-cube-side"
value="front"
checked
/>
<span class="label"></span> F
</label>
<label class="radio">
<input
type="radio"
class="hidden"
name="rotate-cube-side"
value="right"
/>
<span class="label"></span> R
</label>
<label class="radio">
<input
type="radio"
class="hidden"
name="rotate-cube-side"
value="back"
/>
<span class="label"></span> B
</label>
<label class="radio">
<input
type="radio"
class="hidden"
name="rotate-cube-side"
value="left"
/>
<span class="label"></span> L
</label>
<label class="radio">
<input
type="radio"
class="hidden"
name="rotate-cube-side"
value="top"
/>
<span class="label"></span> T
</label>
<label class="radio">
<input
type="radio"
class="hidden"
name="rotate-cube-side"
value="bottom"
/>
<span class="label"></span> Bt
</label>
</div>
<div class="tab-ctrl">
<div class="prop" onclick="changeTab(0)">Properties</div>
<div class="mat" onclick="changeTab(1)">Matrix</div>
</div>
<div class="tab" id="properties">
<div class="ctrl" style="grid-area: prx;">
<label for="perspective">perspective</label>
<input
type="number"
name="perspective"
id="perspective"
min="0"
value="400"
step="10"
title="0 for Orthographic projections."
onchange="p=this.value; transform();
if(this.value == false){
document.querySelector('[for=perspective]').innerHTML = '<b>Orthographic</b>';
}
else{
document.querySelector('[for=perspective]').innerHTML = 'Perspective';
}
"
/>
</div>
<div class="ctrl" style="grid-area: tro; align-self: right;">
<label style="text-align: right;">Transform Origin ></label>
</div>
<div class="ctrl" style="grid-area: trox;">
<label for="trox">X %</label>
<input
type="number"
name="trox"
id="trox"
value="50"
step="5"
onchange="trox=this.value; transform();"
/>
</div>
<div class="ctrl" style="grid-area: troy;">
<label for="troy">Y %</label>
<input
type="number"
name="troy"
id="troy"
value="50"
step="5"
onchange="troy=this.value; transform();"
/>
</div>
<div class="ctrl" style="grid-area: trx;">
<label for="translateX">translate-X</label>
<input
type="number"
name="translateX"
id="translateX"
value="0"
step="5"
onchange="tx=this.value; transform();"
/>
</div>
<div class="ctrl" style="grid-area: try;">
<label for="translateY">translate-Y</label>
<input
type="number"
name="translateY"
id="translateY"
value="0"
step="5"
onchange="ty=this.value; transform();"
/>
</div>
<div class="ctrl" style="grid-area: trz;">
<label for="translateZ">translate-Z</label>
<input
type="number"
name="translateZ"
id="translateZ"
value="0"
step="5"
onchange="tz=this.value; transform();"
/>
</div>
<div class="ctrl" style="grid-area: rtx;">
<label for="rotateX">rotate-X</label>
<input
type="number"
name="rotateX"
id="rotateX"
value="0"
step="5"
onchange="rx=this.value; transform();"
/>
</div>
<div class="ctrl" style="grid-area: rty;">
<label for="rotateY">rotate-Y</label>
<input
type="number"
name="rotateY"
id="rotateY"
value="0"
step="5"
onchange="ry=this.value; transform();"
/>
</div>
<div class="ctrl" style="grid-area: rtz;">
<label for="rotateZ">rotate-Z</label>
<input
type="number"
name="rotateZ"
id="rotateZ"
value="0"
step="5"
onchange="rz=this.value; transform();"
/>
</div>
<div class="ctrl" style="grid-area: scx;">
<label for="scalex">scale-X</label>
<input
type="number"
name="scaleX"
id="scaleX"
value="1"
step="0.1"
onchange="sx=this.value; transform();"
/>
</div>
<div class="ctrl" style="grid-area: scy;">
<label for="scaley">scale-Y</label>
<input
type="number"
name="scaleY"
id="scaleY"
value="1"
step="0.1"
onchange="sy=this.value; transform();"
/>
</div>
<div class="ctrl" style="grid-area: scz;">
<label for="scalez">scale-Z</label>
<input
type="number"
name="scaleZ"
id="scaleZ"
value="1"
step="0.1"
onchange="sz=this.value; transform();"
/>
</div>
<div class="ctrl" style="grid-area: sca;">
<label for="scalea">Uniform-Scale</label>
<input
type="number"
name="scaleA"
id="scaleA"
value="1"
step="0.1"
onchange="sx=sy=sz=this.value; transform();"
/>
</div>
<div class="ctrl" style="grid-area: skx;">
<label for="skewx">skew-X</label>
<input
type="number"
name="skewX"
id="skewX"
value="0"
onchange="skx=this.value; transform();"
/>
</div>
<div class="ctrl" style="grid-area: sky;">
<label for="skewy">skew-Y</label>
<input
type="number"
name="skewY"
id="skewY"
value="0"
onchange="sky=this.value; transform();"
/>
</div>
<div
class="ctrl btn"
title="Randomize"
id="random"
style="grid-area: btn;"
onclick="random()"
>
I'm feeling lucky
<div title="Auto Randomize Continuously">
<i class="fa fa-clock" onclick="lock.call(this)"></i>
</div>
</div>
</div>
<div class="tab" id="matrix">
<input type="number" id="a00" value="1" title="Scale X" /><input
type="number"
id="a01"
value="0"
/><input type="number" id="a02" value="0" /><input
type="number"
id="a03"
value="0"
step="0.0002"
title="- 1/(X perspective)"
/>
<input type="number" id="a10" value="0" /><input
type="number"
id="a11"
value="1"
title="Scale Y"
/><input type="number" id="a12" value="0" /><input
type="number"
id="a13"
value="0"
step="0.0002"
title="1/(Y perspective)"
/>
<input type="number" id="a20" value="0" /><input
type="number"
id="a21"
value="0"
/><input type="number" id="a22" value="1" title="Scale Z" /><input
type="number"
id="a23"
value="0"
step="0.0002"
title="- 1/(Z perspective)"
/>
<input type="number" id="a30" value="0" title="Translate-X" /><input
type="number"
id="a31"
value="0"
title="Translate-Y"
/><input type="number" id="a32" value="0" title="Translate-Z" /><input
type="number"
id="a33"
value="1"
step="0.1"
title="Global Scaling factor"
/>
<div class="btn" onclick="matrix_transform()">Transform</div>
</div>
</div>
</div>
<script>
var tip = new Typed(".tip", {
strings: [
"",
"For Orthographic projections set perspective = 0 (actually Infinity)",
"Translate: move an object Over three Axis",
"Scaling : You can change the size of an object using scaling transformation. In the scaling process, you either expand or compress the dimensions of the object. Scaling can be achieved by multiplying the original coordinates of the object with the scaling factor to get the desired result.",
"Shear : A transformation that slants the shape of an object is called the shear transformation.",
"Transformation Matrices : Transformation matrix is a basic tool for transformation. A matrix with n x m dimensions is multiplied with the coordinate of objects. Usually 3 x 3 or 4 x 4 matrices are used for transformation.",
"Rotation : 3D rotation is not same as 2D rotation. In 3D rotation, we have to specify the angle of rotation along with the axis of rotation."
],
typeSpeed: 30,
smartBackspace: true,
backSpeed: 5,
shuffle: true,
backDelay: 5000,
loop: true,
// fadeOut: true,
showCursor: false,
// cursorChar: '>_',
// autoInsertCss:true,
startDelay: 1000
});
</script>
<script src="trf_script.js"></script>
</body>
</html>