@leafer-in/motion-path 1.1.2 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -243,6 +243,7 @@ function motionPathType(defaultValue) {
243
243
  }));
244
244
  }
245
245
 
246
+ draw.Plugin.add('motion-path');
246
247
  draw.Transition.register('motion', function (from, to, t, target) {
247
248
  if (!from)
248
249
  from = 0;
@@ -1,4 +1,4 @@
1
- import { OneRadian, PathCommandMap, MatrixHelper, PointHelper, UnitConvert, BezierHelper, decorateLeafAttr, attr, isNull, Transition, UI, LeafHelper, BranchHelper } from '@leafer-ui/draw';
1
+ import { OneRadian, PathCommandMap, MatrixHelper, PointHelper, UnitConvert, BezierHelper, decorateLeafAttr, attr, isNull, Plugin, Transition, UI, LeafHelper, BranchHelper } from '@leafer-ui/draw';
2
2
 
3
3
  const gaussNodes = [0.1488743389, 0.4333953941, 0.6794095682, 0.8650633666, 0.9739065285];
4
4
  const gaussWeights = [0.2955242247, 0.2692667193, 0.2190863625, 0.1494513491, 0.0666713443];
@@ -241,6 +241,7 @@ function motionPathType(defaultValue) {
241
241
  }));
242
242
  }
243
243
 
