Giter Club home page Giter Club logo

react-navigate-motion's Introduction

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)

Properties Description
href Pass the Internal page path for prefetching and page transitions this is used to router methods arguments and <a>
routing Pass the programmatic page transitions hooks
exit Object defining the properties for the exit animation
entry Object defining the properties for the entry animation
scroll Controls whether the page scrolls to the top upon navigation
prefetch prefetch={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)

Properties Description
opacity CSS opacity
blur CSS filter blur
scale CSS transform scale
x CSS transform translateX
y CSS transform translateY
rotate CSS transform rotate
rotateX CSS transform rotateX
rotateY CSS transform rotateY
rotate3d CSS transform rotate3d [x: number, y: number, z: number, a: string]
transition Object defining the properties for the duration time and ease

transition Object

Properties Description
duration CSS animation duration time
ease CSS transition timing function
cubic-bezier[x1: number, y1: number, x2:number, y2: number]

License

MIT License.

react-navigate-motion's People

Contributors

refirst11 avatar

Stargazers

Иван avatar Adam Chen Chiang avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.