diff --git a/site/src/components/PlayerControls.astro b/site/src/components/PlayerControls.astro
index 9462f7e..361fa0c 100644
--- a/site/src/components/PlayerControls.astro
+++ b/site/src/components/PlayerControls.astro
@@ -3,65 +3,109 @@
---
-
+
+
+
+
diff --git a/site/src/lib/browser/animations.ts b/site/src/lib/browser/animations.ts
index 2321eb5..5804a4e 100644
--- a/site/src/lib/browser/animations.ts
+++ b/site/src/lib/browser/animations.ts
@@ -1,9 +1,3 @@
-let paused = false;
-
-export const getAnimationState = () => {
- return paused ? "paused" : "playing";
-};
-
const updatePostAnimations = (playState: "paused" | "running") => {
document.querySelectorAll(".post").forEach((post) => {
(post as HTMLDivElement).style.animationPlayState = playState;
@@ -14,22 +8,25 @@ const updatePostAnimations = (playState: "paused" | "running") => {
});
};
-const pauseAllAnimations = () => {
- paused = true;
- // const animations = document.getAnimations();
- // animations.forEach((anim) => anim.pause());
+export const pauseAllAnimations = () => {
updatePostAnimations("paused");
(document.querySelector("#filledchart") as SVGSVGElement).pauseAnimations();
};
-const resumeAllAnimations = () => {
- paused = false;
- // const animations = document.getAnimations();
- // animations.forEach((anim) => anim.play());
+export const resumeAllAnimations = () => {
updatePostAnimations("running");
(document.querySelector("#filledchart") as SVGSVGElement).unpauseAnimations();
};
+export const fastForwardAnimations = () => {
+ document.getAnimations().forEach((anim) => {
+ anim.finish();
+ });
+ (document.querySelector("#filledchart") as SVGSVGElement).setCurrentTime(
+ (Date.now() + 30_000) / 1_000
+ );
+};
+
export const listenForAnimationComplete = (listener: () => void) => {
// for some reason endEvent doesn't work, but this is close enough
(
@@ -38,15 +35,3 @@ export const listenForAnimationComplete = (listener: () => void) => {
) as SVGAnimateElement
).addEventListener("beginEvent", listener);
};
-
-export const toggleAnimationState = () => {
- const state = getAnimationState();
- switch (state) {
- case "paused":
- resumeAllAnimations();
- break;
- case "playing":
- pauseAllAnimations();
- break;
- }
-};