-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexhibition_composite.html
More file actions
572 lines (402 loc) · 16.9 KB
/
exhibition_composite.html
File metadata and controls
572 lines (402 loc) · 16.9 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
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
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
<html>
<title>Industrial Exhibition - A Composite Model</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<style>
body {
margin: 0;
font-family: Arial, Helvetica, sans-serif;
color: grey;
width: auto;
height: auto;
perspective: 1000px;
overflow: hidden;
}
.header {
border-bottom: 1px solid grey;
color: black;
text-align: center;
padding: 30px 0;
font-weight: 100;
display: flex;
align-items: center;
}
.header>span {
margin: 0 30px;
}
.header>span.active {
color: rgb(0, 145, 255);
}
.img {
width: 100%;
height: 100%;
background-position: center center;
background-repeat: no-repeat;
background-size: cover;
}
.section {
/*transition: transform 2s, opacity 2s;*/
display: flex;
}
.web {
display: block !important;
}
.building {
background-image: url("./img/building.jpeg");
background-color: gray;
width: 50%;
height: 100%;
}
.text {
background-color: ;
}
.subtitle>div {
margin: 10px;
font-size: 20px;
text-align: center;
}
.office {
background-image: url("./img/office.jpeg");
background-color: gray;
}
.injection {
background-image: url("./img/workshop-injection.jpeg");
background-color: gray;
}
.mold {
background-image: url("./img/workshop-mold.jpeg");
background-color: gray;
}
/* booth */
.intro {
width: 50%;
overflow: scroll;
}
.intro>div {
margin: 50px 30px;
}
.wrapper {
perspective: 1200px;
perspective-origin: center;
}
.section-one {
background-color: white;
}
.section-two {
background-color: #eee;
}
.section-three {
background-color: skyblue;
}
.subtitle {
width: 20%;
}
.console {
position: absolute;
z-index: 99;
display: none;
}
</style>
<body id="bd">
<div class="console">console area</div>
<div class="header">
<span class="mode">网页版</span>
<span class="mode active">展位版</span>
</div>
<div class="wrapper">
<div class="section section-one">
<div class="img building"></div>
<div class="text intro">
<div>
宁波北仑伟煌(WEIHUANG)精密模塑有限公司始建于2013年5月,集高精模具设计与制造、产品开发为一体的企业,专业为客户提供一整套模具产品解决方案,是国内优秀的专业模具制造商之一。公司位于享有中国模具之乡美誉的宁波市北仑区,毗邻北仑港,交通便利。公司致力于家用电器、汽车部件,医疗产品等产品模具的设计开发,拥有强大的CAD/CAM/CAE专业模具设计团队,并先后聘请数位德国相关专家对我司的设计队伍、工程技术人员进行专业
指导培训,促进我司在模具设计理念,加工工艺,模具精度方面有很 大的提升。<br><br>
公司引进一流的加工设备和检测设备,配备专业的操作团队,确保模具制程的每个环节得到切实的受控,从而满足高效、高品质制作要求。<br><br>
目前公司模具主要出口欧洲和日本,是德国凯驰 、 日本三洋的长期合作伙伴。
</div>
</div>
</div>
<div class="section section-two">
<div class="img workshop office"></div>
<div class="text subtitle">
<div>办公区域</div>
</div>
<div class="img workshop injection"></div>
<div class="text subtitle">
<div>注塑车间</div>
</div>
<div class="img workshop mold"></div>
<div class="text subtitle">
<div>模具车间</div>
</div>
</div>
<div class="section section-three">
<div class="img "></div>
<div class="text subtitle">
<div>服务流程</div>
</div>
</div>
</div>
</body>
<script>
const bd = document.getElementById('bd');
const section = document.getElementsByClassName("section");
const modeWeb = document.getElementsByClassName("mode")[0];
const modeBooth = document.getElementsByClassName("mode")[1];
const wrapper = document.getElementsByClassName("wrapper")[0];
const imgs = document.getElementsByClassName("img");
const texts = document.getElementsByClassName("text");
let distance = -1000;
let rotation = 0;
let adjustY, adjustZ;
let isWeb;
let isInside;
let x1, x2;
let delta0, delta1;
function switchToWeb() {
section[0].style.transition = "transform 1.5s";
section[1].style.transition = "transform 1.5s";
section[2].style.transition = "transform 1.5s";
isWeb = true;
modeWeb.className += " active";
modeBooth.className = "mode";
wrapper.style.display = "block";
wrapper.style.perspective = "";
section[0].style.transform = "";
section[1].style.transform = "";
section[2].style.transform = "";
section[0].style.position = "";
section[1].style.position = "";
section[2].style.position = "";
section[0].style.width = "100%";
section[1].style.width = "100%";
section[2].style.width = "100%";
section[0].style.zIndex = "";
section[1].style.zIndex = "";
section[2].style.zIndex = "";
section[0].parentElement.style.transform = '';
bd.style.overflow = "scroll";
//details:
texts[0].style.border = "";
section[0].style.display = "block";
section[1].style.display = "block";
section[2].style.display = "block";
section[0].style.height = 'auto';
section[1].style.height = 'auto';
section[2].style.height = 'auto';
document.getElementsByClassName('intro')[0].style.width = "100%";
document.getElementsByClassName('building')[0].style.width = "100%";
window.removeEventListener('resize', onResize, false);
window.removeEventListener('mousedown', onMouseDown, false);
window.removeEventListener('mouseup', onMouseUp, false);
window.removeEventListener('wheel', onMouseWheel, { passive: false });
window.removeEventListener('touchstart', onTouchStart, false);
document.removeEventListener('gesturestart', function (event) { event.preventDefault() }, false);
}
function switchToBooth() {
isWeb = false;
modeBooth.className += " active";
modeWeb.className = "mode";
wrapper.style.display = "block";
//details:
section[0].style.display = "flex";
section[1].style.display = "flex";
section[2].style.display = "flex";
document.getElementsByClassName('intro')[0].style.width = "50%";
document.getElementsByClassName('building')[0].style.width = "50%";
renderBooth();
}
function renderBooth() {
section[0].style.position = "absolute";
section[1].style.position = "absolute";
section[2].style.position = "absolute";
onResize();
bd.style.overflow = "hidden";
texts[0].style.border = "2px solid rgb(0, 145, 255)";
//setTimeout(() => {
section[0].style.transition = "";
section[1].style.transition = "";
section[2].style.transition = "";
window.addEventListener('resize', onResize, false);
window.addEventListener('mousedown', onMouseDown, false);
window.addEventListener('mouseup', onMouseUp, false);
window.addEventListener('wheel', onMouseWheel, { passive: false });
window.addEventListener('touchstart', onTouchStart, false);
document.addEventListener('gesturestart', function (event) { event.preventDefault() }, false);
//}, 1500);
}
function onResize() {
const width = window.innerWidth;
const height = window.innerHeight;
section[0].parentElement.style.perspective = width * 2 + 'px';
section[0].parentElement.style.transform = 'translateZ(' + distance + 'px)';
const boardWidth = width;
const boardHeight = width * 5 / 8;
section[0].style.width = boardWidth;
section[0].style.height = boardHeight;
section[1].style.width = boardWidth;
section[1].style.height = boardHeight;
section[2].style.width = boardWidth;
section[2].style.height = boardHeight;
section[0].parentElement.style.perspectiveOrigin = `center ${height / 2}px`;
section[0].style.transformOrigin = `center center ${boardWidth * 0.5}px`;
section[1].style.transformOrigin = `center center ${boardWidth * 0.5}px`;
section[2].style.transformOrigin = `center center ${boardWidth * 0.5}px`;
adjustY = (height - boardHeight) / 2;
adjustZ = -boardWidth * 0.8;
renderCSS();
}
function onMouseDown(e) {
window.addEventListener('mousemove', onMouseMove, false);
x1 = e.clientX;
}
function onMouseMove(e) {
x2 = e.clientX;
rotate();
renderCSS();
x1 = x2;
}
function renderCSS() {
section[0].style.transform = `translate3d(0px, ${adjustY}px, ${adjustZ}px) `;
section[0].style.transform += `rotate3d(0, 1, 0, ${(rotation + 90)}deg)`;
section[1].style.transform = `translate3d(0px, ${adjustY}px, ${adjustZ}px) `;
section[1].style.transform += `rotate3d(0, 1, 0, ${rotation}deg)`;
section[2].style.transform = `translate3d(0px, ${adjustY}px, ${adjustZ}px) `;
section[2].style.transform += `rotate3d(0, 1, 0, ${(rotation - 90)}deg)`;
}
function rotate() {
rotation += (x2 - x1) / 10;
rotation %= 360;
document.getElementsByClassName('console')[0].innerText = rotation;
if (!isInside) {
section[0].style.display = "";
section[2].style.display = "";
if (rotation < -12.5) {
//section[2].style.opacity = "0.3";
section[2].style.zIndex = "3";
section[1].style.zIndex = "2";
section[0].style.zIndex = "1";
if (rotation < -102.5) {
//section[1].style.opacity = "0.3";
section[1].style.zIndex = "3";
section[2].style.zIndex = "2";
section[0].style.zIndex = "1";
if (rotation < -192.5) {
//section[0].style.opacity = "0.3";
section[0].style.zIndex = "3";
section[2].style.zIndex = "1";
section[1].style.zIndex = "2";
/*
if(rotation< -347.5) {
section[0].style.opacity = "1";
section[1].style.opacity = "1";
section[2].style.opacity = "1";
}
*/
}
}
}
else if (rotation > 12.5) {
section[0].style.zIndex = "3";
section[1].style.zIndex = "2";
section[2].style.zIndex = "1";
if (rotation > 167.5) {
section[0].style.zIndex = "1";
section[1].style.zIndex = "3";
section[2].style.zIndex = "2";
if (rotation > 257.5) {
section[0].style.zIndex = "1";
section[1].style.zIndex = "2";
section[2].style.zIndex = "3";
}
}
}
} else {
rotation = Math.min(90, Math.max(-90, rotation));
if (rotation > 12.5) {
section[0].style.display = "none";
} else {
section[0].style.display = "";
}
if (rotation < -12.5) {
section[2].style.display = "none";
} else {
section[2].style.display = "";
}
}
}
function zoom() {
//distance = Math.max(-3000, Math.min(0, distance));
section[0].parentElement.style.transform = 'translateZ(' + distance + 'px)';
}
function onMouseUp() {
x1 = 0;
x2 = 0;
window.removeEventListener('mousemove', onMouseMove, false);
}
function onMouseWheel(e) {
if (!isWeb) {
e.preventDefault();
distance -= e.deltaY;
document.getElementsByClassName("console")[0].innerHTML = distance;
if (distance > -window.innerWidth / 2) {
isInside = true;
} else {
isInside = false;
}
zoom();
}
}
function onTouchStart(e) {
if (!isWeb) {
e.preventDefault();
switch (e.targetTouches.length) {
case 1:
x1 = e.pageX;
break;
default:
const deltaX = e.targetTouches[0].pageX - e.targetTouches[1].pageX;
const deltaY = e.targetTouches[0].pageY - e.targetTouches[1].pageY;
delta0 = Math.sqrt(deltaX * deltaX + deltaY * deltaY);
document.getElementsByClassName("console")[0].innerText = delta0;
break;
}
window.addEventListener('touchmove', onTouchMove, false);
window.addEventListener('touchend', onTouchEnd, false);
}
}
function onTouchMove(e) {
if (!isWeb) {
e.preventDefault();
switch (e.targetTouches.length) {
case 1:
x2 = e.pageX;
rotate();
renderCSS();
x1 = x2;
break;
default:
const deltaX = e.targetTouches[0].pageX - e.targetTouches[1].pageX;
const deltaY = e.targetTouches[0].pageY - e.targetTouches[1].pageY;
if (!delta0) {
delta0 = Math.sqrt(deltaX * deltaX + deltaY * deltaY);
} else {
delta1 = Math.sqrt(deltaX * deltaX + deltaY * deltaY);
distance += (delta1 - delta0) * 5;
//distance = Math.max(-1600, Math.min(400, distance));
//section[0].parentElement.style.transform = 'translateZ(' + distance + 'px)';
zoom();
delta0 = delta1;
}
break;
}
}
}
function onTouchEnd() {
window.removeEventListener('touchmove', onTouchMove, false);
window.removeEventListener('touchend', onTouchEnd, false);
}
renderBooth();
modeWeb.addEventListener('pointerdown', switchToWeb, false);
modeBooth.addEventListener('pointerdown', switchToBooth, false);
</script>
</html>