-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
136 lines (115 loc) · 8.52 KB
/
index.html
File metadata and controls
136 lines (115 loc) · 8.52 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
<!doctype html><html><head>
<title>Gravity</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
<link rel="stylesheet" href="./css/style.css"/>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="./js/jquery-1.12.4.min.js">\x3C/script>');</script>
<script>
var global = window;
global.JSCLASS_PATH = global.ROOT = './js/';
global.MYT_IMAGE_ROOT = global.GV_IMAGE_ROOT = './img/';
</script>
<script id="shader-fragment" type="x-shader/x-fragment">
#ifdef GL_OES_standard_derivatives
#extension GL_OES_standard_derivatives : enable
#endif
#define PI 3.14159265359
#define FIVE_SIXTHS_PI 2.61799382
#define TWO_PI 6.28318530718
precision mediump float;
//uniform vec2 u_resolution;
//uniform vec2 u_mouse;
//uniform float u_time;
varying vec4 vColor;
varying float vType;
varying float vRotation;
// Plot a line using a value between 0.0 - 1.0
float plotLine(float pct, float delta, float v) {
return smoothstep(pct - delta, pct, v) - smoothstep(pct, pct + delta, v);
}
float fill(float lower, float upper, float v) {
return 1.0 - smoothstep(lower, upper, v);
}
float polygon(vec2 pt, float rotation, float sides) {
float a = atan(pt.x, pt.y) - FIVE_SIXTHS_PI + rotation;
float k = TWO_PI / sides;
return cos(floor(0.5 + a / k) * k - a) * length(pt);
}
mat2 rotate2d(float a) {
return mat2(cos(a), -sin(a), sin(a), cos(a));
}
mat2 scale(vec2 scale) {
return mat2(scale.x, 0.0, 0.0, scale.y);
}
void main(void) {
float r = 0.0, alpha = 1.0;
// Shift point into a range of +/- 1.0
vec2 pt = 2.0 * gl_PointCoord - 1.0;
#ifdef GL_OES_standard_derivatives
if (vType < 0.1) {
// Render Type 0: Smooth Circle
r = dot(pt, pt);
alpha = fill(1.0 - fwidth(r), 1.0, r);
} else if (vType < 1.1) {
// Render Type 1: Fuzzy Circle
r = dot(pt, pt);
alpha = fill(0.0, 1.0, r);
} else if (vType < 2.1) {
// Render Type 2: Triangle filled (Ship)
r = polygon(pt, vRotation, 3.0);
alpha = fill(0.5 - fwidth(r), 0.5, r);
// Cut smaller triangle out of the tip
pt = scale(vec2(4.0)) * pt;
pt += vec2(cos(vRotation), sin(vRotation)) * -2.5;
r = polygon(pt, vRotation, 3.0);
alpha -= 1.0 * fill(0.5 - fwidth(r), 0.5, r);
} else {
// Render Type 3: Triangle Line with inset filled triangle (Ship Halo)
r = polygon(pt, vRotation, 3.0);
alpha = plotLine(0.5, 1.5 * fwidth(r), r);
// Add smaller triangle at the tip
//pt = scale(vec2(4.0)) * pt;
//pt += vec2(cos(vRotation), sin(vRotation)) * -2.5;
//r = polygon(pt, vRotation, 3.0);
//alpha += 0.75 * fill(0.5 - fwidth(r), 0.5, r);
}
#endif
gl_FragColor = vColor * alpha;
}
</script>
<script id="shader-vertex" type="x-shader/x-vertex">
precision mediump float;
attribute vec2 aVtxPosition;
attribute float aVtxRotation;
attribute vec4 aVtxColor;
attribute float aVtxSize;
attribute float aVtxType;
uniform vec2 u_resolution;
varying vec4 vColor;
varying float vType;
varying float vRotation;
void main(void) {
// convert the position from pixels to 0.0 to 1.0 then
// convert from 0->1 to -1->+1 (clipspace) finally flip y axis
gl_Position = vec4(((aVtxPosition / u_resolution) * 2.0 - 1.0) * vec2(1, -1), 0.0, 1.0);
gl_PointSize = aVtxSize;
vColor = aVtxColor;
vType = aVtxType;
vRotation = aVtxRotation;
}
</script>
<script src="./js/loader-browser.min.js"></script>
<script src="./js/manifest.js"></script>
</head><body>
<div id="appDiv" style="position:absolute;width:100%;height:100%;">
<div id="loader" style="position:absolute;top:50%;left:50%;"></div>
</div>
<script>
function hideSpinner(){if (spinner) spinner.stop();}
// Spin.js v1.3.0. Copyright (c) 2013 Felix Gnass [fgnass at neteye dot de]. Licensed under the MIT license
(function(t,e){if(typeof exports=="object")module.exports=e();else if(typeof define=="function"&&define.amd)define(e);else t.Spinner=e()})(this,function(){"use strict";var t=["webkit","Moz","ms","O"],e={},i;function o(t,e){var i=document.createElement(t||"div"),o;for(o in e)i[o]=e[o];return i}function n(t){for(var e=1,i=arguments.length;e<i;e++)t.appendChild(arguments[e]);return t}var r=function(){var t=o("style",{type:"text/css"});n(document.getElementsByTagName("head")[0],t);return t.sheet||t.styleSheet}();function s(t,o,n,s){var a=["opacity",o,~~(t*100),n,s].join("-"),f=.01+n/s*100,l=Math.max(1-(1-t)/o*(100-f),t),d=i.substring(0,i.indexOf("Animation")).toLowerCase(),u=d&&"-"+d+"-"||"";if(!e[a]){r.insertRule("@"+u+"keyframes "+a+"{"+"0%{opacity:"+l+"}"+f+"%{opacity:"+t+"}"+(f+.01)+"%{opacity:1}"+(f+o)%100+"%{opacity:"+t+"}"+"100%{opacity:"+l+"}"+"}",r.cssRules.length);e[a]=1}return a}function a(e,i){var o=e.style,n,r;if(o[i]!==undefined)return i;i=i.charAt(0).toUpperCase()+i.slice(1);for(r=0;r<t.length;r++){n=t[r]+i;if(o[n]!==undefined)return n}}function f(t,e){for(var i in e)t.style[a(t,i)||i]=e[i];return t}function l(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var o in i)if(t[o]===undefined)t[o]=i[o]}return t}function d(t){var e={x:t.offsetLeft,y:t.offsetTop};while(t=t.offsetParent)e.x+=t.offsetLeft,e.y+=t.offsetTop;return e}var u={lines:12,length:7,width:5,radius:10,rotate:0,corners:1,color:"#000",direction:1,speed:1,trail:100,opacity:1/4,fps:20,zIndex:2e9,className:"spinner",top:"auto",left:"auto",position:"relative"};function p(t){if(typeof this=="undefined")return new p(t);this.opts=l(t||{},p.defaults,u)}p.defaults={};l(p.prototype,{spin:function(t){this.stop();var e=this,n=e.opts,r=e.el=f(o(0,{className:n.className}),{position:n.position,width:0,zIndex:n.zIndex}),s=n.radius+n.length+n.width,a,l;if(t){t.insertBefore(r,t.firstChild||null);l=d(t);a=d(r);f(r,{left:(n.left=="auto"?l.x-a.x+(t.offsetWidth>>1):parseInt(n.left,10)+s)+"px",top:(n.top=="auto"?l.y-a.y+(t.offsetHeight>>1):parseInt(n.top,10)+s)+"px"})}r.setAttribute("role","progressbar");e.lines(r,e.opts);if(!i){var u=0,p=(n.lines-1)*(1-n.direction)/2,c,h=n.fps,m=h/n.speed,y=(1-n.opacity)/(m*n.trail/100),g=m/n.lines;(function v(){u++;for(var t=0;t<n.lines;t++){c=Math.max(1-(u+(n.lines-t)*g)%m*y,n.opacity);e.opacity(r,t*n.direction+p,c,n)}e.timeout=e.el&&setTimeout(v,~~(1e3/h))})()}return e},stop:function(){var t=this.el;if(t){clearTimeout(this.timeout);if(t.parentNode)t.parentNode.removeChild(t);this.el=undefined}return this},lines:function(t,e){var r=0,a=(e.lines-1)*(1-e.direction)/2,l;function d(t,i){return f(o(),{position:"absolute",width:e.length+e.width+"px",height:e.width+"px",background:t,boxShadow:i,transformOrigin:"left",transform:"rotate("+~~(360/e.lines*r+e.rotate)+"deg) translate("+e.radius+"px"+",0)",borderRadius:(e.corners*e.width>>1)+"px"})}for(;r<e.lines;r++){l=f(o(),{position:"absolute",top:1+~(e.width/2)+"px",transform:e.hwaccel?"translate3d(0,0,0)":"",opacity:e.opacity,animation:i&&s(e.opacity,e.trail,a+r*e.direction,e.lines)+" "+1/e.speed+"s linear infinite"});if(e.shadow)n(l,f(d("#000","0 0 4px "+"#000"),{top:2+"px"}));n(t,n(l,d(e.color,"0 0 1px rgba(0,0,0,.1)")))}return t},opacity:function(t,e,i){if(e<t.childNodes.length)t.childNodes[e].style.opacity=i}});function c(){function t(t,e){return o("<"+t+' xmlns="urn:schemas-microsoft.com:vml" class="spin-vml">',e)}r.addRule(".spin-vml","behavior:url(#default#VML)");p.prototype.lines=function(e,i){var o=i.length+i.width,r=2*o;function s(){return f(t("group",{coordsize:r+" "+r,coordorigin:-o+" "+-o}),{width:r,height:r})}var a=-(i.width+i.length)*2+"px",l=f(s(),{position:"absolute",top:a,left:a}),d;function u(e,r,a){n(l,n(f(s(),{rotation:360/i.lines*e+"deg",left:~~r}),n(f(t("roundrect",{arcsize:i.corners}),{width:o,height:i.width,left:i.radius,top:-i.width>>1,filter:a}),t("fill",{color:i.color,opacity:i.opacity}),t("stroke",{opacity:0}))))}if(i.shadow)for(d=1;d<=i.lines;d++)u(d,-2,"progid:DXImageTransform.Microsoft.Blur(pixelradius=2,makeshadow=1,shadowopacity=.3)");for(d=1;d<=i.lines;d++)u(d);return n(e,l)};p.prototype.opacity=function(t,e,i,o){var n=t.firstChild;o=o.shadow&&o.lines||0;if(n&&e+o<n.childNodes.length){n=n.childNodes[e+o];n=n&&n.firstChild;n=n&&n.firstChild;if(n)n.opacity=i}}}var h=f(o("group"),{behavior:"url(#default#VML)"});if(!a(h,"transform")&&h.adj)c();else i=a(h,"animation");return p});
var spinner = Spinner({radius:64,lines:24,length:16,width:4,color:'#00ff00'});
spinner.spin(document.getElementById('loader'));
JS.require('gv.all', function() {new gv.App(document.getElementById("appDiv"));});
</script>
</body></html>