This commit is contained in:
Rhiannon Morris 2024-12-08 05:03:32 +01:00
parent 815ef5c23f
commit e35f46003b
8 changed files with 97 additions and 27 deletions

View file

@ -144,6 +144,7 @@ function message(msg: string, ctx: CanvasRenderingContext2D) {
function startAnim(name: string) {
document.documentElement.dataset.running = name;
document.getElementById('buttons')?.style.removeProperty('z-index');
}
function isRunning(): boolean {
@ -152,6 +153,7 @@ function isRunning(): boolean {
function finishAnim() {
delete document.documentElement.dataset.running;
document.getElementById('buttons')?.style.setProperty('z-index', '1');
}
type SideName = 'front' | 'back';
@ -238,7 +240,7 @@ async function animateReroll(ctx1: CanvasRenderingContext2D,
side: Side, done: () => void) {
const duration = 200;
const [oklch, rgb] = await side.recolorOn(ctx2, buf);
ctx2.canvas.style.animation = `${duration}ms ease fade-in`;
ctx2.canvas.style.animation = `${duration}ms ease forwards fade-in`;
setBg(oklch.outer.h);
setPalette(oklch, rgb);
setTimeout(finish, duration);
@ -310,6 +312,8 @@ document.addEventListener('DOMContentLoaded', async function() {
addListeners();
document.documentElement.dataset.ready = '1';
type Done = (finish: () => void) => void;
function handleReroll(e: Event) {