UNPKG

@madeja-studio/telar

Version:

UI component library by Madeja Studio

22 lines (18 loc) 462 B
import { to as rsto } from '@react-spring/native'; import type { AnimationFactory } from './animation'; interface RotateProps { from?: number; to?: number; } export const rotate: AnimationFactory<RotateProps, { rotation: number }> = ({ from = 0, to = 5, } = {}) => ({ from: { rotation: from }, style: (values) => ({ transform: [ { rotate: rsto(values.rotation, (rotation) => `${rotation}deg`) }, ], }), to: { rotation: to }, });