nandorojo/moti

RFC: Granular animation callbacks

Closed this issue · 0 comments

What if you could set a callback function for a given animation value?

Currently, you'd do this:

<MotiView
  animate={{ opacity: on ? 1 : 0 }}
  onDidAnimate={...}
/>

What if you could also listen for animations right in the value itself?

<MotiView
  animate={{ 
   opacity: {
     value: on ? 1 : 0,
     onDidAnimate(finished, value) {
      'worklet'

       console.log('animated')
     }
   }
  }}
/>

Here, we'd pass an object with onDidAnimate and value fields.