@madeja-studio/telar
Version:
UI component library by Madeja Studio
20 lines (16 loc) • 413 B
text/typescript
import { to as rsto } from '@react-spring/native';
import type { AnimationFactory } from './animation';
interface ScaleProps {
from?: number;
to?: number;
}
export const scale: AnimationFactory<ScaleProps, { scale: number }> = ({
from = 0.8,
to = 1,
} = {}) => ({
from: { scale: from },
style: (values) => ({
transform: [{ scale: rsto(values.scale, (t) => t) }],
}),
to: { scale: to },
});