0.2.2 • Published 7 months ago

react-navigate-motion v0.2.2

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

react-navigate-motion

Release Status Minzip Size License: MIT

Overview

A programmatic page transition with animation.

This library uses react-router-dom's navigate hook and other frameworks routing functions.
The single component performs the unmount and next page initial mount animations, motion is always returns to the initial style.

Installation

npm install react-navigate-motion

Get Started

import { NavigateMotion } from "react-navigate-motion";
import { useNavigate } from "react-router-dom";

const Link = ({ href, children }) => {
  const navigate = useNavigate();
  const exit = { opacity: 0, transition: { duration: 0.5 } };
  const entry = { opacity: 0, transition: { duration: 0.5 } };

  return (
    <NavigateMotion href={href} routing={navigate} exit={exit} entry={entry}>
      {children}
    </NavigateMotion>
  );
};
export default Link;

NavigateMotion(href and routing is require)

PropertiesDescription
hrefPass the Internal page path for prefetching and page transitions this is used to router methods arguments and <a>
routingPass the programmatic page transitions hooks
exitObject defining the properties for the exit animation
entryObject defining the properties for the entry animation
scrollControls whether the page scrolls to the top upon navigation
prefetchprefetch={false} is starts prefetching when the link is pressed prefetch={true} is prefetches when the Link element in the viewport

exit and entry Object(all are optional)

PropertiesDescription
opacityCSS opacity
blurCSS filter blur
scaleCSS transform scale
xCSS transform translateX
yCSS transform translateY
rotateCSS transform rotate
rotateXCSS transform rotateX
rotateYCSS transform rotateY
rotate3dCSS transform rotate3d x: number, y: number, z: number, a: string
transitionObject defining the properties for the duration time and ease

transition Object

PropertiesDescription
durationCSS animation duration time
easeCSS transition timing function cubic-bezierx1: number, y1: number, x2:number, y2: number

License

MIT License.

0.2.2

7 months ago

0.2.1

7 months ago

0.2.0

7 months ago

0.1.9

7 months ago

0.1.8

7 months ago

0.1.7

7 months ago

0.1.6

7 months ago

0.1.5

7 months ago

0.1.5-beta.0

7 months ago

0.1.4

7 months ago

0.1.3

7 months ago

0.1.2

7 months ago

0.1.1

8 months ago

0.1.0

8 months ago