use-interpolation

0.2.0 • Public • Published

use-interpolation

A hook to interpolate values easily in React with Ola:

import useInterpolation from 'use-interpolation';
 
const Counter = () => {
  // Either initialize it with a value or with no value
  const [fps, setFps] = useInterpolation();
  useAnimationFrame(e => {
    setFps(1 / e.delta);
    // Do something...
  }, []);
  if (!fps) return 'Loading...';
  return <div>{fps.value}</div>;
};

It is useful for listening to remote values that change over time and setting like displaying a graph like Ola:

Graph interpolation

Touch interpolation

Many points interpolation

Readme

Keywords

none

Package Sidebar

Install

npm i use-interpolation

Weekly Downloads

1

Version

0.2.0

License

MIT

Unpacked Size

9.29 kB

Total Files

6

Last publish

Collaborators

  • franciscop