@felixgro/animate-canvas
TypeScript icon, indicating that this package has built-in type declarations

2.0.3 • Public • Published

Animate-Canvas

A minimal library for frame-independent Canvas2D or WebGL animations.

It's as simple as that:

animateCanvas(canvas, '2d', (ctx, delta) => {
	// animation logic..
}).start();

Features

  • 2d and WebGL Support
  • FPS-Graph
  • Frame-Independent animations
  • Auto-Pause when invisible

Getting Started

Install using NPM or Yarn:

npm install @felixgro/animate-canvas

Start animating:

import { animateCanvas } from '@felixgro/animate-canvas';

const animation = animateCanvas(canvasElement, '2d' | 'webgl', frameHandler);

// Change playstate..
animation.start();
animation.stop();

// Access active rendering context
animation.ctx

You may chain playstate methods:

const animation = animateCanvas(...).start();

Package Sidebar

Install

npm i @felixgro/animate-canvas

Weekly Downloads

1

Version

2.0.3

License

MIT

Unpacked Size

13.8 kB

Total Files

5

Last publish

Collaborators

  • felixgro