UNPKG

fabric

Version:

Object model for HTML5 canvas, and SVG-to-canvas parser. Backed by jsdom and node-canvas.

1 lines 1.28 kB
{"version":3,"file":"ArrayAnimation.mjs","names":[],"sources":["../../../../src/util/animation/ArrayAnimation.ts"],"sourcesContent":["import { AnimationBase } from './AnimationBase';\nimport type { ArrayAnimationOptions } from './types';\n\nexport class ArrayAnimation extends AnimationBase<number[]> {\n constructor({\n startValue = [0],\n endValue = [100],\n ...options\n }: ArrayAnimationOptions) {\n super({\n ...options,\n startValue,\n byValue: endValue.map((value, i) => value - startValue[i]),\n });\n }\n protected calculate(timeElapsed: number) {\n const values = this.startValue.map((value, i) =>\n this.easing(timeElapsed, value, this.byValue[i], this.duration, i),\n );\n return {\n value: values,\n valueProgress: Math.abs(\n (values[0] - this.startValue[0]) / this.byValue[0],\n ),\n };\n }\n}\n"],"mappings":";;AAGA,IAAa,iBAAb,cAAoC,cAAwB;CAC1D,YAAY,EACV,aAAa,CAAC,EAAE,EAChB,WAAW,CAAC,IAAI,EAChB,GAAG,WACqB;AACxB,QAAM;GACJ,GAAG;GACH;GACA,SAAS,SAAS,KAAK,OAAO,MAAM,QAAQ,WAAW,GAAG;GAC3D,CAAC;;CAEJ,UAAoB,aAAqB;EACvC,MAAM,SAAS,KAAK,WAAW,KAAK,OAAO,MACzC,KAAK,OAAO,aAAa,OAAO,KAAK,QAAQ,IAAI,KAAK,UAAU,EAAE,CACnE;AACD,SAAO;GACL,OAAO;GACP,eAAe,KAAK,KACjB,OAAO,KAAK,KAAK,WAAW,MAAM,KAAK,QAAQ,GACjD;GACF"}