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

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.2.0
    2
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.2.0
    2
  • 0.1.1
    0
  • 0.1.0
    1

Package Sidebar

Install

npm i use-interpolation

Weekly Downloads

3

Version

0.2.0

License

MIT

Unpacked Size

9.29 kB

Total Files

6

Last publish

Collaborators

  • franciscop