244
+ Plugin.add('motion-path');
244
245
  Transition.register('motion', function (from, to, t, target) {
245
246
  if (!from)
246
247
  from = 0;
@@ -1 +1 @@
1
- import{OneRadian as t,PathCommandMap as e,MatrixHelper as o,PointHelper as n,UnitConvert as a,BezierHelper as i,decorateLeafAttr as r,attr as s,isNull as c,Transition as h,UI as u,LeafHelper as l,BranchHelper as f}from"@leafer-ui/draw";const g=[.1488743389,.4333953941,.6794095682,.8650633666,.9739065285],m=[.2955242247,.2692667193,.2190863625,.1494513491,.0666713443],{sqrt:_}=Math,P={getDistance(t,e,o,n,a,i,r,s,c=1){let h,u,l,f,P,p,M=0,y=c/2;for(let c=0;c<g.length;c++)h=y*(1+g[c]),u=y*(1-g[c]),l=d(h,t,o,a,r),f=d(h,e,n,i,s),P=d(u,t,o,a,r),p=d(u,e,n,i,s),M+=m[c]*(_(l*l+f*f)+_(P*P+p*p));return M*y},getDerivative(t,e,o,n,a){const i=1-t;return 3*i*i*(o-e)+6*i*t*(n-o)+3*t*t*(a-n)},getRotation(e,o,n,a,i,r,s,c,h){const u=d(e,o,a,r,c),l=d(e,n,i,s,h);return Math.atan2(l,u)/t},getT(t,e,o,n,a,i,r,s,c,h,u=1){let l=0,f=1,g=t/e,m=u/e/3;if(g>=1)return 1;if(g<=0)return 0;for(;f-l>m;)p(o,n,a,i,r,s,c,h,g)<t?l=g:f=g,g=(l+f)/2;return g},cut(t,o,n,a,i,r,s,c,h,u){const l=1-o,f=l*n+o*i,g=l*a+o*r,m=l*i+o*s,_=l*r+o*c,P=l*f+o*m,d=l*g+o*_,p=l*P+o*(l*m+o*(l*s+o*h)),M=l*d+o*(l*_+o*(l*c+o*u));t.push(e.C,f,g,P,d,p,M)}},{getDerivative:d,getDistance:p}=P,{M:M,L:y,C:b,Z:D}=e,x={},k={},F={transform(t,e){let o,n=0;const a=t.length;for(;n<a;)switch(o=t[n],o){case M:case y:F.transformPoints(t,e,n,1),n+=3;break;case b:F.transformPoints(t,e,n,3),n+=7;break;case D:n+=1}},transformPoints(t,e,n,a){for(let i=n+1,r=i+2*a;i<r;i+=2)x.x=t[i],x.y=t[i+1],o.toOuterPoint(e,x),t[i]=x.x,t[i+1]=x.y},getMotionPathData(t){let e,o,a,i,r=0,s=[],c=0,h=0,u=0;const l=t.length;for(;c<l;){switch(i=t[c],i){case M:case y:o=t[c+1],a=t[c+2],e=i===y&&c>0?n.getDistanceFrom(h,u,o,a):0,h=o,u=a,c+=3;break;case b:o=t[c+5],a=t[c+6],e=P.getDistance(h,u,t[c+1],t[c+2],t[c+3],t[c+4],o,a),h=o,u=a,c+=7;break;case D:c+=1;default:e=0}s.push(e),r+=e}return{total:r,segments:s,data:t}},getDistancePoint(t,e,o){const{segments:r,data:s}=t;e=a.number(e,t.total);let c,h,u,l,f,g,m,_,d,p=0,x={},F=0,R=0,T=0,C=0;const v=s.length;for(;F<v;){switch(l=s[F],l){case M:case y:if(h=s[F+1],u=s[F+2],c=r[R],p+c>e||!t.total)return F||(T=h,C=u),k.x=T,k.y=C,x.x=h,x.y=u,n.getDistancePoint(k,x,e-p,!0),x.rotation=n.getAngle(k,x),x;T=h,C=u,F+=3;break;case b:if(h=s[F+5],u=s[F+6],c=r[R],p+c>e)return f=s[F+1],g=s[F+2],m=s[F+3],_=s[F+4],d=P.getT(e-p,c,T,C,f,g,m,_,h,u,o),i.getPointAndSet(d,T,C,f,g,m,_,h,u,x),x.rotation=P.getRotation(d,T,C,f,g,m,_,h,u),x;T=h,C=u,F+=7;break;case D:F+=1;default:c=0}R++,p+=c}return x},getDistancePath(t,e,o){const{segments:i,data:r}=t,s=[];e=a.number(e,t.total);let c,h,u,l,f,g,m,_,d,p=0,x={},F=0,R=0,T=0,C=0;const v=r.length;for(;F<v;){switch(l=r[F],l){case M:case y:if(h=r[F+1],u=r[F+2],c=i[R],p+c>e||!t.total)return F||(T=h,C=u),k.x=T,k.y=C,x.x=h,x.y=u,n.getDistancePoint(k,x,e-p,!0),s.push(l,x.x,x.y),s;T=h,C=u,F+=3,s.push(l,T,C);break;case b:if(f=r[F+1],g=r[F+2],m=r[F+3],_=r[F+4],h=r[F+5],u=r[F+6],c=i[R],p+c>e)return d=P.getT(e-p,c,T,C,f,g,m,_,h,u,o),P.cut(s,d,T,C,f,g,m,_,h,u),s;T=h,C=u,F+=7,s.push(l,f,g,m,_,h,u);break;case D:F+=1,s.push(l);default:c=0}R++,p+=c}return s}};function R(t){return r(t,(t=>s({set(e){this.__setAttr(t,e),this.__hasMotionPath=this.motionPath||!c(this.motion),this.__layout.matrixChanged||this.__layout.matrixChange()}})))}h.register("motion",(function(t,e,o,n){return t?"object"==typeof t&&(t=a.number(t,n.getMotionTotal())):t=0,e?"object"==typeof e&&(e=a.number(e,n.getMotionTotal())):e=0,h.number(t,e,o)})),h.register("motionRotation",(function(t,e,o){return h.number(t,e,o)}));const T=u.prototype,{updateMatrix:C,updateAllMatrix:v}=l,{updateBounds:w}=f;function A(t){const{motion:e,leaferIsCreated:o}=t;if(!c(e)){if(o&&(t.leafer.created=!1),t.motionPath){const o=B(t);o.total&&(t.__.__pathForRender=F.getDistancePath(o,e,t.motionPrecision))}else t.set(t.getMotionPoint(e)),t.__hasAutoLayout||(t.isBranch?(v(t),w(t,t)):C(t));o&&(t.leafer.created=!0)}}function j(t){const{parent:e}=t;if(!t.motionPath&&e){const{children:t}=e;for(let e=0;e<t.length;e++)if(t[e].motionPath)return t[e]}return t}function B(t){const e=t.__;return e.__pathForMotion?e.__pathForMotion:e.__pathForMotion=F.getMotionPathData(t.getPath(!0,!0))}R()(T,"motionPath"),R(1)(T,"motionPrecision"),R()(T,"motion"),R(!0)(T,"motionRotation"),T.getMotionPathData=function(){return B(j(this))},T.getMotionPoint=function(t){const e=j(this),n=B(e);if(!n.total)return{};const a=F.getDistancePoint(n,t,e.motionPrecision);o.toOuterPoint(e.localTransform,a);const{motionRotation:i}=this;return!1===i?delete a.rotation:"number"==typeof i&&(a.rotation+=i),a},T.getMotionTotal=function(){return this.getMotionPathData().total},T.__updateMotionPath=function(){const t=this.__;if(this.__layout.resized&&t.__pathForMotion&&(t.__pathForMotion=void 0),this.motionPath){let t;const{children:e}=this.parent,{leaferIsReady:o}=this;for(let n=0;n<e.length;n++)t=e[n],c(t.motion)||t.__layout.matrixChanged||(o&&t!==this&&this.leafer.layouter.addExtra(t),A(t))}else A(this)};export{P as HighBezierHelper,F as HighCurveHelper,R as motionPathType};
1
+ import{OneRadian as t,PathCommandMap as e,MatrixHelper as o,PointHelper as n,UnitConvert as a,BezierHelper as i,decorateLeafAttr as r,attr as s,isNull as c,Plugin as h,Transition as u,UI as l,LeafHelper as f,BranchHelper as g}from"@leafer-ui/draw";const m=[.1488743389,.4333953941,.6794095682,.8650633666,.9739065285],_=[.2955242247,.2692667193,.2190863625,.1494513491,.0666713443],{sqrt:P}=Math,d={getDistance(t,e,o,n,a,i,r,s,c=1){let h,u,l,f,g,d,M=0,y=c/2;for(let c=0;c<m.length;c++)h=y*(1+m[c]),u=y*(1-m[c]),l=p(h,t,o,a,r),f=p(h,e,n,i,s),g=p(u,t,o,a,r),d=p(u,e,n,i,s),M+=_[c]*(P(l*l+f*f)+P(g*g+d*d));return M*y},getDerivative(t,e,o,n,a){const i=1-t;return 3*i*i*(o-e)+6*i*t*(n-o)+3*t*t*(a-n)},getRotation(e,o,n,a,i,r,s,c,h){const u=p(e,o,a,r,c),l=p(e,n,i,s,h);return Math.atan2(l,u)/t},getT(t,e,o,n,a,i,r,s,c,h,u=1){let l=0,f=1,g=t/e,m=u/e/3;if(g>=1)return 1;if(g<=0)return 0;for(;f-l>m;)M(o,n,a,i,r,s,c,h,g)<t?l=g:f=g,g=(l+f)/2;return g},cut(t,o,n,a,i,r,s,c,h,u){const l=1-o,f=l*n+o*i,g=l*a+o*r,m=l*i+o*s,_=l*r+o*c,P=l*f+o*m,d=l*g+o*_,p=l*P+o*(l*m+o*(l*s+o*h)),M=l*d+o*(l*_+o*(l*c+o*u));t.push(e.C,f,g,P,d,p,M)}},{getDerivative:p,getDistance:M}=d,{M:y,L:b,C:D,Z:x}=e,k={},F={},R={transform(t,e){let o,n=0;const a=t.length;for(;n<a;)switch(o=t[n],o){case y:case b:R.transformPoints(t,e,n,1),n+=3;break;case D:R.transformPoints(t,e,n,3),n+=7;break;case x:n+=1}},transformPoints(t,e,n,a){for(let i=n+1,r=i+2*a;i<r;i+=2)k.x=t[i],k.y=t[i+1],o.toOuterPoint(e,k),t[i]=k.x,t[i+1]=k.y},getMotionPathData(t){let e,o,a,i,r=0,s=[],c=0,h=0,u=0;const l=t.length;for(;c<l;){switch(i=t[c],i){case y:case b:o=t[c+1],a=t[c+2],e=i===b&&c>0?n.getDistanceFrom(h,u,o,a):0,h=o,u=a,c+=3;break;case D:o=t[c+5],a=t[c+6],e=d.getDistance(h,u,t[c+1],t[c+2],t[c+3],t[c+4],o,a),h=o,u=a,c+=7;break;case x:c+=1;default:e=0}s.push(e),r+=e}return{total:r,segments:s,data:t}},getDistancePoint(t,e,o){const{segments:r,data:s}=t;e=a.number(e,t.total);let c,h,u,l,f,g,m,_,P,p=0,M={},k=0,R=0,T=0,C=0;const v=s.length;for(;k<v;){switch(l=s[k],l){case y:case b:if(h=s[k+1],u=s[k+2],c=r[R],p+c>e||!t.total)return k||(T=h,C=u),F.x=T,F.y=C,M.x=h,M.y=u,n.getDistancePoint(F,M,e-p,!0),M.rotation=n.getAngle(F,M),M;T=h,C=u,k+=3;break;case D:if(h=s[k+5],u=s[k+6],c=r[R],p+c>e)return f=s[k+1],g=s[k+2],m=s[k+3],_=s[k+4],P=d.getT(e-p,c,T,C,f,g,m,_,h,u,o),i.getPointAndSet(P,T,C,f,g,m,_,h,u,M),M.rotation=d.getRotation(P,T,C,f,g,m,_,h,u),M;T=h,C=u,k+=7;break;case x:k+=1;default:c=0}R++,p+=c}return M},getDistancePath(t,e,o){const{segments:i,data:r}=t,s=[];e=a.number(e,t.total);let c,h,u,l,f,g,m,_,P,p=0,M={},k=0,R=0,T=0,C=0;const v=r.length;for(;k<v;){switch(l=r[k],l){case y:case b:if(h=r[k+1],u=r[k+2],c=i[R],p+c>e||!t.total)return k||(T=h,C=u),F.x=T,F.y=C,M.x=h,M.y=u,n.getDistancePoint(F,M,e-p,!0),s.push(l,M.x,M.y),s;T=h,C=u,k+=3,s.push(l,T,C);break;case D:if(f=r[k+1],g=r[k+2],m=r[k+3],_=r[k+4],h=r[k+5],u=r[k+6],c=i[R],p+c>e)return P=d.getT(e-p,c,T,C,f,g,m,_,h,u,o),d.cut(s,P,T,C,f,g,m,_,h,u),s;T=h,C=u,k+=7,s.push(l,f,g,m,_,h,u);break;case x:k+=1,s.push(l);default:c=0}R++,p+=c}return s}};function T(t){return r(t,(t=>s({set(e){this.__setAttr(t,e),this.__hasMotionPath=this.motionPath||!c(this.motion),this.__layout.matrixChanged||this.__layout.matrixChange()}})))}h.add("motion-path"),u.register("motion",(function(t,e,o,n){return t?"object"==typeof t&&(t=a.number(t,n.getMotionTotal())):t=0,e?"object"==typeof e&&(e=a.number(e,n.getMotionTotal())):e=0,u.number(t,e,o)})),u.register("motionRotation",(function(t,e,o){return u.number(t,e,o)}));const C=l.prototype,{updateMatrix:v,updateAllMatrix:w}=f,{updateBounds:A}=g;function j(t){const{motion:e,leaferIsCreated:o}=t;if(!c(e)){if(o&&(t.leafer.created=!1),t.motionPath){const o=I(t);o.total&&(t.__.__pathForRender=R.getDistancePath(o,e,t.motionPrecision))}else t.set(t.getMotionPoint(e)),t.__hasAutoLayout||(t.isBranch?(w(t),A(t,t)):v(t));o&&(t.leafer.created=!0)}}function B(t){const{parent:e}=t;if(!t.motionPath&&e){const{children:t}=e;for(let e=0;e<t.length;e++)if(t[e].motionPath)return t[e]}return t}function I(t){const e=t.__;return e.__pathForMotion?e.__pathForMotion:e.__pathForMotion=R.getMotionPathData(t.getPath(!0,!0))}T()(C,"motionPath"),T(1)(C,"motionPrecision"),T()(C,"motion"),T(!0)(C,"motionRotation"),C.getMotionPathData=function(){return I(B(this))},C.getMotionPoint=function(t){const e=B(this),n=I(e);if(!n.total)return{};const a=R.getDistancePoint(n,t,e.motionPrecision);o.toOuterPoint(e.localTransform,a);const{motionRotation:i}=this;return!1===i?delete a.rotation:"number"==typeof i&&(a.rotation+=i),a},C.getMotionTotal=function(){return this.getMotionPathData().total},C.__updateMotionPath=function(){const t=this.__;if(this.__layout.resized&&t.__pathForMotion&&(t.__pathForMotion=void 0),this.motionPath){let t;const{children:e}=this.parent,{leaferIsReady:o}=this;for(let n=0;n<e.length;n++)t=e[n],c(t.motion)||t.__layout.matrixChanged||(o&&t!==this&&this.leafer.layouter.addExtra(t),j(t))}else j(this)};export{d as HighBezierHelper,R as HighCurveHelper,T as motionPathType};
@@ -243,6 +243,7 @@ this.LeaferIN.motionPath = (function (exports, draw) {
243
243
  }));
244
244
  }
