This repository has been archived by the owner on Mar 21, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathindex.html
executable file
·154 lines (127 loc) · 4.69 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
<!DOCTYPE html>
<html lang="en">
<head>
<title>WebVR Mouse Experiment</title>
<meta charset="utf-8">
<style>
body {
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
color: #eee;
overflow: hidden;
background: rgb(40, 40, 40);
height: 100%;
width: 100%;
margin: 0px;
padding: 0px;
/* for all svg icons */
fill: rgba(200, 200, 200, 0.5);
}
canvas {
width: 100% !important;
height: 100% !important;
position: absolute;
top: 0;
left: 0;
}
#video {
display: none;
}
#controls {
position: absolute;
bottom: 20px;
left: 20px;
padding: 20px;
background-color: rgba(80, 80, 80, 0.6);
z-index: 2;
}
#info {
z-index: 100;
position: absolute;
left: 10px;
top: 10px;
border-radius: 5px;
box-sizing: border-box;
}
#info.open {
background-color: rgba(20, 20, 20, 0.5);
}
#info > article {
display: none;
margin: 0 0 0 40px;
padding: 10px;
width: 350px;
font-size: 14px;
text-shadow: 0 1px 0 rgba( 255,255,255,.2 ), 0 -1px 0 rgba( 0,0,0,.2 );
}
#info > article a,
#info > article a:visited {
color: #eee;
}
#info.open > article {
display: block;
}
#infobutton {
width: 20px;
height: 20px;
margin: 10px;
float: left;
cursor: pointer;
}
h1 {
font-size: 16px;
margin: 0 0 4px;
}
</style>
</head>
<body>
<div id="controls">
<button id="vr" disabled>VR</button>
</div>
<div id="info">
<svg version="1.1" id="infobutton" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="112px" height="112px" viewBox="0 0 112 112" enable-background="new 0 0 112 112" xml:space="preserve">
<g>
<path d="M60.361,28.418c-0.563-0.434-1.214-0.742-1.97-0.915c-0.741-0.172-1.544-0.261-2.389-0.261
c-0.851,0-1.652,0.089-2.414,0.261c-0.76,0.173-1.422,0.481-1.987,0.915c-0.56,0.435-1.003,1.012-1.33,1.723
c-0.327,0.714-0.485,1.604-0.485,2.679c0,1.05,0.164,1.932,0.485,2.655c0.327,0.724,0.767,1.312,1.33,1.745
c0.565,0.435,1.228,0.751,1.987,0.934c0.761,0.187,1.563,0.28,2.414,0.28c0.845,0,1.646-0.095,2.389-0.28
c0.756-0.183,1.404-0.504,1.97-0.934c0.56-0.434,1.013-1.018,1.349-1.745c0.336-0.72,0.504-1.605,0.504-2.655
c0-1.073-0.168-1.969-0.504-2.679C61.374,29.43,60.921,28.852,60.361,28.418z"></path>
<rect x="50.271" y="42.912" width="11.419" height="41.846"></rect>
</g>
<path d="M56,0C25.074,0,0,25.074,0,56s25.074,56,56,56s56-25.074,56-56S86.926,0,56,0z M56,102.666
C30.227,102.666,9.333,81.773,9.333,56C9.333,30.226,30.227,9.333,56,9.333S102.666,30.226,102.666,56
C102.666,81.773,81.773,102.666,56,102.666z"></path>
</svg>
<article>
<h1>WebVR Mouse Experiment</h1>
<p>This demonstrates an experimental virtual reality mouse interaction where the mouse cursor (the white circle) is de-coupled from head movement. Moving the mouse left and right moves the cursor in a circle around the user. Moving forward and back moves the cursor vertically. The distance of the cursor is either determined by the mouse wheel or projected onto the nearest object in a given direction.</p>
<p>Load this site in an experimental WebVR build of either <a href="http://blog.bitops.com/blog/2014/08/20/updated-firefox-vr-builds/" target="_new">Firefox</a> or <a href="http://blog.tojicode.com/2014/07/bringing-vr-to-chrome.html" target="_new">Chrome</a>. When the Rift is connected, hit the "Enter" key or click the "VR" button to enter full-screen VR mode. Hit "Escape" to exit VR and release the mouse cursor.</p>
<p>Code by <a href="http://chirls.com">Brian Chirls</a> is available on <a href="https://github.com/povdocs/webvr-mouse/">GitHub</a>.</p>
</article>
</div>
<script type="x-shader/x-vertex" id="vertexShader">
varying vec3 vWorldPosition;
void main() {
vec4 worldPosition = modelMatrix * vec4( position, 1.0 );
vWorldPosition = worldPosition.xyz;
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
}
</script>
<script type="x-shader/x-fragment" id="fragmentShader">
uniform vec3 topColor;
uniform vec3 bottomColor;
uniform float offset;
uniform float exponent;
varying vec3 vWorldPosition;
void main() {
float h = normalize( vWorldPosition + offset ).y;
gl_FragColor = vec4( mix( bottomColor, topColor, max( pow( max( h, 0.0 ), exponent ), 0.0 ) ), 1.0 );
}
</script>
<script src="js/lib/three.js"></script>
<script src="js/lib/VRStereoEffect.js"></script>
<script src="js/lib/VRControls.js"></script>
<script src="js/VRMouse.js"></script>
<script src="js/script.js" type="text/javascript"></script>
</body>
</html>