Make React Spring respect animation preferences (#35018)

This commit is contained in:
Echo 2025-06-11 18:51:55 +02:00 committed by GitHub
commit 3aed93711c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 14 additions and 30 deletions

View file

@ -27,11 +27,7 @@ import {
attachFullscreenListener,
detachFullscreenListener,
} from 'mastodon/features/ui/util/fullscreen';
import {
displayMedia,
useBlurhash,
reduceMotion,
} from 'mastodon/initial_state';
import { displayMedia, useBlurhash } from 'mastodon/initial_state';
import { playerSettings } from 'mastodon/settings';
import { HotkeyIndicator } from './components/hotkey_indicator';
@ -260,7 +256,6 @@ export const Video: React.FC<{
setMuted(videoRef.current.muted);
void api.start({
volume: `${videoRef.current.volume * 100}%`,
immediate: reduceMotion,
});
}
},
@ -350,7 +345,6 @@ export const Video: React.FC<{
videoRef.current.currentTime / videoRef.current.duration;
void api.start({
progress: isNaN(progress) ? '0%' : `${progress * 100}%`,
immediate: reduceMotion,
config: config.stiff,
});
}
@ -738,7 +732,6 @@ export const Video: React.FC<{
if (lastTimeRange > -1) {
void api.start({
buffer: `${Math.ceil(videoRef.current.buffered.end(lastTimeRange) / videoRef.current.duration) * 100}%`,
immediate: reduceMotion,
});
}
}, [api]);
@ -753,7 +746,6 @@ export const Video: React.FC<{
void api.start({
volume: `${videoRef.current.muted ? 0 : videoRef.current.volume * 100}%`,
immediate: reduceMotion,
});
persistVolume(videoRef.current.volume, videoRef.current.muted);