Stub out runtime choreography

This commit is contained in:
Jordan Eldredge 2021-11-24 16:44:54 -08:00
parent 1e0bed24fa
commit cd5ad3dc82
2 changed files with 53 additions and 0 deletions

View file

@ -0,0 +1,50 @@
import Webamp from "../../js/webampLazy";
import { Slider } from "../../js/types";
import { batch } from "react-redux";
const BANDS: Slider[] = [
"preamp",
60,
170,
310,
600,
1000,
3000,
6000,
12000,
14000,
16000,
];
export function choreograph(webamp: Webamp) {
let frameNum = 0;
function tick() {
frameNum += 1;
batch(() => {
for (const [i, band] of BANDS.entries()) {
const value = (Math.sin(i + frameNum / 60) + 1) * 50;
webamp.store.dispatch({ type: "SET_BAND_VALUE", band, value });
}
});
if (frameNum === 200 || frameNum === 400) {
document.getElementById("previous")?.classList.add("active");
document.getElementById("playlist-add-menu")?.click();
document
.querySelector("#playlist-add-menu ul")
.firstChild.classList.add("hover");
}
if (frameNum === 400 || frameNum === 600) {
document.getElementById("playlist-remove-menu")?.click();
}
if (frameNum === 600 || frameNum === 800) {
document.getElementById("playlist-selection-menu")?.click();
}
if (frameNum === 800 || frameNum === 1000) {
document.getElementById("playlist-misc-menu")?.click();
}
if (frameNum === 1000 || frameNum === 1200) {
document.getElementById("playlist-list-menu")?.click();
}
window.requestAnimationFrame(tick);
}
window.requestAnimationFrame(tick);
}

View file

@ -17,6 +17,7 @@ import {
import { disableMarquee, skinUrl as configSkinUrl } from "./config";
import DemoDesktop from "./DemoDesktop";
import enableMediaSession from "./mediaSession";
// import { choreograph } from "./choreography";
declare global {
const SENTRY_DSN: string;
@ -155,6 +156,8 @@ async function main() {
document.getElementById("app") as HTMLDivElement
);
// choreograph(webamp);
if (!screenshot) {
if (backgroundColor != null) {
window.document.body.style.backgroundColor = backgroundColor;