UNPKG

fabric

Version:

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

3 lines (2 loc) 1.04 kB
import{defineProperty as t,objectSpread2 as e}from"../../../_virtual/_rollupPluginBabelHelpers.min.mjs";import{FILL as r,STROKE as o}from"../../constants.min.mjs";import{animateColor as n,animate as i}from"../../util/animation/animate.min.mjs";import{StackedObject as s}from"./StackedObject.min.mjs";class a extends s{animate(t,e){return Object.entries(t).reduce(((t,r)=>{let[o,n]=r;return t[o]=this._animate(o,n,e),t}),{})}_animate(t,r){let o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const s=t.split("."),a=this.constructor.colorProperties.includes(s[s.length-1]),{abort:l,startValue:m,onChange:u,onComplete:c}=o,d=e(e({},o),{},{target:this,startValue:null!=m?m:s.reduce(((t,e)=>t[e]),this),endValue:r,abort:null==l?void 0:l.bind(this),onChange:(t,e,r)=>{s.reduce(((e,r,o)=>(o===s.length-1&&(e[r]=t),e[r])),this),u&&u(t,e,r)},onComplete:(t,e,r)=>{this.setCoords(),c&&c(t,e,r)}});return a?n(d):i(d)}}t(a,"colorProperties",[r,o,"backgroundColor"]);export{a as AnimatableObject}; //# sourceMappingURL=AnimatableObject.min.mjs.map