forked from krikienoid/flagwaver
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
184 lines (163 loc) · 8.06 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
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
<!DOCTYPE html>
<html lang="en-US">
<head>
<!-- Meta -->
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="description" content="Simulate a flag waving in the breeze right in your browser window." />
<!--
Flag Waver
Simulate a flag waving in the breeze right in your browser window.
-->
<title>Online Flag Waver</title>
<!-- Libraries -->
<link type="text/css" rel="stylesheet" href="css/normalize.min.css" />
<link type="text/css" rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans:400,600" />
<script type="text/javascript" src="js/jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="js/three.min.js"></script>
<script type="text/javascript" src="js/modernizr.custom.95719.js"></script>
<script type="text/javascript" src="js/rivets.bundled.min.js"></script>
<!-- Main -->
<link type="text/css" rel="stylesheet" href="css/flagwaver-ui.css" />
<script type="text/javascript" src="js/hashvars.js"></script>
<script type="text/javascript" src="js/flagwaver.js"></script>
<script type="text/javascript" src="js/flagwaver-ui.js"></script>
</head>
<body>
<div class="wrapper-page bg-sky">
<header class="page-header">
<h1>Flag Waver</h1>
</header>
<main class="page-main">
<div class="js-flag-canvas"></div>
</main>
<aside class="page-controls">
<div class="page-controls-basic">
<div class="page-controls-group page-controls-wide">
<h2>Upload Image</h2>
<div class="input-control-group control-img-upload" id="control-img-upload">
<div class="input-btn-group">
<select
class="input-control input-btn input-select"
aria-label="Upload image from"
data-rv-value="flagWaverOpts.flag.imgUploadMode"
data-rv-on-change="flagWaverControls.flag.setImgUploadMode"
id="set-img-upload-mode"
>
<option value="web">Web</option>
<option value="file">File</option>
</select>
</div>
<input
type="text"
class="input-control input-control-main input-img-web"
placeholder="Enter image URL"
aria-label="Enter image URL"
data-rv-value="flagWaverOpts.flag.imgURL"
id="input-img-link"
/>
<div class="input-btn-group input-img-web">
<input
type="button"
class="input-control input-btn"
value="Go!"
data-rv-on-click="flagWaverControls.flag.setImgURL"
id="set-img-link"
/>
</div>
<div class="input-control input-control-main input-file input-img-file">
<label
class="input-cover input-face"
for="open-img-file"
data-rv-text="flagWaverOpts.flag.imgFilePath | fileName 'Open a file'"
id="info-img-file"
></label>
<input
type="file"
class="input-cover input-hidden"
accept="image/*"
data-rv-on-change="flagWaverControls.flag.setImgFile"
id="open-img-file"
/>
</div>
</div>
</div>
<div class="page-controls-group">
<input
type="button"
class="expander input-control input-btn"
data-target="#expandable-controls"
data-text-expanded="Hide Options"
data-text-collapsed="More Options"
aria-expanded="false"
aria-controls="expandable-controls"
/>
</div>
</div>
<div class="page-controls-more expandable" aria-hidden="true" id="expandable-controls">
<div class="page-controls-group">
<h2>Wind</h2>
<input
type="button"
class="input-control input-btn input-btn-md"
data-text-selected="Wind: On"
data-text-unselected="Wind: Off"
data-rv-value="flagWaverOpts.isWindOn | onoff 'Wind On' 'Wind Off'"
data-rv-on-click="flagWaverControls.toggleWind"
id="wind-toggle"
/>
</div>
<div class="page-controls-group">
<h2>Hoisting</h2>
<select
class="input-control input-btn input-select"
aria-label="Hoist side"
data-rv-value="flagWaverOpts.flag.hoisting"
data-rv-on-change="flagWaverControls.flag.setHoisting"
id="set-hoisting"
>
<option value="dexter">Dexter</option>
<option value="sinister">Sinister</option>
</select>
<select
class="input-control input-btn input-select"
aria-label="Hoist top edge"
data-rv-value="flagWaverOpts.flag.topEdge"
data-rv-on-change="flagWaverControls.flag.setTopEdge"
id="set-top-edge"
>
<option value="top">Top</option>
<option value="left">Left</option>
<option value="bottom">Bottom</option>
<option value="right">Right</option>
</select>
</div>
</div>
</aside>
</div>
</body>
<script type="x-shader/x-fragment" id="fragmentShaderDepth">
uniform sampler2D texture;
varying vec2 vUV;
vec4 pack_depth( const in float depth ) {
const vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );
const vec4 bit_mask = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );
vec4 res = fract( depth * bit_shift );
res -= res.xxyz * bit_mask;
return res;
}
void main() {
vec4 pixel = texture2D( texture, vUV );
if ( pixel.a < 0.5 ) discard;
gl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );
}
</script>
<script type="x-shader/x-vertex" id="vertexShaderDepth">
varying vec2 vUV;
void main() {
vUV = 0.75 * uv;
vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );
gl_Position = projectionMatrix * mvPosition;
}
</script>
</html>