use-tween

v4.7.0arrow_drop_down
v4.7.0
STATUS
Passing
DOWNLOADS
31
VISIBILITY
Public
PUBLISHED
6 years ago
SIZE
4 KB
1 contributor
Install use-tween as a package?
Copied
npm i @bit/giladshoham.react-hooks.use.use-tween
Set Bit as a scoped registryLearn more
npm config set '@bit:registry' https://node.bit.cloud
Component Example
React
React
Vue
Angular
React Native
Add dependency... help_outline
Just
import
any of the 1 million components
and packages in Bit or NPM to the example.
import Button from '@bit/grommet.grommet.button';
import Lodash from 'lodash';
toggle layout
chevron_left
chevron_right

useTween

React animation hook that tweens a number between 0 and 1.

Usage

import {useTween} from 'react-use';

const Demo = () => {
  const t = useTween();

  return (
    <div>
      Tween: {t}
    </div>
  );
};

Reference

useTween(easing?: string, ms?: number, delay?: number): number

Returns a number that begins with 0 and ends with 1 when animation ends.

  • easing — one of the valid easing names, defaults to inCirc.
  • ms — milliseconds for how long to keep re-rendering component, defaults to 200.
  • delay — delay in milliseconds after which to start re-rendering component, defaults to 0.
Help and resources