kitze / react-genie

A set of React components for animating elements as they scroll into the viewport
https://codesandbox.io/s/react-genie-example-8xfsc
MIT License
745 stars 20 forks source link

Add FadeIn[Direction] and BounceIn[Direction] #14

Closed lmuller18 closed 4 years ago

lmuller18 commented 4 years ago

Features

Fixes

Updates

kitze commented 4 years ago

@lmuller18 thanks for this. I want to discuss it for a sec. The react-animations package has too many animations, and maybe people would want to use animate.css class names, or their own animations. I'm wondering how can we modularize the react-animations animations, remove styled-components dependency, and make everything optional. Any ideas?

lmuller18 commented 4 years ago

I think that one solution would be to bring in animate.css and continue to export the four main animations (for ease of use). This would allow users to either use one of the four predefined animations (animation={Animation.FadeInLeft}) while also allowing them to pass in any animate.css class string (animation="fade-in-left-big") without having to define an enum for each one. This would remove the need for styled-components and react-animations while still having the same outcome and without making the user bring in animate.css as a css peer dependency. This approach would also still allow users to pass in their own class string for any animations that they already have defined within scope as they can now.

Let me know your thoughts on this. I think this is just one approach that can be discussed.