diff options
| author | かっこかり <67428053+kakkokari-gtyih@users.noreply.github.com> | 2025-10-27 18:41:03 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-10-27 18:41:03 +0900 |
| commit | 4e16e23acd6db761ac7490c7a4c0b84cee490389 (patch) | |
| tree | e109f0e1a60fbd01ab774ab3adcb25fb1d1fab0d /packages/frontend/src/utility | |
| parent | [skip ci] Update CHANGELOG.md (prepend template) (diff) | |
| download | misskey-4e16e23acd6db761ac7490c7a4c0b84cee490389.tar.gz misskey-4e16e23acd6db761ac7490c7a4c0b84cee490389.tar.bz2 misskey-4e16e23acd6db761ac7490c7a4c0b84cee490389.zip | |
fix(frontend): confettiの実行がアニメーション設定を考慮していない問題を修正 (#16714)
* fix(frontend): confettiの実行がアニメーション設定を考慮していない問題を修正
* Update Changelog
---------
Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com>
Diffstat (limited to 'packages/frontend/src/utility')
| -rw-r--r-- | packages/frontend/src/utility/confetti.ts | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/packages/frontend/src/utility/confetti.ts b/packages/frontend/src/utility/confetti.ts index c19149875f..b95c26345e 100644 --- a/packages/frontend/src/utility/confetti.ts +++ b/packages/frontend/src/utility/confetti.ts @@ -5,13 +5,21 @@ import _confetti from 'canvas-confetti'; import * as os from '@/os.js'; +import { prefer } from '@/preferences.js'; export function confetti(options: { duration?: number; } = {}) { + if (!prefer.s.animation) return; + const duration = options.duration ?? 1000 * 4; const animationEnd = Date.now() + duration; - const defaults = { startVelocity: 30, spread: 360, ticks: 60, zIndex: os.claimZIndex('high') }; + const defaults = { + startVelocity: 30, + spread: 360, + ticks: 60, + zIndex: os.claimZIndex('high'), + } satisfies _confetti.Options; - function randomInRange(min, max) { + function randomInRange(min: number, max: number) { return Math.random() * (max - min) + min; } |