From 327c447b9a390318b42839dd14a3bc1ee706bcb5 Mon Sep 17 00:00:00 2001 From: syuilo <4439005+syuilo@users.noreply.github.com> Date: Fri, 10 Jul 2026 15:03:00 +0900 Subject: [PATCH] Delete animation.ts --- packages/frontend/src/utility/animation.ts | 39 ---------------------- 1 file changed, 39 deletions(-) delete mode 100644 packages/frontend/src/utility/animation.ts diff --git a/packages/frontend/src/utility/animation.ts b/packages/frontend/src/utility/animation.ts deleted file mode 100644 index 28984ffdd1..0000000000 --- a/packages/frontend/src/utility/animation.ts +++ /dev/null @@ -1,39 +0,0 @@ -/* - * SPDX-FileCopyrightText: syuilo and misskey-project - * SPDX-License-Identifier: AGPL-3.0-only - */ - -export const easing_easeInOutQuad = (t: number) => t < 0.5 ? 2 * t * t : -1 + (4 - 2 * t) * t; - -export function beginAnimation>(options: { - from: T; - to: T; - duration: number; - easing?: (t: number) => number; - apply: (state: T) => void; - onEnd?: () => void; -}) { - const easing = options.easing ?? ((t: number) => t); - - const startTime = performance.now(); - - function animate(now: number) { - const elapsed = now - startTime; - const t = easing(Math.min(elapsed / options.duration, 1)); - - const state = {} as T; - for (const _key in options.from) { - const key = _key as keyof T; - state[key] = options.from[key] + (options.to[key] - options.from[key]) * t; - } - options.apply(state); - - if (t < 1) { - window.requestAnimationFrame(animate); - } else { - options.onEnd?.(); - } - } - - window.requestAnimationFrame(animate); -}