Fix StoryViewer and update spring animations

This commit is contained in:
Jamie Kyle 2024-09-04 09:33:58 -07:00 committed by GitHub
parent ee0090bb84
commit 8c770934e1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 34 additions and 15 deletions

View file

@ -5,6 +5,7 @@ import React from 'react';
import { animated, to as interpolate, useSprings } from '@react-spring/web';
import { random } from 'lodash';
import { Emojify } from './conversation/Emojify';
import { useReducedMotion } from '../hooks/useReducedMotion';
export type PropsType = {
emoji: string;
@ -38,9 +39,11 @@ export function AnimatedEmojiGalore({
emoji,
onAnimationEnd,
}: PropsType): JSX.Element {
const reducedMotion = useReducedMotion();
const [springs] = useSprings(NUM_EMOJIS, i => ({
...to(i, onAnimationEnd),
from: from(i),
immediate: reducedMotion,
config: {
mass: 20,
tension: 120,