style: auto-fix linting issues
This commit is contained in:
parent
7c568030af
commit
a308d380b9
2 changed files with 3990 additions and 2835 deletions
54
bc-demo.html
54
bc-demo.html
|
|
@ -1,11 +1,10 @@
|
||||||
<!DOCTYPE html>
|
<!doctype html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
|
<head>
|
||||||
<head>
|
<meta charset="UTF-8" />
|
||||||
<meta charset="UTF-8">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
||||||
<title>Butterchurn Demo Fixed</title>
|
<title>Butterchurn Demo Fixed</title>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
<link rel="stylesheet" href="https://unpkg.com/normalize.css/normalize.css" />
|
<link rel="stylesheet" href="https://unpkg.com/normalize.css/normalize.css" />
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
|
@ -50,9 +49,9 @@
|
||||||
margin-right: 5px;
|
margin-right: 5px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div id="mainWrapper">
|
<div id="mainWrapper">
|
||||||
<div id="audioSelectWrapper">
|
<div id="audioSelectWrapper">
|
||||||
<button id="localFileBut">Load local files</button>
|
<button id="localFileBut">Load local files</button>
|
||||||
|
|
@ -60,10 +59,13 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="presetControls">
|
<div id="presetControls">
|
||||||
<label>Preset: <select id="presetSelect"></select></label>
|
<label
|
||||||
<label>Cycle: <input type="checkbox" id="presetCycle" checked></label>
|
>Preset:
|
||||||
<label>Seconds: <input type="number" id="presetCycleLength" value="15" min="1"></label>
|
<select id="presetSelect"></select
|
||||||
<label>Random: <input type="checkbox" id="presetRandom" checked></label>
|
></label>
|
||||||
|
<label>Cycle: <input type="checkbox" id="presetCycle" checked /></label>
|
||||||
|
<label>Seconds: <input type="number" id="presetCycleLength" value="15" min="1" /></label>
|
||||||
|
<label>Random: <input type="checkbox" id="presetRandom" checked /></label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<canvas id="canvas" width="800" height="600"></canvas>
|
<canvas id="canvas" width="800" height="600"></canvas>
|
||||||
|
|
@ -114,8 +116,8 @@
|
||||||
function loadLocalFiles(files, index = 0) {
|
function loadLocalFiles(files, index = 0) {
|
||||||
audioContext.resume();
|
audioContext.resume();
|
||||||
const reader = new FileReader();
|
const reader = new FileReader();
|
||||||
reader.onload = e => {
|
reader.onload = (e) => {
|
||||||
audioContext.decodeAudioData(e.target.result, buffer => {
|
audioContext.decodeAudioData(e.target.result, (buffer) => {
|
||||||
playBufferSource(buffer);
|
playBufferSource(buffer);
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (files.length > index + 1) loadLocalFiles(files, index + 1);
|
if (files.length > index + 1) loadLocalFiles(files, index + 1);
|
||||||
|
|
@ -145,7 +147,7 @@
|
||||||
|
|
||||||
function prevPreset(blendTime = 5.7) {
|
function prevPreset(blendTime = 5.7) {
|
||||||
if (presetIndexHist.length > 0) presetIndex = presetIndexHist.pop();
|
if (presetIndexHist.length > 0) presetIndex = presetIndexHist.pop();
|
||||||
else presetIndex = ((presetIndex - 1) + presetKeys.length) % presetKeys.length;
|
else presetIndex = (presetIndex - 1 + presetKeys.length) % presetKeys.length;
|
||||||
visualizer.loadPreset(presets[presetKeys[presetIndex]], blendTime);
|
visualizer.loadPreset(presets[presetKeys[presetIndex]], blendTime);
|
||||||
document.getElementById('presetSelect').value = presetIndex;
|
document.getElementById('presetSelect').value = presetIndex;
|
||||||
}
|
}
|
||||||
|
|
@ -179,7 +181,7 @@
|
||||||
width: canvas.width,
|
width: canvas.width,
|
||||||
height: canvas.height,
|
height: canvas.height,
|
||||||
pixelRatio: window.devicePixelRatio || 1,
|
pixelRatio: window.devicePixelRatio || 1,
|
||||||
textureRatio: 1
|
textureRatio: 1,
|
||||||
});
|
});
|
||||||
|
|
||||||
nextPreset(0);
|
nextPreset(0);
|
||||||
|
|
@ -193,7 +195,7 @@
|
||||||
input.type = 'file';
|
input.type = 'file';
|
||||||
input.accept = 'audio/*';
|
input.accept = 'audio/*';
|
||||||
input.multiple = true;
|
input.multiple = true;
|
||||||
input.onchange = e => loadLocalFiles(e.target.files);
|
input.onchange = (e) => loadLocalFiles(e.target.files);
|
||||||
input.click();
|
input.click();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -212,30 +214,32 @@
|
||||||
visualizer.loadPreset(presets[presetKeys[presetIndex]], 5.7);
|
visualizer.loadPreset(presets[presetKeys[presetIndex]], 5.7);
|
||||||
};
|
};
|
||||||
|
|
||||||
document.getElementById('presetCycle').onchange = e => {
|
document.getElementById('presetCycle').onchange = (e) => {
|
||||||
presetCycle = e.target.checked;
|
presetCycle = e.target.checked;
|
||||||
restartCycleInterval();
|
restartCycleInterval();
|
||||||
};
|
};
|
||||||
|
|
||||||
document.getElementById('presetCycleLength').onchange = e => {
|
document.getElementById('presetCycleLength').onchange = (e) => {
|
||||||
presetCycleLength = parseInt(e.target.value) * 1000;
|
presetCycleLength = parseInt(e.target.value) * 1000;
|
||||||
restartCycleInterval();
|
restartCycleInterval();
|
||||||
};
|
};
|
||||||
|
|
||||||
document.getElementById('presetRandom').onchange = e => {
|
document.getElementById('presetRandom').onchange = (e) => {
|
||||||
presetRandom = e.target.checked;
|
presetRandom = e.target.checked;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Start on first user click (required for autoplay policies)
|
// Start on first user click (required for autoplay policies)
|
||||||
document.body.addEventListener('click', () => {
|
document.body.addEventListener(
|
||||||
|
'click',
|
||||||
|
() => {
|
||||||
if (!audioContext) initPlayer();
|
if (!audioContext) initPlayer();
|
||||||
}, { once: true });
|
},
|
||||||
|
{ once: true }
|
||||||
|
);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<!-- Load Butterchurn presets as global scripts -->
|
<!-- Load Butterchurn presets as global scripts -->
|
||||||
<script src="https://unpkg.com/butterchurn-presets@3.0.0-beta.4/dist/base.min.js"></script>
|
<script src="https://unpkg.com/butterchurn-presets@3.0.0-beta.4/dist/base.min.js"></script>
|
||||||
<script src="https://unpkg.com/butterchurn-presets@3.0.0-beta.4/dist/extra.min.js"></script>
|
<script src="https://unpkg.com/butterchurn-presets@3.0.0-beta.4/dist/extra.min.js"></script>
|
||||||
|
</body>
|
||||||
</body>
|
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
2201
index.html
2201
index.html
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue