This package has been deprecated

Author message:

pre-release module deprecation

@platform/util.animate
TypeScript icon, indicating that this package has built-in type declarations

0.0.126 • Public • Published

Module License: MIT NPM

util.animate

Physics based animation. Uses dynamics.js under the hood.

Setup

yarn add @platform/util.animate

Usage

Within a React component:

private animate(target: { value1: number; value2: number }) {
  this.stop$.next();  // Stop currently executing animation (if any).
  const current = () => this.state;
  const duration = 200;
  animation
    .start({ target, current, duration, type: 'easeInOut' })
    .pipe(takeUntil(this.stop$))
    .subscribe({
      next: data => this.setState(data as any),
      complete: () => {
         // Done.
      },
    });
}

Readme

Keywords

none

Package Sidebar

Install

npm i @platform/util.animate

Weekly Downloads

7

Version

0.0.126

License

MIT

Unpacked Size

4.68 kB

Total Files

10

Last publish

Collaborators

  • philcockfield