nandorojo / moti

🐼 The React Native (+ Web) animation library, powered by Reanimated 3.
https://moti.fyi
MIT License
3.9k stars 120 forks source link

RFC: Built-in Moti + SVG Integration #255

Closed nandorojo closed 1 year ago

nandorojo commented 1 year ago

It would be nice to do something like this:

import { motify } from 'moti'
import { Rect } from 'react-native-svg'

const MotiRect = motify(Rect)({ isSvg: true })

Then, we could automatically animate SVG props:

<MotiRect 
  animate={{
    x: width / 2,
  }}
/>

All SVG props would be animatable there. Let me know if you have any thoughts about this API.

This would bring the benefits of all Moti APIs and its simplicity to SVGs. It would also let you use animate presence with SVG animations.

Screenshot 2023-01-30 at 4 24 32 PM