New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

react-overdrive-motion

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-overdrive-motion

Super easy magic-move transitions for React apps

latest
Source
npmnpm
Version
0.4.4
Version published
Maintainers
1
Created
Source

react-overdrive

Super easy magic-move transitions for React apps.

Demos

  • Page transitions

Overdrive Demo

Overdrive Demo

Overdrive Demo

Install

$ npm install react-overdrive --save

Usage

Example with routing

Wrap any element (not just images) in a <Overdrive id=""></Overdrive> component. Add the same id to create a transition between the elements.

On page1.js:

import Overdrive from 'react-overdrive'

const pageA = (props) => (
  <div>
    <h1>Page A</h1>
    <Overdrive id="bender-to-big-fry">
      <img src="bender.png" width="100" height="100"/>
    </Overdrive>
  </div>
);

On page2.js:

import Overdrive from 'react-overdrive'

const pageB = (props) => (
  <div>
    <h1>Page B</h1>
    <Overdrive id="bender-to-big-fry">
      <img src="fry.png" width="300" height="300"/>
    </Overdrive>
  </div>
);

Now route between the pages.

Example without routing

On page.js:

import Overdrive from 'react-overdrive'

const page = (props) => (
  <div>
    {props.loading && <Overdrive id="content"><Loader/></Overdrive>}
    {!props.loading && <Overdrive id="content"><Content/></Overdrive>}
  </div>
);

API

PropDescriptionDefault Value
idRequired. A unique string to identify the component.
elementWrapping element type.'div'
durationAnimation duration (in milliseconds).200
animationDelayAdd delay of calculating the mounted component position. Setting to 1 usually helps avoiding issues with window scrolling.null
onAnimationEndEvent dispatched when the animation has finished.null

How does it work?

A transition is made when an <Overdrive id="example"/> component is unmounted and another <Overdrive id="example"/> is mounted not later than 100ms.

The transition is made by cloning the unmounted and mounted components, adding them with absolute position and CSS transformed from the source to the target position.

Sponsors

Thanks to the following companies for generously providing their services/products to help improve this project:

Thanks to BrowserStack for providing cross-browser testing.

Who made this?

Tal Bereznitskey. Find me on Twitter as @ketacode.

Keywords

magic-move

FAQs

Package last updated on 24 Nov 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts