commit 8bd562f091b3f32ed17b283b8a835ae5dc1659e6
parent 9571dc7728bda4b91046e66bdfc4ffd519c100c8
Author: Yuval Langer <yuval.langer@gmail.com>
Date: Fri, 11 Mar 2022 19:21:32 +0200
Add sound samples.
Diffstat:
4 files changed, 26 insertions(+), 34 deletions(-)
diff --git a/html/wtc_plaza_2001-09-11/freesound.org/data/previews/239/239900_4079949-lq.mp3 b/html/wtc_plaza_2001-09-11/freesound.org/data/previews/239/239900_4079949-lq.mp3
Binary files differ.
diff --git a/html/wtc_plaza_2001-09-11/freesound.org/data/previews/344/344150_6179115-lq.mp3 b/html/wtc_plaza_2001-09-11/freesound.org/data/previews/344/344150_6179115-lq.mp3
Binary files differ.
diff --git a/html/wtc_plaza_2001-09-11/index.html b/html/wtc_plaza_2001-09-11/index.html
@@ -2,13 +2,20 @@
<html>
<head>
<meta charset="UTF-8">
- <title>WTC Plaza circa. 2001-09-11.</title>
+ <title>WTC Plaza circa 2001-09-11.</title>
<script type="text/javascript" src="wtc_plaza_2001-09-11.js"></script>
</head>
<body>
- WTC Plaza circa. 2001-09-11:
+ WTC Plaza circa 2001-09-11:
<canvas id="canvas" width="500" height="500"></canvas>
<button id="jump_button">Jump</button>
<button id="clear_button">Clear</button>
+ <hr>
+ <aside>
+ <a href="https://freesound.org/people/TheSubber13/sounds/239900/">The Scream</a> is licensed <a href="http://creativecommons.org/licenses/by-nc/3.0/">CC-By-NC 3.0 (boo!)</a> by <a href="https://freesound.org/people/TheSubber13/">TheSubber13</a>.
+ </aside>
+ <aside>
+ <a href="https://freesound.org/people/Brokenphono/sounds/344150/">The Thump</a> is licensed <a href="http://creativecommons.org/publicdomain/zero/1.0/">CC-Zero 1.0</a> by <a href="https://freesound.org/people/Brokenphono/">Brokenphono</a>.
+ </aside>
</body>
</html>
diff --git a/html/wtc_plaza_2001-09-11/wtc_plaza_2001-09-11.js b/html/wtc_plaza_2001-09-11/wtc_plaza_2001-09-11.js
@@ -194,6 +194,22 @@ Math.TAU = 2 * Math.PI;
draw_stick_figure(stick_figure_positions);
}
+ function jump() {
+ let scream_audio_element = new Audio("freesound.org/data/previews/239/239900_4079949-lq.mp3");
+
+ scream_audio_element.play();
+
+ scream_audio_element.addEventListener('ended', function() {
+ let thump = new Audio("freesound.org/data/previews/344/344150_6179115-lq.mp3");
+
+ thump.currentTime = 0.2;
+
+ thump.play();
+
+ draw_jumper();
+ });
+ }
+
function clear_canvas() {
let canvas = document.getElementById('canvas');
let ctx = canvas.getContext('2d');
@@ -203,7 +219,7 @@ Math.TAU = 2 * Math.PI;
function main() {
let jump_button = document.getElementById('jump_button');
- jump_button.addEventListener('click', draw_jumper);
+ jump_button.addEventListener('click', jump);
let clear_button = document.getElementById('clear_button');
clear_button.addEventListener('click', clear_canvas);
@@ -211,34 +227,3 @@ Math.TAU = 2 * Math.PI;
window.addEventListener('load', main);
})();
-
-
-
-
-/*
-
-def main():
- random.seed(0)
-
- image_width, image_height = 500, 500
-
- image = 255 * np.ones(shape=[image_width, image_height, 4], dtype=np.uint8)
-
- for i in range(100):
- stick_figure_positions = make_random_stick_figure_positions()
-
- blood_splatter_positions = make_blood_splatter_positions(stick_figure_positions)
-
- draw_blood_splatter(image, blood_splatter_positions)
-
- draw_stick_figure(image, stick_figure_positions)
-
- cv2.imwrite(f"prakdan_{i:02d}.png", image)
-
- convert_process = Popen(['convert', 'prakdan_*.png', 'prakdan.gif'])
-
- convert_process.wait()
-
-if __name__ == "__main__":
- main()
-*/