-
Notifications
You must be signed in to change notification settings - Fork 2
/
particles.html
executable file
·84 lines (51 loc) · 1.8 KB
/
particles.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
<!DOCTYPE html>
<html>
<head>
<title>Particles</title>
<meta name="viewpoint" content="width=device-width, initial-scale=1">
<meta name="description" content="WebGL Particle Effects">
<meta charset="UTF-8">
<link rel="stylesheet" href="css/main.css"> <!-- CSS before JS! -->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-68565272-1', 'auto');
ga('send', 'pageview', location.pathname);
</script>
</head>
<!-- Body -->
<body class="webgl-body">
<!-- HEADER -->
<ul class="section-nav" id="section-header">
<li><a href="/">Home</a></li>
<li><a href="/#section-projects">Projects</a></li>
<li><a href="joshua_cockrell_resume.pdf" target="_blank">Resume</a></li>
</ul>
<canvas id='canvas'></canvas>
<!-- SHADERS -->
<!-- Vertex Shader -->
<script id="vertex-shader" type="x-shader/x-vertex">
attribute vec2 a_position;
uniform vec2 u_resolution;
void main() {
// convert the rectangle from pixels to 0.0 to 1.0
vec2 zeroToOne = a_position / u_resolution;
// convert from 0->1 to 0->2
vec2 zeroToTwo = zeroToOne * 2.0;
gl_Position = vec4(zeroToTwo*2.0 - 1.0, 0, 1); //ofset our positions
gl_PointSize = 1.0;
}
</script>
<!-- Fragment Shader -->
<script id="fragment-shader" type="x-shader/x-fragment">
precision mediump float;
uniform vec4 u_color;
void main() {
gl_FragColor = u_color;
}
</script>
<script async="async" src="js/particles.js"></script>
</body>
</html>