-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
31 lines (25 loc) · 1.21 KB
/
Copy pathscript.js
File metadata and controls
31 lines (25 loc) · 1.21 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
let intervalId;
function startStroboscope() {
// Background color
const bodyColor = document.getElementById('backColorInput').value;
//Main inputs
const interval = parseFloat(document.getElementById('intervalInput').value) * 1000;
const length = parseFloat(document.getElementById('lengthInput').value) * 1000;
const color = document.getElementById('colorInput').value;
const strobeContainer = document.getElementById('strobeContainer');
const colorTransition = parseFloat(document.getElementById('TransitionTimeInput').value);
strobeContainer.style.transition = `background-color ${colorTransition}s`;
intervalId = setInterval(() => {
strobeContainer.style.backgroundColor = color;
setTimeout(() => {
strobeContainer.style.backgroundColor = bodyColor;
}, length);
}, interval);
}
function stopStroboscope() {
clearInterval(intervalId);
document.getElementById('strobeContainer').style.backgroundColor = 'black';
}
// Add another input to choose a transition and make time adaptable
// make site phone adaptable
// show and hide Control settings.