UseAllFive / ani-friend

A tool that makes animations a breeze.
MIT License
1 stars 1 forks source link

Make into React Components #12

Closed jasonfarrell closed 4 years ago

jasonfarrell commented 4 years ago

Isn't there another library that does all this? Why do we need to do this? Problems with common libraries:

Main issue w/ React The main blocking issue is ani-friend stores state as attributes into the DOM, when there’s a re-render, the attributes reset. This causes bugs, including sometimes animations will replay. The library simply wasn’t designed to work with virtual dom and react.

It most likely needs to be rebuilt into react components — I doubt we can use the original source code.

Would be nice to be able to do something like…

  <AniTextLineAppear order="2" group="{groupId}">
    <h2>Use All Five</h2>
  </AniTextLineAppear>
  <AniFadeUp order="1" group="{groupId}">
    <img />
  </AniFadeUp>

// set settings for an animation group
AniGroup.get(groupId).settings = {
    loaderComponent: (<MySpinner></MySpinner>),
    inViewTriggerPercent: 0.2,
    speed: 1,
    ease: 'Power2.easeOut',
}

// be able to globally subscribe to when the group ID finishes animating
AniGroup.get(groupId).on('finish', ()=> {
 console.log('complete');
})

Goals/Benfits of React components:

A few details of functionality:

Details:

Questions

jasonfarrell commented 4 years ago

Done @ https://github.com/UseAllFive/drizzle-react-reveal-animations