-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex2.html
More file actions
261 lines (206 loc) · 8.86 KB
/
index2.html
File metadata and controls
261 lines (206 loc) · 8.86 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
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>3D Object</title>
<script src='https://kit.fontawesome.com/a076d05399.js'></script>
<link rel="stylesheet" href="css/styles.css">
<script type="module" src="https://cdn.jsdelivr.net/npm/@google/model-viewer"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.3.0/font/bootstrap-icons.css">
<link
class="jsbin"
href="http://ajax.googleapis.com/ajax/libs/jqueryui/1/themes/base/jquery-ui.css"
rel="stylesheet"
type="text/css"
/>
<!--Imports a model-viewer JavaScript code -->
<!--It helps to handle how the 3D Object would be displayed -->
<script type="module" src="https://unpkg.com/@google/model-viewer/dist/model-viewer.min.js"></script>
<script nomodule src="https://unpkg.com/@google/model-viewer/dist/model-viewer-legacy.js"></script>
</head>
<body oncontextmenu="return false;">
<!-- Main Container -->
<div id="container">
<!-- An aside -->
<!-- This is for holding the 3D object -->
<div id="aSide">
<!-- 3D objsect -->
<!-- This inserts the 3D object inside the aside container
<model-viewer src="assets/scene.gltf" alt="VR Headset" auto-rotate camera-controls ar ios-src="assets/scene.gltf"></model-viewer> -->
<model-viewer
id="modelA"
style="z-index: 30;"
camera-controls
touch-action="pan-y"
disable-pan
oncontextmenu="return false;"
interaction-prompt="none"
disable-zoom
exposure="1.4"
src="assets/arms.glb"
alt="kit">
<img class="logo-viewer" src="https://i.postimg.cc/pTPFcGnH/yegax.png"/>
<div style="padding: 10px;">
<button onclick="moveCameraView('front')">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-caret-down-fill" viewBox="0 0 16 16">
<path d="M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z"/>
</svg>
</button>
<button onclick="moveCameraView('back')">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-caret-up-fill" viewBox="0 0 16 16">
<path d="m7.247 4.86-4.796 5.481c-.566.647-.106 1.659.753 1.659h9.592a1 1 0 0 0 .753-1.659l-4.796-5.48a1 1 0 0 0-1.506 0z"/>
</svg>
</button>
<button onclick="moveCameraView('left')">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-caret-left-fill" viewBox="0 0 16 16">
<path d="m3.86 8.753 5.482 4.796c.646.566 1.658.106 1.658-.753V3.204a1 1 0 0 0-1.659-.753l-5.48 4.796a1 1 0 0 0 0 1.506z"/>
</svg>
</button>
<button onclick="moveCameraView('right')">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-caret-right-fill" viewBox="0 0 16 16">
<path d="m12.14 8.753-5.482 4.796c-.646.566-1.658.106-1.658-.753V3.204a1 1 0 0 1 1.659-.753l5.48 4.796a1 1 0 0 1 0 1.506z"/>
</svg>
</button>
</div>
<button id="button" class="bloque">Blur</button>
<button id="buttonB" class="bloque">Contrast</button>
</model-viewer>
<img class="viewerback" id="blah"/>
</div>
<!-- Content container -->
<!-- This is for holding some brief description about the 3D object -->
<div id="content">
<h2>3D KIT VIEWER</h2>
<div class="bouncing-text">
<p class="b">v</p>
<p class="o">.</p>
<p class="u">1</p>
<p class="n">.</p>
<p class="c">0</p>
<p class="e">.</p>
<p class="d">0</p>
</div>
<p>Online Web 3D Kit vizualizer!</p>
<script type="text/javascript" src="https://cdnjs.buymeacoffee.com/1.0.0/button.prod.min.js" data-name="bmc-button" style="overflow:visible;" data-slug="yegax" data-color="#FFDD00" data-emoji="" data-font="Bree" data-text="Buy me a coffee" data-outline-color="#000000" data-font-color="#000000" data-coffee-color="#ffffff" ></script>
<div class="gridcontent">
<input type="file" id="urlA">
<label for="urlA">Kit Texture</label>
<input type="file" onchange="readURL(this);" id="blah">
<label for="urlA">Background</label>
<input type="file" id="urlB">
<label for="urlA">Number</label>
<input type="file" id="urlC">
<label for="urlA">Name</label>
<div id="color-controls">
<label for="color-controls">Boots</label>
<button style="background-color: white;"></button>
<button style="background-color: rgb(255, 0, 0);" data-color="#ff0000"></button>
<button style="background-color: rgb(195, 255, 0);" data-color="#00ff00"></button>
<button style="background-color: rgb(43, 0, 255);" data-color="#0000ff"></button>
</div>
</div>
<i class="bi bi-box-arrow-down-right"></i>
</div>
</body>
<script
class="jsbin"
src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"
></script>
<script
class="jsbin"
src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.0/jquery-ui.min.js"
></script>
<script>
const modelViewerColor = document.querySelector("model-viewer#modelA");
document.querySelector('#color-controls').addEventListener('click', (event) => {
const colorString = event.target.dataset.color;
const material = modelViewerColor.model.materials[4];
material.pbrMetallicRoughness.setBaseColorFactor(colorString);
});
</script>
<script>
function readURL(input) {
if (input.files && input.files[0]) {
var reader = new FileReader();
reader.onload = function (e) {
$('#blah').attr('src', e.target.result);
};
reader.readAsDataURL(input.files[0]);
}
}
</script>
<script type="module">
document.getElementById("urlA").addEventListener("change", function() {
const file = this.files[0];
const viewer = document.getElementById("modelA");
if (!file) return;
const reader = new FileReader();
reader.addEventListener('load', async function() {
const texture = await viewer.createTexture(reader.result);
viewer.model.materials[0].pbrMetallicRoughness.baseColorTexture.setTexture(texture);
});
reader.readAsDataURL(file);
})
</script>
<script type="module">
document.getElementById("urlB").addEventListener("change", function() {
const file = this.files[0];
const viewer = document.getElementById("modelA");
if (!file) return;
const reader = new FileReader();
reader.addEventListener('load', async function() {
const texture = await viewer.createTexture(reader.result);
viewer.model.materials[6].pbrMetallicRoughness.baseColorTexture.setTexture(texture);
});
reader.readAsDataURL(file);
})
</script>
<script type="module">
document.getElementById("urlC").addEventListener("change", function() {
const file = this.files[0];
const viewer = document.getElementById("modelA");
if (!file) return;
const reader = new FileReader();
reader.addEventListener('load', async function() {
const texture = await viewer.createTexture(reader.result);
viewer.model.materials[8].pbrMetallicRoughness.baseColorTexture.setTexture(texture);
});
reader.readAsDataURL(file);
})
</script>
<script>
$("#button").click(function(){
$('#blah').removeClass("contimg");
$('#blah').toggleClass("blurimg");
});
</script>
<script>
$("#buttonB").click(function(){
$('#blah').removeClass("blurimg");
$('#blah').toggleClass("contimg");
});
</script>
<script>
function moveCameraView(perspective) {
const modelA = document.getElementById("modelA");
switch (perspective) {
case 'left':
modelA.cameraOrbit = '-90deg 75deg 4m';
break;
case 'right':
modelA.cameraOrbit = '90deg 75deg 4m';
break;
case 'top':
modelA.cameraOrbit = '90deg 0deg 4m';
break;
case 'front':
modelA.cameraOrbit = '0deg 75deg 4m';
break;
case 'back':
modelA.cameraOrbit = '180deg 75deg 4m';
break;
}
}
</script>
<script data-name="BMC-Widget" data-cfasync="false" src="https://cdnjs.buymeacoffee.com/1.0.0/widget.prod.min.js" data-id="yegax" data-description="Support me on Buy me a coffee!" data-message="" data-color="#FFDD00" data-position="Right" data-x_margin="18" data-y_margin="18"></script>
</html>