Socket
Book a DemoInstallSign in
Socket

@helpscout/motion

Package Overview
Dependencies
Maintainers
6
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@helpscout/motion

A simple animation library for React

0.0.8
latest
Source
npmnpm
Version published
Weekly downloads
0
Maintainers
6
Weekly downloads
 
Created
Source

💫 Motion

Build Status npm version

A simple animation library for React

Check out the demo

Table of Contents

Installation

npm install --save @helpscout/motion

Usage

Start adding animations to any React component with the Motion component:

import React from 'react'
import {Motion} from '@helpscout/motion'
import Zoolander from './components/Zoolander'

class App extends React.Component {
  render() {
    return (
      <Motion
        componentDidMount={fadeInAndMoveUp}
        componentWillUnmount={fadeOut}
      >
        <Zoolander />
      </Motion>
    )
  }
}

// Technically these animation callbacks can be writing in line.
// It's advisable to keep them as separate functions to make the code
// more readable.
function fadeInAndMoveUp({animate}) {
  return animate({
    opacity: [0, 1],
    translateY: [-20, 0],
  }).finished
}

function fadeOut({animate}) {
  return animate({
    opacity: [0, 1],
    duration: 500,
    easing: 'linear',
  }).finished
}

Documentation

For additional info on Motion, check out our documentation!

See Also

Thanks!

A big thanks to Julian Garnier for creating Anime.js, which powers the animations for Motion.

Keywords

motion

FAQs

Package last updated on 23 May 2019

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

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.