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

react-tween-time

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-tween-time

Bare Necessities for React Animations

latest
Source
npmnpm
Version
1.0.2
Version published
Maintainers
1
Created
Source

react-tween-time

Bare Necessities for React Animations

NPM JavaScript Style Guide

Install

npm install --save react-tween-time

Usage

import React from 'react'
import { easing, useTweenTime } from 'react-tween-time'

const Example = () => {
  // after 1000 milliseconds t scales from 0 to 1 in two seconds
  const [t] = useTweenTime({
    startAt: 1000,
    mode: 'autostart',
    duration: 2000,
    easingFn: easing.inOutQuint
  })
  return (
    <div
      style={{
        transform: `translateX(${t * 100}px)`
      }}
    >
      Moving...
    </div>
  )
}

Control manually

const [t, anim] = useTweenTime({
  startAt: 1000,
  mode: 'manualstart', // does not start automatically
  duration: 2000,
  easingFn: easing.inOutQuint
})

// start animation
anim.start()
// pause animation
anim.pause()
// continue paused animation
anim.resume()

React to the animation end

const [t, anim] = useTweenTime({
  onEnd: () => {
    /* animation has ended */
  }
})

License

MIT © terotests

FAQs

Package last updated on 15 Sep 2021

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