Here is the solution for the installation, followed by a paper discussing the topic.

Upgrading from an Older Version

If you currently have 0.8.5 or 0.9.0 installed, follow these steps to migrate safely:

  1. Backup your project (commit changes to Git).
  2. Read the changelog (available on GitHub under releases).
  3. Update the version:
    npm install player-animator@0.9.9
    
  4. Test your animations. The breaking changes between 0.8.x and 0.9.9 primarily affect event listener naming (on('play') vs onPlay). Refer to the migration guide.

CDN for Browser (no build tools)

<script type="importmap">
"imports": 
      "player-animator": "https://unpkg.com/player-animator@0.9.9/dist/index.esm.js"
</script>

<script type="module"> import Player from 'player-animator'; const player = new Player( duration: 60 ); </script>

Upgrading from an older version (<0.9.9)

If you have a version older than 0.9.9, breaking changes may exist. To upgrade:

npm install player-animator@latest

Then consult the changelog (replace with actual repo) for migration notes.
Key changes in 0.9.9+ typically include:

Using Version 0.9.9+ in Popular Frameworks

Basic usage example (v0.9.9+)

import PlayerAnimator from 'player-animator';

// Create instance const player = new PlayerAnimator( duration: 2000, // 2 seconds loop: false, easing: t => t, // linear onUpdate: (progress) => // progress = 0..1 document.getElementById('box').style.transform = translateX($progress * 200px); , onComplete: () => console.log('Animation finished'), onPlay: () => console.log('Started'), onPause: () => console.log('Paused') );

// Control player.play(); setTimeout(() => player.pause(), 500); setTimeout(() => player.resume(), 1000);

2. Check in browser console

import PlayerAnimator from 'player-animator';
console.log(PlayerAnimator.version); // "0.9.9" or higher

If you are using the CDN, type in the console:

console.log(window.PlayerAnimator.version);

Step-by-Step Installation Guide

We will cover three primary scenarios: using a package manager (recommended), direct CDN for prototyping, and manual download.

React 18+

import  useEffect, useRef  from 'react';
import  PlayerAnimator  from 'player-animator';

function AnimatedCharacter() const canvasRef = useRef(null);

useEffect(() => const animator = new PlayerAnimator( container: canvasRef.current, versionRequirement: '0.9.9' // built-in check ); animator.loadSpriteSheet('/character.png', frameSize: width: 64, height: 64 ); animator.play('idle');

return () => animator.destroy();

, []);

return <canvas ref=canvasRef />;

Install Player-animator%2c — Version 0.9.9 Or Later. ((exclusive))

Here is the solution for the installation, followed by a paper discussing the topic.

Upgrading from an Older Version

If you currently have 0.8.5 or 0.9.0 installed, follow these steps to migrate safely:

  1. Backup your project (commit changes to Git).
  2. Read the changelog (available on GitHub under releases).
  3. Update the version:
    npm install player-animator@0.9.9
    
  4. Test your animations. The breaking changes between 0.8.x and 0.9.9 primarily affect event listener naming (on('play') vs onPlay). Refer to the migration guide.

CDN for Browser (no build tools)

<script type="importmap">
"imports": 
      "player-animator": "https://unpkg.com/player-animator@0.9.9/dist/index.esm.js"
</script>

<script type="module"> import Player from 'player-animator'; const player = new Player( duration: 60 ); </script>

Upgrading from an older version (<0.9.9)

If you have a version older than 0.9.9, breaking changes may exist. To upgrade: install player-animator%2C version 0.9.9 or later.

npm install player-animator@latest

Then consult the changelog (replace with actual repo) for migration notes.
Key changes in 0.9.9+ typically include:

Using Version 0.9.9+ in Popular Frameworks

Basic usage example (v0.9.9+)

import PlayerAnimator from 'player-animator';

// Create instance const player = new PlayerAnimator( duration: 2000, // 2 seconds loop: false, easing: t => t, // linear onUpdate: (progress) => // progress = 0..1 document.getElementById('box').style.transform = translateX($progress * 200px); , onComplete: () => console.log('Animation finished'), onPlay: () => console.log('Started'), onPause: () => console.log('Paused') );

// Control player.play(); setTimeout(() => player.pause(), 500); setTimeout(() => player.resume(), 1000);

2. Check in browser console

import PlayerAnimator from 'player-animator';
console.log(PlayerAnimator.version); // "0.9.9" or higher

If you are using the CDN, type in the console:

console.log(window.PlayerAnimator.version);

Step-by-Step Installation Guide

We will cover three primary scenarios: using a package manager (recommended), direct CDN for prototyping, and manual download.

React 18+

import  useEffect, useRef  from 'react';
import  PlayerAnimator  from 'player-animator';

function AnimatedCharacter() const canvasRef = useRef(null);

useEffect(() => const animator = new PlayerAnimator( container: canvasRef.current, versionRequirement: '0.9.9' // built-in check ); animator.loadSpriteSheet('/character.png', frameSize: width: 64, height: 64 ); animator.play('idle'); Here is the solution for the installation, followed

return () => animator.destroy();

, []);

return <canvas ref=canvasRef />;

WE USE COOKIES FOR ANALYTICS. BY CONTINUING TO NAVIGATE, YOU AGREE TO THE USE OF COOKIES.