-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
42 lines (36 loc) · 1.33 KB
/
script.js
File metadata and controls
42 lines (36 loc) · 1.33 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
"use strict";
// let lightsabersound = new Audio('https://s3-us-west-2.amazonaws.com/s.cdpn.io/18515/Lightsaber_sound_effect_-_medium_(mp3cut.net).mp3');
// let saberOn = new Audio("http://www.jarrodyellets.com/sounds/saberOn.mp3");
// let saberOff = new Audio("http://www.jarrodyellets.com/sounds/saberOff.mp3");
// lightsabersound.loop = true;
// lightsabersound.volume = 0.25;
// saberOn.volume = 0.25;
// saberOff.volume = 0.25;
// let activeLightsaber = true;
function getRandomColor() {
document.documentElement.style.setProperty('--blade-color', `${getRandomInt(10, 1000)}`);
}
function getRandomInt(min, max) {
return Math.floor(Math.random() * (max - min)) + min;
}
// document.getElementById("lightsaberhand").addEventListener('click', () => {
// if(activeLightsaber == true) {
// setTimeout(function(){
// saberOff.pause();
// saberOff.currentTime = 0;
// saberOn.play();
// }, 1);
// setTimeout(function() {
// lightsabersound.play();
// }, 300);
// }
// else if(activeLightsaber == false) {
// lightsabersound.pause();
// saberOn.pause();
// saberOn.currentTime = 0;
// lightsabersound.currentTime = 0;
// saberOff.play();
// }
// activeLightsaber = !activeLightsaber;
// })
getRandomColor();