forked from pchen66/panolens.js
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
151 lines (115 loc) · 5.3 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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width, shrink-to-fit=no">
<title>Panolens.js Development Example</title>
<style>
html, body {
margin: 0;
width: 100%;
height: 100%;
overflow: hidden;
background-color: #000;
}
#panolens-separate-container {
position: absolute;
width: 300px;
height: 150px;
right: 0;
top: 100px;
}
#panolens-separate-container:-webkit-full-screen{
left: 0;
top: 0;
}
#panolens-separate-container:-moz-full-screen{
left: 0;
top: 0;
}
#panolens-separate-container:-ms-fullscreen{
left: 0;
top: 0;
}
#panolens-separate-container:fullscreen {
left: 0;
top: 0;
}
</style>
</head>
<body>
<script src="../node_modules/three/build/three.min.js"></script>
<script src="../build/panolens.js"></script>
<div id="panolens-separate-container"></div>
<script>
var panorama_main_video, panorama_main_video2, panorama_main_image, viewer_main;
var panorama_side_image, viewer_side;
var infospot1, infospot2, infospot3;
// Main panorama
viewer_main = new PANOLENS.Viewer({ enableReticle: false, output: 'console', viewIndicator: true, autoRotate: false, autoRotateSpeed: 2, autoRotateActivationDuration: 5000, dwellTime: 1000 });
const logEvent = ( { type } ) => console.log( type );
viewer_main.reticle.addEventListener('reticle-start', logEvent );
viewer_main.reticle.addEventListener('reticle-update', logEvent );
viewer_main.reticle.addEventListener('reticle-end', logEvent );
viewer_main.reticle.addEventListener('reticle-ripple-start', logEvent );
viewer_main.reticle.addEventListener('reticle-ripple-end', logEvent );
panorama_main_video = new PANOLENS.VideoPanorama( 'asset/textures/video/ClashofClans.mp4', { autoplay: true, muted: false });
var cube = new THREE.Mesh( new THREE.BoxGeometry(50, 50, 50), new THREE.MeshNormalMaterial() );
cube.position.set(1000, 0, 0);
panorama_main_video.add( cube );
panorama_main_video.addEventListener( 'progress',function(e){
console.log(e.progress);
});
panorama_main_video2 = new PANOLENS.VideoPanorama( 'asset/textures/video/1941-battle-low.mp4', { autoplay: false, muted: true });
panorama_main_video2.setLinkingImage( 'asset/textures/1941-battle-thumb.png' );
panorama_main_video2.addEventListener( 'progress',function(e){
console.log(e.progress);
});
panorama_main_image = new PANOLENS.ImagePanorama( 'asset/textures/equirectangular/road.jpg' );
panorama_main_image.addEventListener( 'progress',function(e){
console.log(e.progress);
});
panorama_main_video.link( panorama_main_video2, new THREE.Vector3( -3260.34, -700.96, -3017.16 ) );
panorama_main_video2.link( panorama_main_video, new THREE.Vector3( -2358.58, 1205.94, -3626.21 ) );
panorama_main_video.link( panorama_main_image, new THREE.Vector3( 4464.14, 364.49, 393.76 ) );
panorama_main_image.link( panorama_main_video, new THREE.Vector3( 2630.30, 132.81, 3643.93 ) );
infospot2 = new PANOLENS.Infospot( 350, PANOLENS.DataImage.Info );
infospot2.position.set( -1294.60, 181.52, -4298.10 );
infospot2.addHoverText( 'Hovering Infospot' );
panorama_main_image.add( infospot2 );
infospot1 = new PANOLENS.Infospot( 350, PANOLENS.DataImage.Info );
infospot1.position.set( 3187.12, 1036.61, -2996.43 );
infospot1.addHoverText( 'Mountain Tip' );
infospot1.addEventListener( 'click', function(){
viewer_main.tweenControlCenterByObject( cube );
} );
panorama_main_video.add( infospot1 );
viewer_main.add( panorama_main_video, panorama_main_image, panorama_main_video2 );
// Test repeated scenario
viewer_main.enableControl( PANOLENS.CONTROLS.DEVICEORIENTATION );
viewer_main.enableEffect( PANOLENS.MODES.CARDBOARD );
viewer_main.enableControl( PANOLENS.CONTROLS.ORBIT );
viewer_main.enableEffect( PANOLENS.MODES.NORMAL );
// Side panorama
viewer_side = new PANOLENS.Viewer({ output: 'overlay', container: document.querySelector( '#panolens-separate-container' ) });
//panorama_side_image = new PANOLENS.ImagePanorama( 'asset/textures/equirectangular/sunset.jpg' );
panorama_side_image = new PANOLENS.ImageLittlePlanet( 'asset/textures/equirectangular/field.jpg' );
//panorama_side_image = new PANOLENS.GoogleStreetviewPanorama( 'JmSoPsBPhqWvaBmOqfFzgA' );
infospot3 = new PANOLENS.Infospot( 350, PANOLENS.DataImage.Info );
infospot3.position.set( 100.92, -37.84, -1637.81 );
infospot3.addHoverText( 'Hovering Infospot', -20 );
panorama_side_image.add( infospot3 );
viewer_side.add( panorama_side_image );
var item = viewer_main.appendControlItem( {
style : {
backgroundImage : 'url(asset/textures/equirectangular/sunset.jpg)',
float: 'left'
},
onTap: function(){
viewer_main.setPanorama( panorama_main_image );
},
group: 'video'
} );
</script>
</body>
</html>