forked from jackylu97/cs184finalproj
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlogarithmic.html
155 lines (142 loc) · 4.71 KB
/
logarithmic.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
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="./css/common.css">
<script type="text/javascript" src="js_helpers/webgl-utils.js"></script>
<script type="text/javascript" src="js_helpers/mathHelper.js"></script>
<script type="text/javascript" src="js_helpers/otherHelper.js"></script>
<script type="text/javascript" src="js_helpers/perlin.js"></script>
<script type="text/javascript" src="js_helpers/jquery.min.js"></script>
<!-- vertex shader -->
<script id="2d-vertex-shader" type="x-shader/x-vertex">
attribute vec2 a_position;
attribute vec4 a_color;
attribute vec2 a_texture_coord;
varying vec4 v_color;
varying vec2 v_texture_coord;
uniform vec2 u_resolution;
void main() {
vec2 clipSpace = (a_position/u_resolution)*2.0-1.0;
gl_Position = vec4(clipSpace * vec2(1, -1), 0, 1);
v_color = a_color;
v_texture_coord = a_texture_coord;
}
</script>
</script>
<script id="2d-fragment-shader" type="x-shader/x-fragment">
precision mediump float;
varying vec4 v_color;
varying highp vec2 v_texture_coord;
uniform sampler2D u_sampler;
void main() {
vec2 uv = gl_FragCoord.xy/vec2(800,600);
;
vec4 texColor = texture2D(u_sampler,v_texture_coord.xy);
vec4 finalColor;
finalColor.r = texColor.r*v_color.r;
finalColor.g = texColor.g*v_color.g;
finalColor.b = texColor.b*v_color.b;
finalColor.a = texColor.a*v_color.a;
gl_FragColor = finalColor;
}
</script>
<script id="js_source" type="text/javascript" src="play_audio_logarithmic.js"></script>
<script>
// YOU NEED TO CHANGE THE ARRAY OF SONG URLs AND
// TITLES. Alternate MP3 file URLs and titles, in quotes
// and separated by commas, beginning with the first song URL.
// If you use " marks in filenames or titles, or put a \
// in front of them.
var songs = new Array(
"",
"-- Select a song --",
"songs/speaking_gently.mp3",
"Speaking Gently",
"songs/such_great_heights.mp3",
"Such Great Heights",
"songs/someday_my_prince.mp3",
"Someday My Prince Will Come - Miles Davis",
"songs/frontier_village_night.mp3",
"Xenoblade Chronicles: Frontier Village (Night)",
"songs/fuck_cancer.mp3",
"Fuck Cancer",
"songs/jazz.mp3",
"Jazz",
"songs/really_love.mp3",
"Really Love",
"songs/rough_soul_remix.mp3",
"Rough Soul",
"songs/my_girl.mp3",
"My Girl",
"songs/opus.mp3",
"OPUS",
"songs/something_they_dont_know.mp3",
"Something They Don't Know"
);
function switchSongs(i)
{
var file = songs[i * 2];
var selector = document.getElementById('song_selector');
selector.selectedIndex = i;
if (i != 0) {
load(file);
}
}
</script>
</head>
<body>
<div class="title" style="font-family:sans-serif">
<span>PARTICLE <br /> SIM</span>
</div>
<div class="menu">
<div style="padding:0.5rem 0;">
<button style="float:left" data-js="play">play</button>
<button data-js="stop">stop</button>
</div>
<div class="select-container" style="margin-top: 10px">
<select class="" name="song_selector" id="song_selector" onChange="switchSongs(selectedIndex)">
<script>
for (i = 0; (i < songs.length); i += 2) {
var file = songs[i];
var title = songs[i + 1];
document.write('<option value="' +
i + '">' +
title + '</option>\n');
}
</script>
</select>
</div>
<label class="container">Logarithmic
<a href="./index.html"><span class="checkmark checked"></span></a>
</label>
<a href="blob.html" style="float:left;display:block;"><button>→</button></a>
</div>
<!-- <script>
var check = $(".checkmark");
var i = 0;
check.click(function() {
$(".checkmark").toggleClass("checked");
var jsrc = $("#js_source");
if (i % 2 == 0) {
jsrc[0].src = "./play_audio_logarithmic.js";
console.log(jsrc[0].src);
} else {
jsrc[0].src = "./play_audio.js";
console.log(jsrc[0].src);
}
})
</script> -->
<div class="containerDiv">
<div class="leftPanel" > <canvas id="canvas"></canvas> </div>
<div class="rightPanel" style="display:none">
<div style="line-height: 64px;">
<label for="fireTexture">Texture</label>
<select id="fireTexture" class="textureComboBox"></select>
<img style="display:inline-block; vertical-align: middle;" id="fireTextureVal" width="64" height="64" src="textures/gradient.png"></img><br>
</div>
</div>
</div>
<div class="footer">
<div id="fps"></div><div id="numParticles"></div>
</div>
</body>
</html>