Skip to content

Commit

Permalink
feat: use prefersReducedMotion on svelte 5.7.0 (fixes: #340)
Browse files Browse the repository at this point in the history
  • Loading branch information
ryoppippi committed Dec 28, 2024
1 parent 1c9cbab commit 631cc28
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 43 deletions.
6 changes: 2 additions & 4 deletions src/lib/Backgroud/Backgroud.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<script lang='ts'>
import { PrefersReducedMotion } from '$lib/utils/runes.svelte.js';
import { animate, cancelAnimate, createCircles } from './circle.js';
/**
Expand All @@ -16,8 +15,7 @@
minSpeed?: number;
maxSpeed?: number;
} = $props();
/** media queryのprefers-reduced-motionを取得 */
const prefersReducedMotionRune = new PrefersReducedMotion();
import { prefersReducedMotion } from 'svelte/motion';
let canvas = $state<HTMLCanvasElement | undefined>(undefined);
const ctx = $derived.by(() => canvas?.getContext('2d'));
Expand All @@ -28,7 +26,7 @@
let jsLoaded = $state(false);
const circles = $derived.by(() =>
canvas != null && ctx != null ? createCircles(circleNum, canvas, ctx, minSpeed, maxSpeed, prefersReducedMotionRune.isReduced) : [],
canvas != null && ctx != null ? createCircles(circleNum, canvas, ctx, minSpeed, maxSpeed, prefersReducedMotion.current) : [],
);
/** js が読み込まれたらオンになる */
Expand Down
39 changes: 0 additions & 39 deletions src/lib/utils/runes.svelte.ts

This file was deleted.

0 comments on commit 631cc28

Please sign in to comment.