Skip to content

Commit

Permalink
Merge pull request #343 from vim-jp-radio/feature/340
Browse files Browse the repository at this point in the history
prefersReducedMotion runeを使う
  • Loading branch information
ryoppippi authored Dec 29, 2024
2 parents 1c9cbab + ae839f0 commit 41969fd
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,5 @@
<script lang='ts'>
import { PrefersReducedMotion } from '$lib/utils/runes.svelte.js';
import { prefersReducedMotion } from 'svelte/motion';
import { animate, cancelAnimate, createCircles } from './circle.js';
/**
Expand All @@ -16,8 +16,6 @@
minSpeed?: number;
maxSpeed?: number;
} = $props();
/** media queryのprefers-reduced-motionを取得 */
const prefersReducedMotionRune = new PrefersReducedMotion();
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 41969fd

Please sign in to comment.