Skip to content

rutan/frame-tween

Repository files navigation

frame-tween

install

npm install @rutan/frame-tween

Usage

import { createTween, Group, easeInOutSine } from '@rutan/frame-tween';

const tweenGroup = new Group();
const tween = createTween(sprite, tweenGroup, {
  x: 0,
})
  .to(
    {
      x: 100,
    },
    30,
    easeInOutSine,
  )
  .call(() => {
    console.log('finished!');
  })
  .start();

function mainLoop() {
  requestAnimationFrame(mainLoop);
  tweenGroup.update();
}
mainLoop();