pnpm add player-animator@">=0.9.9"
Attempt to use the seekTo method:
const pa = new PlayerAnimator( duration: 1000, frames: [0,1] );
if (typeof pa.seekTo === 'function')
console.log('✅ Version 0.9.9 or later confirmed (seekTo API exists)');
else
console.error('❌ You have an older version. Reinstall with @0.9.9');
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 />;
If you prefer Yarn or pnpm, the commands are analogous: install player-animator%2C version 0.9.9 or later.
Yarn:
yarn add player-animator@^0.9.9
pnpm:
pnpm add player-animator@0.9.9 // or pnpm add player-animator@latest
Sometimes you just want to test a prototype or work in a legacy environment. You can install player-animator, version 0.9.9 or later via a CDN. Add this script tag to your HTML <head> or just before the closing </body>: pnpm add player-animator@">=0
<script src="https://cdn.jsdelivr.net/npm/player-animator@0.9.9/dist/player-animator.min.js"></script>
For the absolute latest 0.9.x version (e.g., 0.9.12), use:
<script src="https://cdn.jsdelivr.net/npm/player-animator@0.9.x/dist/player-animator.min.js"></script>
Usage in global scope:
const PlayerAnimator = window.PlayerAnimator;
const myAnimation = new PlayerAnimator(
duration: 5000,
frames: [0, 0.25, 0.5, 0.75, 1]
);
⚠️ Warning: Avoid using
@latestin production, as a hypothetical 1.0.0 could introduce breaking changes. Always pin to0.9.xor a specific version. Attempt to use the seekTo method: const pa
Before diving into the installation process, let’s address the obvious question: Why must you specifically install version 0.9.9 or later? The answer lies in the release notes and community feedback.
In short, if you try to use documentation or plugins designed for 0.9.9 with an older version, your animations will likely fail silently or throw cryptic errors.