{
  "mappings": "KAEK,gBAAgB;CACnB;CACA;CACA;CACA;;KAGG;UAEK,aAAa;CACrB,MAAM;CACN,IAAI;CACJ;CACA,WAAW,OAAO;CAClB,cAAc;;AAGhB,OAAO,iBAAS,QAAQ,OAAO",
  "names": [],
  "sources": [
    "src/index.tsx"
  ],
  "version": 3,
  "sourcesContent": [
    "import { bezier } from './cubicBezier'\n\ntype TransformType = {\n  x: number | undefined\n  y: number | undefined\n  scaleX: number | undefined\n  scaleY: number | undefined\n}\n\ntype CubicBuzier = [number, number, number, number]\n\ninterface AnimateProps {\n  from: TransformType\n  to: TransformType\n  duration: number\n  onUpdate: (param: TransformType) => void\n  cubicBezier?: CubicBuzier\n}\n\nexport function animate(param: AnimateProps): void {\n  let start = null\n  const easing = param.cubicBezier ? bezier(...param.cubicBezier) : (v: number) => v\n\n  const { x: fromX, y: fromY, scaleX: fromScaleX, scaleY: fromScaleY } = param.from\n  const { x: toX, y: toY, scaleX: toScaleX, scaleY: toScaleY } = param.to\n\n  function frame(timestamp) {\n    if (!start) start = timestamp\n    const progress = timestamp - start!\n    const x =\n      toX !== undefined\n        ? fromX! + (toX - fromX!) * easing(progress / param.duration)\n        : undefined // apply the easing function to the progress\n    const y =\n      toY !== undefined\n        ? fromY! + (toY - fromY!) * easing(progress / param.duration)\n        : undefined\n    const scaleX =\n      toScaleX !== undefined\n        ? fromScaleX! + (toScaleX - fromScaleX!) * easing(progress / param.duration)\n        : undefined\n    const scaleY =\n      toScaleY !== undefined\n        ? fromScaleY! + (toScaleY - fromScaleY!) * easing(progress / param.duration)\n        : undefined\n    param.onUpdate({ x, y, scaleX, scaleY })\n\n    if (progress < param.duration) {\n      requestAnimationFrame(frame) // continue animating\n    }\n  }\n  requestAnimationFrame(frame)\n}\n"
  ]
}