Skip to content

Giulico/react-magnetic

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

react-magnetic

HOC that converts DOM element into magnet.

React title slider

Demo

Example

  <Magnetic
    loaded={this.state.loaded}
  >
    {(magnetic: MagneticProps) => <Button setRef={magnetic.setRef} text="hover me" />}
  </Magnetic>

You only need to tell Magnetic which is the DOM element to animate (calling props.setRef()) and when the DOM is loaded (with props.loaded)

Optional props

  • padding (default: 0) - Magnet could starts move when the mouse is close to it
  • damp (default: 0.5) - The magnet strenght

About

Converts DOM element into magnet

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published