245
245
 
246
+ draw.Plugin.add('motion-path');
246
247
  draw.Transition.register('motion', function (from, to, t, target) {
247
248
  if (!from)
248
249
  from = 0;
@@ -1 +1 @@
1
- "use strict";var t=require("@leafer-ui/draw");const e=[.1488743389,.4333953941,.6794095682,.8650633666,.9739065285],o=[.2955242247,.2692667193,.2190863625,.1494513491,.0666713443],{sqrt:n}=Math,r={getDistance(t,r,i,s,c,h,u,l,f=1){let g,m,p,P,_,d,M=0,y=f/2;for(let f=0;f<e.length;f++)g=y*(1+e[f]),m=y*(1-e[f]),p=a(g,t,i,c,u),P=a(g,r,s,h,l),_=a(m,t,i,c,u),d=a(m,r,s,h,l),M+=o[f]*(n(p*p+P*P)+n(_*_+d*d));return M*y},getDerivative(t,e,o,n,r){const a=1-t;return 3*a*a*(o-e)+6*a*t*(n-o)+3*t*t*(r-n)},getRotation(e,o,n,r,i,s,c,h,u){const l=a(e,o,r,s,h),f=a(e,n,i,c,u);return Math.atan2(f,l)/t.OneRadian},getT(t,e,o,n,r,a,s,c,h,u,l=1){let f=0,g=1,m=t/e,p=l/e/3;if(m>=1)return 1;if(m<=0)return 0;for(;g-f>p;)i(o,n,r,a,s,c,h,u,m)<t?f=m:g=m,m=(f+g)/2;return m},cut(e,o,n,r,a,i,s,c,h,u){const l=1-o,f=l*n+o*a,g=l*r+o*i,m=l*a+o*s,p=l*i+o*c,P=l*f+o*m,_=l*g+o*p,d=l*P+o*(l*m+o*(l*s+o*h)),M=l*_+o*(l*p+o*(l*c+o*u));e.push(t.PathCommandMap.C,f,g,P,_,d,M)}},{getDerivative:a,getDistance:i}=r,{M:s,L:c,C:h,Z:u}=t.PathCommandMap,l={},f={},g={transform(t,e){let o,n=0;const r=t.length;for(;n<r;)switch(o=t[n],o){case s:case c:g.transformPoints(t,e,n,1),n+=3;break;case h:g.transformPoints(t,e,n,3),n+=7;break;case u:n+=1}},transformPoints(e,o,n,r){for(let a=n+1,i=a+2*r;a<i;a+=2)l.x=e[a],l.y=e[a+1],t.MatrixHelper.toOuterPoint(o,l),e[a]=l.x,e[a+1]=l.y},getMotionPathData(e){let o,n,a,i,l=0,f=[],g=0,m=0,p=0;const P=e.length;for(;g<P;){switch(i=e[g],i){case s:case c:n=e[g+1],a=e[g+2],o=i===c&&g>0?t.PointHelper.getDistanceFrom(m,p,n,a):0,m=n,p=a,g+=3;break;case h:n=e[g+5],a=e[g+6],o=r.getDistance(m,p,e[g+1],e[g+2],e[g+3],e[g+4],n,a),m=n,p=a,g+=7;break;case u:g+=1;default:o=0}f.push(o),l+=o}return{total:l,segments:f,data:e}},getDistancePoint(e,o,n){const{segments:a,data:i}=e;o=t.UnitConvert.number(o,e.total);let l,g,m,p,P,_,d,M,y,x=0,b={},D=0,C=0,H=0,T=0;const v=i.length;for(;D<v;){switch(p=i[D],p){case s:case c:if(g=i[D+1],m=i[D+2],l=a[C],x+l>o||!e.total)return D||(H=g,T=m),f.x=H,f.y=T,b.x=g,b.y=m,t.PointHelper.getDistancePoint(f,b,o-x,!0),b.rotation=t.PointHelper.getAngle(f,b),b;H=g,T=m,D+=3;break;case h:if(g=i[D+5],m=i[D+6],l=a[C],x+l>o)return P=i[D+1],_=i[D+2],d=i[D+3],M=i[D+4],y=r.getT(o-x,l,H,T,P,_,d,M,g,m,n),t.BezierHelper.getPointAndSet(y,H,T,P,_,d,M,g,m,b),b.rotation=r.getRotation(y,H,T,P,_,d,M,g,m),b;H=g,T=m,D+=7;break;case u:D+=1;default:l=0}C++,x+=l}return b},getDistancePath(e,o,n){const{segments:a,data:i}=e,l=[];o=t.UnitConvert.number(o,e.total);let g,m,p,P,_,d,M,y,x,b=0,D={},C=0,H=0,T=0,v=0;const k=i.length;for(;C<k;){switch(P=i[C],P){case s:case c:if(m=i[C+1],p=i[C+2],g=a[H],b+g>o||!e.total)return C||(T=m,v=p),f.x=T,f.y=v,D.x=m,D.y=p,t.PointHelper.getDistancePoint(f,D,o-b,!0),l.push(P,D.x,D.y),l;T=m,v=p,C+=3,l.push(P,T,v);break;case h:if(_=i[C+1],d=i[C+2],M=i[C+3],y=i[C+4],m=i[C+5],p=i[C+6],g=a[H],b+g>o)return x=r.getT(o-b,g,T,v,_,d,M,y,m,p,n),r.cut(l,x,T,v,_,d,M,y,m,p),l;T=m,v=p,C+=7,l.push(P,_,d,M,y,m,p);break;case u:C+=1,l.push(P);default:g=0}H++,b+=g}return l}};function m(e){return t.decorateLeafAttr(e,(e=>t.attr({set(o){this.__setAttr(e,o),this.__hasMotionPath=this.motionPath||!t.isNull(this.motion),this.__layout.matrixChanged||this.__layout.matrixChange()}})))}t.Transition.register("motion",(function(e,o,n,r){return e?"object"==typeof e&&(e=t.UnitConvert.number(e,r.getMotionTotal())):e=0,o?"object"==typeof o&&(o=t.UnitConvert.number(o,r.getMotionTotal())):o=0,t.Transition.number(e,o,n)})),t.Transition.register("motionRotation",(function(e,o,n){return t.Transition.number(e,o,n)}));const p=t.UI.prototype,{updateMatrix:P,updateAllMatrix:_}=t.LeafHelper,{updateBounds:d}=t.BranchHelper;function M(e){const{motion:o,leaferIsCreated:n}=e;if(!t.isNull(o)){if(n&&(e.leafer.created=!1),e.motionPath){const t=x(e);t.total&&(e.__.__pathForRender=g.getDistancePath(t,o,e.motionPrecision))}else e.set(e.getMotionPoint(o)),e.__hasAutoLayout||(e.isBranch?(_(e),d(e,e)):P(e));n&&(e.leafer.created=!0)}}function y(t){const{parent:e}=t;if(!t.motionPath&&e){const{children:t}=e;for(let e=0;e<t.length;e++)if(t[e].motionPath)return t[e]}return t}function x(t){const e=t.__;return e.__pathForMotion?e.__pathForMotion:e.__pathForMotion=g.getMotionPathData(t.getPath(!0,!0))}m()(p,"motionPath"),m(1)(p,"motionPrecision"),m()(p,"motion"),m(!0)(p,"motionRotation"),p.getMotionPathData=function(){return x(y(this))},p.getMotionPoint=function(e){const o=y(this),n=x(o);if(!n.total)return{};const r=g.getDistancePoint(n,e,o.motionPrecision);t.MatrixHelper.toOuterPoint(o.localTransform,r);const{motionRotation:a}=this;return!1===a?delete r.rotation:"number"==typeof a&&(r.rotation+=a),r},p.getMotionTotal=function(){return this.getMotionPathData().total},p.__updateMotionPath=function(){const e=this.__;if(this.__layout.resized&&e.__pathForMotion&&(e.__pathForMotion=void 0),this.motionPath){let e;const{children:o}=this.parent,{leaferIsReady:n}=this;for(let r=0;r<o.length;r++)e=o[r],t.isNull(e.motion)||e.__layout.matrixChanged||(n&&e!==this&&this.leafer.layouter.addExtra(e),M(e))}else M(this)},exports.HighBezierHelper=r,exports.HighCurveHelper=g,exports.motionPathType=m;
1
+ "use strict";var t=require("@leafer-ui/draw");const e=[.1488743389,.4333953941,.6794095682,.8650633666,.9739065285],o=[.2955242247,.2692667193,.2190863625,.1494513491,.0666713443],{sqrt:n}=Math,r={getDistance(t,r,i,s,c,h,u,l,f=1){let g,m,p,P,_,d,M=0,y=f/2;for(let f=0;f<e.length;f++)g=y*(1+e[f]),m=y*(1-e[f]),p=a(g,t,i,c,u),P=a(g,r,s,h,l),_=a(m,t,i,c,u),d=a(m,r,s,h,l),M+=o[f]*(n(p*p+P*P)+n(_*_+d*d));return M*y},getDerivative(t,e,o,n,r){const a=1-t;return 3*a*a*(o-e)+6*a*t*(n-o)+3*t*t*(r-n)},getRotation(e,o,n,r,i,s,c,h,u){const l=a(e,o,r,s,h),f=a(e,n,i,c,u);return Math.atan2(f,l)/t.OneRadian},getT(t,e,o,n,r,a,s,c,h,u,l=1){let f=0,g=1,m=t/e,p=l/e/3;if(m>=1)return 1;if(m<=0)return 0;for(;g-f>p;)i(o,n,r,a,s,c,h,u,m)<t?f=m:g=m,m=(f+g)/2;return m},cut(e,o,n,r,a,i,s,c,h,u){const l=1-o,f=l*n+o*a,g=l*r+o*i,m=l*a+o*s,p=l*i+o*c,P=l*f+o*m,_=l*g+o*p,d=l*P+o*(l*m+o*(l*s+o*h)),M=l*_+o*(l*p+o*(l*c+o*u));e.push(t.PathCommandMap.C,f,g,P,_,d,M)}},{getDerivative:a,getDistance:i}=r,{M:s,L:c,C:h,Z:u}=t.PathCommandMap,l={},f={},g={transform(t,e){let o,n=0;const r=t.length;for(;n<r;)switch(o=t[n],o){case s:case c:g.transformPoints(t,e,n,1),n+=3;break;case h:g.transformPoints(t,e,n,3),n+=7;break;case u:n+=1}},transformPoints(e,o,n,r){for(let a=n+1,i=a+2*r;a<i;a+=2)l.x=e[a],l.y=e[a+1],t.MatrixHelper.toOuterPoint(o,l),e[a]=l.x,e[a+1]=l.y},getMotionPathData(e){let o,n,a,i,l=0,f=[],g=0,m=0,p=0;const P=e.length;for(;g<P;){switch(i=e[g],i){case s:case c:n=e[g+1],a=e[g+2],o=i===c&&g>0?t.PointHelper.getDistanceFrom(m,p,n,a):0,m=n,p=a,g+=3;break;case h:n=e[g+5],a=e[g+6],o=r.getDistance(m,p,e[g+1],e[g+2],e[g+3],e[g+4],n,a),m=n,p=a,g+=7;break;case u:g+=1;default:o=0}f.push(o),l+=o}return{total:l,segments:f,data:e}},getDistancePoint(e,o,n){const{segments:a,data:i}=e;o=t.UnitConvert.number(o,e.total);let l,g,m,p,P,_,d,M,y,x=0,b={},D=0,C=0,H=0,T=0;const v=i.length;for(;D<v;){switch(p=i[D],p){case s:case c:if(g=i[D+1],m=i[D+2],l=a[C],x+l>o||!e.total)return D||(H=g,T=m),f.x=H,f.y=T,b.x=g,b.y=m,t.PointHelper.getDistancePoint(f,b,o-x,!0),b.rotation=t.PointHelper.getAngle(f,b),b;H=g,T=m,D+=3;break;case h:if(g=i[D+5],m=i[D+6],l=a[C],x+l>o)return P=i[D+1],_=i[D+2],d=i[D+3],M=i[D+4],y=r.getT(o-x,l,H,T,P,_,d,M,g,m,n),t.BezierHelper.getPointAndSet(y,H,T,P,_,d,M,g,m,b),b.rotation=r.getRotation(y,H,T,P,_,d,M,g,m),b;H=g,T=m,D+=7;break;case u:D+=1;default:l=0}C++,x+=l}return b},getDistancePath(e,o,n){const{segments:a,data:i}=e,l=[];o=t.UnitConvert.number(o,e.total);let g,m,p,P,_,d,M,y,x,b=0,D={},C=0,H=0,T=0,v=0;const k=i.length;for(;C<k;){switch(P=i[C],P){case s:case c:if(m=i[C+1],p=i[C+2],g=a[H],b+g>o||!e.total)return C||(T=m,v=p),f.x=T,f.y=v,D.x=m,D.y=p,t.PointHelper.getDistancePoint(f,D,o-b,!0),l.push(P,D.x,D.y),l;T=m,v=p,C+=3,l.push(P,T,v);break;case h:if(_=i[C+1],d=i[C+2],M=i[C+3],y=i[C+4],m=i[C+5],p=i[C+6],g=a[H],b+g>o)return x=r.getT(o-b,g,T,v,_,d,M,y,m,p,n),r.cut(l,x,T,v,_,d,M,y,m,p),l;T=m,v=p,C+=7,l.push(P,_,d,M,y,m,p);break;case u:C+=1,l.push(P);default:g=0}H++,b+=g}return l}};function m(e){return t.decorateLeafAttr(e,(e=>t.attr({set(o){this.__setAttr(e,o),this.__hasMotionPath=this.motionPath||!t.isNull(this.motion),this.__layout.matrixChanged||this.__layout.matrixChange()}})))}t.Plugin.add("motion-path"),t.Transition.register("motion",(function(e,o,n,r){return e?"object"==typeof e&&(e=t.UnitConvert.number(e,r.getMotionTotal())):e=0,o?"object"==typeof o&&(o=t.UnitConvert.number(o,r.getMotionTotal())):o=0,t.Transition.number(e,o,n)})),t.Transition.register("motionRotation",(function(e,o,n){return t.Transition.number(e,o,n)}));const p=t.UI.prototype,{updateMatrix:P,updateAllMatrix:_}=t.LeafHelper,{updateBounds:d}=t.BranchHelper;function M(e){const{motion:o,leaferIsCreated:n}=e;if(!t.isNull(o)){if(n&&(e.leafer.created=!1),e.motionPath){const t=x(e);t.total&&(e.__.__pathForRender=g.getDistancePath(t,o,e.motionPrecision))}else e.set(e.getMotionPoint(o)),e.__hasAutoLayout||(e.isBranch?(_(e),d(e,e)):P(e));n&&(e.leafer.created=!0)}}function y(t){const{parent:e}=t;if(!t.motionPath&&e){const{children:t}=e;for(let e=0;e<t.length;e++)if(t[e].motionPath)return t[e]}return t}function x(t){const e=t.__;return e.__pathForMotion?e.__pathForMotion:e.__pathForMotion=g.getMotionPathData(t.getPath(!0,!0))}m()(p,"motionPath"),m(1)(p,"motionPrecision"),m()(p,"motion"),m(!0)(p,"motionRotation"),p.getMotionPathData=function(){return x(y(this))},p.getMotionPoint=function(e){const o=y(this),n=x(o);if(!n.total)return{};const r=g.getDistancePoint(n,e,o.motionPrecision);t.MatrixHelper.toOuterPoint(o.localTransform,r);const{motionRotation:a}=this;return!1===a?delete r.rotation:"number"==typeof a&&(r.rotation+=a),r},p.getMotionTotal=function(){return this.getMotionPathData().total},p.__updateMotionPath=function(){const e=this.__;if(this.__layout.resized&&e.__pathForMotion&&(e.__pathForMotion=void 0),this.motionPath){let e;const{children:o}=this.parent,{leaferIsReady:n}=this;for(let r=0;r<o.length;r++)e=o[r],t.isNull(e.motion)||e.__layout.matrixChanged||(n&&e!==this&&this.leafer.layouter.addExtra(e),M(e))}else M(this)},exports.HighBezierHelper=r,exports.HighCurveHelper=g,exports.motionPathType=m;
@@ -1 +1 @@
1
- this.LeaferIN=this.LeaferIN||{},this.LeaferIN.motionPath=function(t,e){"use strict";const o=[.1488743389,.4333953941,.6794095682,.8650633666,.9739065285],n=[.2955242247,.2692667193,.2190863625,.1494513491,.0666713443],{sqrt:a}=Math,i={getDistance(t,e,i,s,c,h,u,l,f=1){let g,m,P,p,_,d,M=0,y=f/2;for(let f=0;f<o.length;f++)g=y*(1+o[f]),m=y*(1-o[f]),P=r(g,t,i,c,u),p=r(g,e,s,h,l),_=r(m,t,i,c,u),d=r(m,e,s,h,l),M+=n[f]*(a(P*P+p*p)+a(_*_+d*d));return M*y},getDerivative(t,e,o,n,a){const i=1-t;return 3*i*i*(o-e)+6*i*t*(n-o)+3*t*t*(a-n)},getRotation(t,o,n,a,i,s,c,h,u){const l=r(t,o,a,s,h),f=r(t,n,i,c,u);return Math.atan2(f,l)/e.OneRadian},getT(t,e,o,n,a,i,r,c,h,u,l=1){let f=0,g=1,m=t/e,P=l/e/3;if(m>=1)return 1;if(m<=0)return 0;for(;g-f>P;)s(o,n,a,i,r,c,h,u,m)<t?f=m:g=m,m=(f+g)/2;return m},cut(t,o,n,a,i,r,s,c,h,u){const l=1-o,f=l*n+o*i,g=l*a+o*r,m=l*i+o*s,P=l*r+o*c,p=l*f+o*m,_=l*g+o*P,d=l*p+o*(l*m+o*(l*s+o*h)),M=l*_+o*(l*P+o*(l*c+o*u));t.push(e.PathCommandMap.C,f,g,p,_,d,M)}},{getDerivative:r,getDistance:s}=i,{M:c,L:h,C:u,Z:l}=e.PathCommandMap,f={},g={},m={transform(t,e){let o,n=0;const a=t.length;for(;n<a;)switch(o=t[n],o){case c:case h:m.transformPoints(t,e,n,1),n+=3;break;case u:m.transformPoints(t,e,n,3),n+=7;break;case l:n+=1}},transformPoints(t,o,n,a){for(let i=n+1,r=i+2*a;i<r;i+=2)f.x=t[i],f.y=t[i+1],e.MatrixHelper.toOuterPoint(o,f),t[i]=f.x,t[i+1]=f.y},getMotionPathData(t){let o,n,a,r,s=0,f=[],g=0,m=0,P=0;const p=t.length;for(;g<p;){switch(r=t[g],r){case c:case h:n=t[g+1],a=t[g+2],o=r===h&&g>0?e.PointHelper.getDistanceFrom(m,P,n,a):0,m=n,P=a,g+=3;break;case u:n=t[g+5],a=t[g+6],o=i.getDistance(m,P,t[g+1],t[g+2],t[g+3],t[g+4],n,a),m=n,P=a,g+=7;break;case l:g+=1;default:o=0}f.push(o),s+=o}return{total:s,segments:f,data:t}},getDistancePoint(t,o,n){const{segments:a,data:r}=t;o=e.UnitConvert.number(o,t.total);let s,f,m,P,p,_,d,M,y,b=0,D={},x=0,C=0,H=0,T=0;const v=r.length;for(;x<v;){switch(P=r[x],P){case c:case h:if(f=r[x+1],m=r[x+2],s=a[C],b+s>o||!t.total)return x||(H=f,T=m),g.x=H,g.y=T,D.x=f,D.y=m,e.PointHelper.getDistancePoint(g,D,o-b,!0),D.rotation=e.PointHelper.getAngle(g,D),D;H=f,T=m,x+=3;break;case u:if(f=r[x+5],m=r[x+6],s=a[C],b+s>o)return p=r[x+1],_=r[x+2],d=r[x+3],M=r[x+4],y=i.getT(o-b,s,H,T,p,_,d,M,f,m,n),e.BezierHelper.getPointAndSet(y,H,T,p,_,d,M,f,m,D),D.rotation=i.getRotation(y,H,T,p,_,d,M,f,m),D;H=f,T=m,x+=7;break;case l:x+=1;default:s=0}C++,b+=s}return D},getDistancePath(t,o,n){const{segments:a,data:r}=t,s=[];o=e.UnitConvert.number(o,t.total);let f,m,P,p,_,d,M,y,b,D=0,x={},C=0,H=0,T=0,v=0;const k=r.length;for(;C<k;){switch(p=r[C],p){case c:case h:if(m=r[C+1],P=r[C+2],f=a[H],D+f>o||!t.total)return C||(T=m,v=P),g.x=T,g.y=v,x.x=m,x.y=P,e.PointHelper.getDistancePoint(g,x,o-D,!0),s.push(p,x.x,x.y),s;T=m,v=P,C+=3,s.push(p,T,v);break;case u:if(_=r[C+1],d=r[C+2],M=r[C+3],y=r[C+4],m=r[C+5],P=r[C+6],f=a[H],D+f>o)return b=i.getT(o-D,f,T,v,_,d,M,y,m,P,n),i.cut(s,b,T,v,_,d,M,y,m,P),s;T=m,v=P,C+=7,s.push(p,_,d,M,y,m,P);break;case l:C+=1,s.push(p);default:f=0}H++,D+=f}return s}};function P(t){return e.decorateLeafAttr(t,(t=>e.attr({set(o){this.__setAttr(t,o),this.__hasMotionPath=this.motionPath||!e.isNull(this.motion),this.__layout.matrixChanged||this.__layout.matrixChange()}})))}e.Transition.register("motion",(function(t,o,n,a){return t?"object"==typeof t&&(t=e.UnitConvert.number(t,a.getMotionTotal())):t=0,o?"object"==typeof o&&(o=e.UnitConvert.number(o,a.getMotionTotal())):o=0,e.Transition.number(t,o,n)})),e.Transition.register("motionRotation",(function(t,o,n){return e.Transition.number(t,o,n)}));const p=e.UI.prototype,{updateMatrix:_,updateAllMatrix:d}=e.LeafHelper,{updateBounds:M}=e.BranchHelper;function y(t){const{motion:o,leaferIsCreated:n}=t;if(!e.isNull(o)){if(n&&(t.leafer.created=!1),t.motionPath){const e=D(t);e.total&&(t.__.__pathForRender=m.getDistancePath(e,o,t.motionPrecision))}else t.set(t.getMotionPoint(o)),t.__hasAutoLayout||(t.isBranch?(d(t),M(t,t)):_(t));n&&(t.leafer.created=!0)}}function b(t){const{parent:e}=t;if(!t.motionPath&&e){const{children:t}=e;for(let e=0;e<t.length;e++)if(t[e].motionPath)return t[e]}return t}function D(t){const e=t.__;return e.__pathForMotion?e.__pathForMotion:e.__pathForMotion=m.getMotionPathData(t.getPath(!0,!0))}return P()(p,"motionPath"),P(1)(p,"motionPrecision"),P()(p,"motion"),P(!0)(p,"motionRotation"),p.getMotionPathData=function(){return D(b(this))},p.getMotionPoint=function(t){const o=b(this),n=D(o);if(!n.total)return{};const a=m.getDistancePoint(n,t,o.motionPrecision);e.MatrixHelper.toOuterPoint(o.localTransform,a);const{motionRotation:i}=this;return!1===i?delete a.rotation:"number"==typeof i&&(a.rotation+=i),a},p.getMotionTotal=function(){return this.getMotionPathData().total},p.__updateMotionPath=function(){const t=this.__;if(this.__layout.resized&&t.__pathForMotion&&(t.__pathForMotion=void 0),this.motionPath){let t;const{children:o}=this.parent,{leaferIsReady:n}=this;for(let a=0;a<o.length;a++)t=o[a],e.isNull(t.motion)||t.__layout.matrixChanged||(n&&t!==this&&this.leafer.layouter.addExtra(t),y(t))}else y(this)},t.HighBezierHelper=i,t.HighCurveHelper=m,t.motionPathType=P,t}({},LeaferUI);
1
+ this.LeaferIN=this.LeaferIN||{},this.LeaferIN.motionPath=function(t,e){"use strict";const o=[.1488743389,.4333953941,.6794095682,.8650633666,.9739065285],n=[.2955242247,.2692667193,.2190863625,.1494513491,.0666713443],{sqrt:a}=Math,i={getDistance(t,e,i,s,c,h,u,l,f=1){let g,m,P,p,_,d,M=0,y=f/2;for(let f=0;f<o.length;f++)g=y*(1+o[f]),m=y*(1-o[f]),P=r(g,t,i,c,u),p=r(g,e,s,h,l),_=r(m,t,i,c,u),d=r(m,e,s,h,l),M+=n[f]*(a(P*P+p*p)+a(_*_+d*d));return M*y},getDerivative(t,e,o,n,a){const i=1-t;return 3*i*i*(o-e)+6*i*t*(n-o)+3*t*t*(a-n)},getRotation(t,o,n,a,i,s,c,h,u){const l=r(t,o,a,s,h),f=r(t,n,i,c,u);return Math.atan2(f,l)/e.OneRadian},getT(t,e,o,n,a,i,r,c,h,u,l=1){let f=0,g=1,m=t/e,P=l/e/3;if(m>=1)return 1;if(m<=0)return 0;for(;g-f>P;)s(o,n,a,i,r,c,h,u,m)<t?f=m:g=m,m=(f+g)/2;return m},cut(t,o,n,a,i,r,s,c,h,u){const l=1-o,f=l*n+o*i,g=l*a+o*r,m=l*i+o*s,P=l*r+o*c,p=l*f+o*m,_=l*g+o*P,d=l*p+o*(l*m+o*(l*s+o*h)),M=l*_+o*(l*P+o*(l*c+o*u));t.push(e.PathCommandMap.C,f,g,p,_,d,M)}},{getDerivative:r,getDistance:s}=i,{M:c,L:h,C:u,Z:l}=e.PathCommandMap,f={},g={},m={transform(t,e){let o,n=0;const a=t.length;for(;n<a;)switch(o=t[n],o){case c:case h:m.transformPoints(t,e,n,1),n+=3;break;case u:m.transformPoints(t,e,n,3),n+=7;break;case l:n+=1}},transformPoints(t,o,n,a){for(let i=n+1,r=i+2*a;i<r;i+=2)f.x=t[i],f.y=t[i+1],e.MatrixHelper.toOuterPoint(o,f),t[i]=f.x,t[i+1]=f.y},getMotionPathData(t){let o,n,a,r,s=0,f=[],g=0,m=0,P=0;const p=t.length;for(;g<p;){switch(r=t[g],r){case c:case h:n=t[g+1],a=t[g+2],o=r===h&&g>0?e.PointHelper.getDistanceFrom(m,P,n,a):0,m=n,P=a,g+=3;break;case u:n=t[g+5],a=t[g+6],o=i.getDistance(m,P,t[g+1],t[g+2],t[g+3],t[g+4],n,a),m=n,P=a,g+=7;break;case l:g+=1;default:o=0}f.push(o),s+=o}return{total:s,segments:f,data:t}},getDistancePoint(t,o,n){const{segments:a,data:r}=t;o=e.UnitConvert.number(o,t.total);let s,f,m,P,p,_,d,M,y,b=0,D={},x=0,C=0,H=0,T=0;const v=r.length;for(;x<v;){switch(P=r[x],P){case c:case h:if(f=r[x+1],m=r[x+2],s=a[C],b+s>o||!t.total)return x||(H=f,T=m),g.x=H,g.y=T,D.x=f,D.y=m,e.PointHelper.getDistancePoint(g,D,o-b,!0),D.rotation=e.PointHelper.getAngle(g,D),D;H=f,T=m,x+=3;break;case u:if(f=r[x+5],m=r[x+6],s=a[C],b+s>o)return p=r[x+1],_=r[x+2],d=r[x+3],M=r[x+4],y=i.getT(o-b,s,H,T,p,_,d,M,f,m,n),e.BezierHelper.getPointAndSet(y,H,T,p,_,d,M,f,m,D),D.rotation=i.getRotation(y,H,T,p,_,d,M,f,m),D;H=f,T=m,x+=7;break;case l:x+=1;default:s=0}C++,b+=s}return D},getDistancePath(t,o,n){const{segments:a,data:r}=t,s=[];o=e.UnitConvert.number(o,t.total);let f,m,P,p,_,d,M,y,b,D=0,x={},C=0,H=0,T=0,v=0;const k=r.length;for(;C<k;){switch(p=r[C],p){case c:case h:if(m=r[C+1],P=r[C+2],f=a[H],D+f>o||!t.total)return C||(T=m,v=P),g.x=T,g.y=v,x.x=m,x.y=P,e.PointHelper.getDistancePoint(g,x,o-D,!0),s.push(p,x.x,x.y),s;T=m,v=P,C+=3,s.push(p,T,v);break;case u:if(_=r[C+1],d=r[C+2],M=r[C+3],y=r[C+4],m=r[C+5],P=r[C+6],f=a[H],D+f>o)return b=i.getT(o-D,f,T,v,_,d,M,y,m,P,n),i.cut(s,b,T,v,_,d,M,y,m,P),s;T=m,v=P,C+=7,s.push(p,_,d,M,y,m,P);break;case l:C+=1,s.push(p);default:f=0}H++,D+=f}return s}};function P(t){return e.decorateLeafAttr(t,(t=>e.attr({set(o){this.__setAttr(t,o),this.__hasMotionPath=this.motionPath||!e.isNull(this.motion),this.__layout.matrixChanged||this.__layout.matrixChange()}})))}e.Plugin.add("motion-path"),e.Transition.register("motion",(function(t,o,n,a){return t?"object"==typeof t&&(t=e.UnitConvert.number(t,a.getMotionTotal())):t=0,o?"object"==typeof o&&(o=e.UnitConvert.number(o,a.getMotionTotal())):o=0,e.Transition.number(t,o,n)})),e.Transition.register("motionRotation",(function(t,o,n){return e.Transition.number(t,o,n)}));const p=e.UI.prototype,{updateMatrix:_,updateAllMatrix:d}=e.LeafHelper,{updateBounds:M}=e.BranchHelper;function y(t){const{motion:o,leaferIsCreated:n}=t;if(!e.isNull(o)){if(n&&(t.leafer.created=!1),t.motionPath){const e=D(t);e.total&&(t.__.__pathForRender=m.getDistancePath(e,o,t.motionPrecision))}else t.set(t.getMotionPoint(o)),t.__hasAutoLayout||(t.isBranch?(d(t),M(t,t)):_(t));n&&(t.leafer.created=!0)}}function b(t){const{parent:e}=t;if(!t.motionPath&&e){const{children:t}=e;for(let e=0;e<t.length;e++)if(t[e].motionPath)return t[e]}return t}function D(t){const e=t.__;return e.__pathForMotion?e.__pathForMotion:e.__pathForMotion=m.getMotionPathData(t.getPath(!0,!0))}return P()(p,"motionPath"),P(1)(p,"motionPrecision"),P()(p,"motion"),P(!0)(p,"motionRotation"),p.getMotionPathData=function(){return D(b(this))},p.getMotionPoint=function(t){const o=b(this),n=D(o);if(!n.total)return{};const a=m.getDistancePoint(n,t,o.motionPrecision);e.MatrixHelper.toOuterPoint(o.localTransform,a);const{motionRotation:i}=this;return!1===i?delete a.rotation:"number"==typeof i&&(a.rotation+=i),a},p.getMotionTotal=function(){return this.getMotionPathData().total},p.__updateMotionPath=function(){const t=this.__;if(this.__layout.resized&&t.__pathForMotion&&(t.__pathForMotion=void 0),this.motionPath){let t;const{children:o}=this.parent,{leaferIsReady:n}=this;for(let a=0;a<o.length;a++)t=o[a],e.isNull(t.motion)||t.__layout.matrixChanged||(n&&t!==this&&this.leafer.layouter.addExtra(t),y(t))}else y(this)},t.HighBezierHelper=i,t.HighCurveHelper=m,t.motionPathType=P,t}({},LeaferUI);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leafer-in/motion-path",
3
- "version": "1.1.2",
3
+ "version": "1.2.0",
4
4
  "description": "@leafer-in/motion-path",
5
5
  "author": "Chao (Leafer) Wan",
6
6
  "license": "MIT",
@@ -34,8 +34,8 @@
34
34
  "leaferjs"
35
35
  ],
36
36
  "peerDependencies": {
37
- "@leafer-ui/draw": "^1.1.2",
38
- "@leafer-ui/interface": "^1.1.2",
39
- "@leafer-in/interface": "^1.1.2"
37
+ "@leafer-ui/draw": "^1.2.0",
38
+ "@leafer-ui/interface": "^1.2.0",
39
+ "@leafer-in/interface": "^1.2.0"
40
40
  }
41
41
  }
package/src/index.ts CHANGED
@@ -3,12 +3,15 @@ export { HighBezierHelper } from './HighBezierHelper'
3
3
  export { motionPathType } from './decorator'
4
4
 
5
5
  import { IMotionPathData, IUI, IUnitData, IRotationPointData } from '@leafer-ui/interface'
6
- import { isNull, MatrixHelper, LeafHelper, BranchHelper, Transition, UI, UnitConvert } from '@leafer-ui/draw'
6
+ import { isNull, MatrixHelper, LeafHelper, BranchHelper, Transition, UI, UnitConvert, Plugin } from '@leafer-ui/draw'
7
7
 
8
8
  import { HighCurveHelper } from './HighCurveHelper'
9
9
  import { motionPathType } from './decorator'
10
10
 
11
11
 
12
+ Plugin.add('motion-path')
13
+
14
+
12
15
  Transition.register('motion', function (from: any, to: any, t: number, target: IUI): number {
13
16
  if (!from) from = 0
14
17
  else if (typeof from === 'object') from = UnitConvert.number(from, target.getMotionTotal())