html
html
1
2
3
4
5
6
7
8
9
10
11
<!-- Created by Sword 🪄 -->
<!DOCTYPE html>
<html>
<head>
<title>Created By Sword</title>
</head>
<body>
<canvas id="canvas"></canvas>
</body>
</html>
Enter to Rename, Shift+Enter to Preview
css
css
1
2
3
4
5
6
7
8
9
10
/* Created by Sword 🪄 */
*{
margin:0;
padding:0;
}
canvas{
position:fixed ;
}
Enter to Rename, Shift+Enter to Preview
js
js
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
// Created by Sword 🪄
//This code creates a particle animation on a canvas, where particles are created and move towards the mouse position when the mouse is clicked. The particles explode upon reaching the mouse's Y position and gradually fade out.
onload = () => {
function Sound(){
return new Audio( "https://www.dropbox.com/scl/fi/wv5lsqehg7lrm9zg63hvs/mixkit-multiple-fireworks-explosions-1689.wav?rlkey=1z76c4czkvywzx7xoixl3w3bj&st=s1sezzfu&dl=1");
}
let soundPool = [];
let poolSize = 2; // seems adequate.
// populate soundPool
for(let i=0; i<poolSize; i++) soundPool[i] = new Sound();
// use the soundPool to play the audio
function playSound(){
// takes first item
let temp = soundPool.shift();
temp.currentTime = 0;
temp.play();
// append at end
soundPool.push(temp);
}
// Show an alert when the window loads
alert("click");
Enter to Rename, Shift+Enter to Preview
BROWSER
Console
Run