HOC that converts DOM element into magnet.
<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
)
padding
(default: 0) - Magnet could starts move when the mouse is close to itdamp
(default: 0.5) - The magnet strenght