Some libraries support Animation for ReactJS

Tram Ho

Why

You are walking around the Internet and sometimes come across extremely creative and smooth website interfaces, sliders, buttons, animations like Mobile App. Want to find out how they do it, but when viewing the Javascript source code, it has already been bundle. Or worse, WordPress with dozens of plugins.

I will tell you some very cool libraries to be able to manually make Smoothhh UI

Framer Motion

Homepage: https://www.framer.com/motion/

Doc: https://www.framer.com/api/motion

Guthub: https://github.com/framer/motion – 8.7k Stars

A library probably known as Dev ReactJS Native. This library was developed from Pose and on the homepage Pose also announced a redirect on Framer Motion. Framer is a UI / UX framework for App Mobile (Prototype), and they provide paid software but the library is completely free and Opensource.

Review

This is really an extremely easy to use library because all is wrapped in Components, all you have to do is choose color, shape, motion time … Very little code, just With 4 lines, you have a touch Animation. And of course, with the Mobile First criterion, this library is especially suitable when making App Mobile with drag and drop effects, swipe, touch and hold.

However, this is a limitation when you want to combine many effects at the same time, it will be really difficult to think in arrangement. Only one animation should be used for each object.

Demo: https://codesandbox.io/s/framer-motion-path-drawing-drag-and-usetransform-jnqk2

Demo: https://codesandbox.io/s/framer-motion-side-menu-mx2rw

React-spring

Homepage & Doc: https://www.react-spring.io/

Github: https://github.com/pmndrs/react-spring – 19k Stars

The new React-spring library has been developed since 2018. About its origin and father, please see the next section.

React-spring is a Spring-based Animation library (talking about repeating bounce) that will cover most of your UI / UX related Animation. It gives you tools flexible enough to execute all your ideas into smooth interfaces.

It’s heavily inspired by Christopher Chedeau’s animated and Cheng Lou’s react-motion Animation. It inherits animation’s powerful performance and interpolation, as well as the ease of use of reactive motion. You will be amazed how easily static data is converted to motion with small utility functions that don’t affect the way you view images.

Review

React-spring is much more primitive than Motion, and it takes a lot more time to learn and understand Keyframes. In return it also provides a lot of APIs to be used to make every Animation you can think of. Not many components, limited to the most basic forms of motion:

  • useSpring
  • useSprings
  • useTrail
  • useTransition
  • useChain

But believe me, just use 3 out of 5 of these and your website will be dazzled

Demo: https://codesandbox.io/embed/8zx4ppk01l

Demo: https://codesandbox.io/embed/r5qmj8m6lq

This is the demo that convinced me to use React-spring.

React-motion

Github: https://github.com/chenglou/react-motion – 19k Stars

Review

If you look at the Document of this library, you will realize that React-spring is almost completely like. Exactly, the original purpose of Cheng Lou was to do a demo about managing the terminal state of moving object to provide an immediate experience to the User. About that, the community contributed and responded very well to this thinking, so they contributed to the birth of React-spring.  The React-spring homepage also featured this video of him at React-Europe 2015.

If you are thinking that you have mastered when you can build a website in just a few weeks or days, it is still at the scale of 0.01 in the world. Consider whether it is 0.01s UI / UX, it will help level up that 100 times

Video: https://www.youtube.com/watch?v=1tavDv5hXpo

Share the news now

Source : Viblo