-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
157 lines (137 loc) · 4.64 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
<!DOCTYPE html>
<html lang="en">
<head>
<title>XR.js | JavaScript XR Library</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
<meta name="keywords" content="WebXR, ThreeJS, XR.js, VR, AR, JavaScript" />
<meta name="description" content="JavaScript library for XR experiences. 🥽" />
<link type="text/css" rel="stylesheet" href="/css/main.css" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-title" content="XR.js" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<link rel="apple-touch-icon" sizes="152x152" href="/assets/img/icon/152.png?v=2" type="image/png" />
<link rel="apple-touch-icon" sizes="167x167" href="/assets/img/icon/167.png?v=2" type="image/png" />
<link rel="apple-touch-icon" sizes="180x180" href="/assets/img/icon/180.png?v=2" type="image/png" />
<link rel="apple-touch-icon" sizes="256x256" href="/assets/img/icon/256.png?v=2" type="image/png" />
</head>
<body>
<header>
<h1><a href="/">XR.js</a> 🥽</h1>
<p>
<a href="/examples/">Examples</a>
<a href="https://github.com/xrscript/XR.js/wiki">Wiki</a>
<a href="https://github.com/xrscript/XR.js">GitHub</a>
</p>
</header>
<script type="module">import * as XR from '/XR.js';
// setup XR.js session
new XR.Reality({
physics:false
});
new XR.Light();
new XR.Floor();
// skyboxes
var imgs = [
'/assets/img/equirectangular/venice_sunset.jpg',
'/assets/img/equirectangular/royal_esplanade.jpg',
'/assets/img/equirectangular/quarry.jpg',
'/assets/img/equirectangular/bridge.jpg',
'/assets/img/equirectangular/earth.jpg',
'/assets/img/equirectangular/sky2.jpg',
'/assets/img/planets/earth.jpg',
'/assets/img/planets/jupiter.jpg',
'/assets/img/planets/mars.jpg',
'/assets/img/planets/mercury.jpg',
'/assets/img/planets/moon.jpg',
'/assets/img/planets/saturn.jpg',
'/assets/img/planets/stars.jpg',
'/assets/img/planets/sun.jpg',
'/assets/img/planets/stars_milky_way.jpg',
'/assets/img/planets/uranus.jpg',
];
// load a random sky
var item = imgs[Math.floor(Math.random() * imgs.length)];
new XR.Sky({file:item});
// create XR.js logo
new XR.Text({
text:'XR.js',
thickness: 0.2,
color:0xff0000,
font:'/assets/fonts/helvetiker_bold.json',
position:[0.1,0.5,-3],
bevel:true
});
// create dropdown menus
new XR.Dropdown({
position:[-3,1,-7],
options:[
{ name:'Models', href:'/examples/objects/model/', action: openLink },
{ name:'Physics', href:'/examples/physics/', action: openLink },
{ name:'Animation', href:'/examples/animate/', action: openLink }
]
});
new XR.Dropdown({
position:[-1,1,-7],
options:[
{ name:'Walk', href:'/examples/locomotion/walk.html', action: openLink },
{ name:'Fly', href:'/examples/locomotion/fly.html', action: openLink },
{ name:'Teleport', href:'/examples/locomotion/teleport.html', action: openLink }
]
});
new XR.Dropdown({
position:[1,1,-7],
options:[
{ name:'Button', href:'/examples/ui/button.html', action: openLink },
{ name:'Dropdown', href:'/examples/ui/dropdown.html', action: openLink },
{ name:'Text', href:'/examples/ui/text.html', action: openLink }
]
});
new XR.Dropdown({
position:[3,1,-7],
options:[
{ name:'Light', href:'/examples/objects/light/', action: openLink },
{ name:'Geometry', href:'/examples/objects/geometry/', action: openLink },
{ name:'Models', href:'/examples/objects/model/', action: openLink }
]
});
new XR.Dropdown({
position:[5,1,-7],
options:[
{ name:'Examples', href:'/examples/', action: openLink },
{ name:'Wiki', href:'https://github.com/xrscript/XR.js/wiki', action: openLink },
{ name:'GitHub', href:'https://github.com/xrscript/XR.js/', action: openLink }
]
});
var current;
setTimeout(function(){ if (current){ window.location.assign(current); } }, 220);
function openLink(e,href){
current = href;
window.location.replace(href);
}
// setup controller and pointer
var controller = new XR.Gamepad();
new XR.Pointer({ bind: controller.right });
// add confetti text
var phrases = [
'XRscript',
'I <3 VR',
'hello world',
'hire me elon pls',
'hi mom'
];
// create 100 confetti phrases
for ( let i = 0; i < 100; i ++ ) {
var options = {
text:phrases[Math.floor(Math.random() * phrases.length)],
size: 0.025,
color: 0xffffff * Math.random(),
position:[Math.random() * 10 - 5, Math.random() * 10 - 5, Math.random() * 10 - 5],
rotation:[Math.random() * 2 - 1, Math.random() * 2 - 1, Math.random() * 2 - 1],
thickness:0.0001
}
new XR.Text(options);
}
</script>
</body>
</html>