@leafer-game/miniapp 1.0.10 → 1.1.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.
@@ -108,7 +108,7 @@ const MathHelper = {
108
108
  return rotation - oldRotation;
109
109
  },
110
110
  float(num, maxLength) {
111
- const a = maxLength ? pow$2(10, maxLength) : 1000000000000;
111
+ const a = maxLength !== undefined ? pow$2(10, maxLength) : 1000000000000;
112
112
  num = round$3(num * a) / a;
113
113
  return num === -0 ? 0 : num;
114
114
  },
@@ -4165,20 +4165,17 @@ const LeafHelper = {
4165
4165
  }
4166
4166
  return true;
4167
4167
  },
4168
- moveWorld(t, x, y = 0, isInnerPoint) {
4168
+ moveWorld(t, x, y = 0, isInnerPoint, transition) {
4169
4169
  const local = typeof x === 'object' ? Object.assign({}, x) : { x, y };
4170
4170
  isInnerPoint ? toOuterPoint$1(t.localTransform, local, local, true) : (t.parent && toInnerPoint$1(t.parent.worldTransform, local, local, true));
4171
- L$1.moveLocal(t, local.x, local.y);
4171
+ L$1.moveLocal(t, local.x, local.y, transition);
4172
4172
  },
4173
- moveLocal(t, x, y = 0) {
4174
- if (typeof x === 'object') {
4175
- t.x += x.x;
4176
- t.y += x.y;
4177
- }
4178
- else {
4179
- t.x += x;
4180
- t.y += y;
4181
- }
4173
+ moveLocal(t, x, y = 0, transition) {
4174
+ if (typeof x === 'object')
4175
+ y = x.y, x = x.x;
4176
+ x += t.x;
4177
+ y += t.y;
4178
+ transition ? t.animate({ x, y }, transition) : (t.x = x, t.y = y);
4182
4179
  },
4183
4180
  zoomOfWorld(t, origin, scaleX, scaleY, resize) {
4184
4181
  L$1.zoomOfLocal(t, getTempLocal(t, origin), scaleX, scaleY, resize);
@@ -5558,11 +5555,11 @@ let Leaf = class Leaf {
5558
5555
  transform(matrix, resize) {
5559
5556
  transform(this, matrix, resize);
5560
5557
  }
5561
- move(x, y) {
5562
- moveLocal(this, x, y);
5558
+ move(x, y, transition) {
5559
+ moveLocal(this, x, y, transition);
5563
5560
  }
5564
- moveInner(x, y) {
5565
- moveWorld(this, x, y, true);
5561
+ moveInner(x, y, transition) {
5562
+ moveWorld(this, x, y, true, transition);
5566
5563
  }
5567
5564
  scaleOf(origin, scaleX, scaleY, resize) {
5568
5565
  zoomOfLocal(this, getLocalOrigin(this, origin), scaleX, scaleY, resize);
@@ -5576,8 +5573,8 @@ let Leaf = class Leaf {
5576
5573
  transformWorld(worldTransform, resize) {
5577
5574
  transformWorld(this, worldTransform, resize);
5578
5575
  }
5579
- moveWorld(x, y) {
5580
- moveWorld(this, x, y);
5576
+ moveWorld(x, y, transition) {
5577
+ moveWorld(this, x, y, false, transition);
5581
5578
  }
5582
5579
  scaleOfWorld(worldOrigin, scaleX, scaleY, resize) {
5583
5580
  zoomOfWorld(this, worldOrigin, scaleX, scaleY, resize);
@@ -5975,7 +5972,7 @@ class LeafLevelList {
5975
5972
  }
5976
5973
  }
5977
5974
 
5978
- const version = "1.0.10";
5975
+ const version = "1.1.0";
5979
5976
 
5980
5977
  class LeaferCanvas extends LeaferCanvasBase {
5981
5978
  get allowBackgroundColor() { return false; }
@@ -7545,11 +7542,15 @@ let UI = UI_1 = class UI extends Leaf {
7545
7542
  super(data);
7546
7543
  }
7547
7544
  reset(_data) { }
7548
- set(data, isTemp) {
7549
- if (isTemp) {
7550
- this.lockNormalStyle = true;
7551
- Object.assign(this, data);
7552
- this.lockNormalStyle = false;
7545
+ set(data, transition) {
7546
+ if (transition) {
7547
+ if (transition === 'temp') {
7548
+ this.lockNormalStyle = true;
7549
+ Object.assign(this, data);
7550
+ this.lockNormalStyle = false;
7551
+ }
7552
+ else
7553
+ this.animate(data, transition);
7553
7554
  }
7554
7555
  else
7555
7556
  Object.assign(this, data);
@@ -7859,17 +7860,17 @@ let Group = class Group extends UI {
7859
7860
  if (!this.children)
7860
7861
  this.children = [];
7861
7862
  }
7862
- set(data, isTemp) {
7863
+ set(data, transition) {
7863
7864
  if (data.children) {
7864
7865
  const { children } = data;
7865
7866
  delete data.children;
7866
7867
  this.children ? this.clear() : this.__setBranch();
7867
- super.set(data, isTemp);
7868
+ super.set(data, transition);
7868
7869
  children.forEach(child => this.add(child));
7869
7870
  data.children = children;
7870
7871
  }
7871
7872
  else
7872
- super.set(data, isTemp);
7873
+ super.set(data, transition);
7873
7874
  }
7874
7875
  toJSON(options) {
7875
7876
  const data = super.toJSON(options);
@@ -7982,8 +7983,8 @@ let Leafer = Leafer_1 = class Leafer extends Group {
7982
7983
  }
7983
7984
  onInit() { }
7984
7985
  initType(_type) { }
7985
- set(data) {
7986
- this.waitInit(() => { super.set(data); });
7986
+ set(data, transition) {
7987
+ this.waitInit(() => { super.set(data, transition); });
7987
7988
  }
7988
7989
  start() {
7989
7990
  clearTimeout(this.__startTimer);
@@ -8473,7 +8474,7 @@ Ellipse = __decorate([
8473
8474
  ], Ellipse);
8474
8475
 
8475
8476
  const { moveTo: moveTo$2, lineTo: lineTo$2, drawPoints: drawPoints$1 } = PathCommandDataHelper;
8476
- const { rotate: rotate$1, getAngle: getAngle$1, getDistance: getDistance$2, defaultPoint } = PointHelper;
8477
+ const { rotate: rotate$1, getAngle: getAngle$1, getDistance: getDistance$3, defaultPoint } = PointHelper;
8477
8478
  const { toBounds: toBounds$1 } = PathBounds;
8478
8479
  let Line = class Line extends UI {
8479
8480
  get __tag() { return 'Line'; }
@@ -8487,7 +8488,7 @@ let Line = class Line extends UI {
8487
8488
  return to;
8488
8489
  }
8489
8490
  set toPoint(value) {
8490
- this.width = getDistance$2(defaultPoint, value);
8491
+ this.width = getDistance$3(defaultPoint, value);
8491
8492
  this.rotation = getAngle$1(defaultPoint, value);
8492
8493
  if (this.height)
8493
8494
  this.height = 0;
@@ -9172,10 +9173,8 @@ let DragEvent = class DragEvent extends PointerEvent {
9172
9173
  this.data = data;
9173
9174
  }
9174
9175
  static getValidMove(leaf, start, total) {
9175
- const { draggable, dragBounds, x, y } = leaf;
9176
- const move = leaf.getLocalPoint(total, null, true);
9177
- move.x += start.x - x;
9178
- move.y += start.y - y;
9176
+ const { draggable, dragBounds } = leaf, move = leaf.getLocalPoint(total, null, true);
9177
+ PointHelper.move(move, start.x - leaf.x, start.y - leaf.y);
9179
9178
  if (dragBounds)
9180
9179
  this.getMoveInDragBounds(leaf.__local, dragBounds === 'parent' ? leaf.parent.boxBounds : dragBounds, move, true);
9181
9180
  if (draggable === 'x')
@@ -9185,8 +9184,7 @@ let DragEvent = class DragEvent extends PointerEvent {
9185
9184
  return move;
9186
9185
  }
9187
9186
  static getMoveInDragBounds(childBox, dragBounds, move, change) {
9188
- const x = childBox.x + move.x, y = childBox.y + move.y;
9189
- const right = x + childBox.width, bottom = y + childBox.height;
9187
+ const x = childBox.x + move.x, y = childBox.y + move.y, right = x + childBox.width, bottom = y + childBox.height;
9190
9188
  const boundsRight = dragBounds.x + dragBounds.width, boundsBottom = dragBounds.y + dragBounds.height;
9191
9189
  if (!change)
9192
9190
  move = Object.assign({}, move);
@@ -9238,9 +9236,7 @@ let DragEvent = class DragEvent extends PointerEvent {
9238
9236
  return this.getLocalMove(relative, true);
9239
9237
  }
9240
9238
  getPageBounds() {
9241
- const total = this.getPageTotal();
9242
- const start = this.getPagePoint();
9243
- const bounds = {};
9239
+ const total = this.getPageTotal(), start = this.getPagePoint(), bounds = {};
9244
9240
  BoundsHelper.set(bounds, start.x - total.x, start.y - total.y, total.x, total.y);
9245
9241
  BoundsHelper.unsign(bounds);
9246
9242
  return bounds;
@@ -10733,6 +10729,8 @@ function stroke(stroke, ui, canvas) {
10733
10729
  case 'center':
10734
10730
  canvas.setStroke(stroke, __strokeWidth, options);
10735
10731
  canvas.stroke();
10732
+ if (options.__useArrow)
10733
+ strokeArrow(ui, canvas);
10736
10734
  break;
10737
10735
  case 'inside':
10738
10736
  canvas.save();
@@ -10770,6 +10768,8 @@ function strokes(strokes, ui, canvas) {
10770
10768
  case 'center':
10771
10769
  canvas.setStroke(undefined, __strokeWidth, options);
10772
10770
  drawStrokesStyle(strokes, false, ui, canvas);
10771
+ if (options.__useArrow)
10772
+ strokeArrow(ui, canvas);
10773
10773
  break;
10774
10774
  case 'inside':
10775
10775
  canvas.save();
@@ -10795,6 +10795,14 @@ function strokes(strokes, ui, canvas) {
10795
10795
  }
10796
10796
  }
10797
10797
  }
10798
+ function strokeArrow(ui, canvas) {
10799
+ if (ui.__.dashPattern) {
10800
+ canvas.beginPath();
10801
+ ui.__drawPathByData(canvas, ui.__.__pathForArrow);
10802
+ canvas.dashPattern = null;
10803
+ canvas.stroke();
10804
+ }
10805
+ }
10798
10806
 
10799
10807
  const { getSpread, getOuterOf, getByMove, getIntersectData } = BoundsHelper;
10800
10808
  function shape(ui, current, options) {
@@ -11297,7 +11305,7 @@ function applyStops(gradient, stops, opacity) {
11297
11305
  }
11298
11306
  }
11299
11307
 
11300
- const { getAngle, getDistance: getDistance$1 } = PointHelper;
11308
+ const { getAngle, getDistance: getDistance$2 } = PointHelper;
11301
11309
  const { get, rotateOfOuter, scaleOfOuter } = MatrixHelper;
11302
11310
  const { toPoint: toPoint$1 } = AroundHelper;
11303
11311
  const realFrom$1 = {};
@@ -11306,7 +11314,7 @@ function radialGradient(paint, box) {
11306
11314
  let { from, to, type, opacity, blendMode, stretch } = paint;
11307
11315
  toPoint$1(from || 'center', box, realFrom$1);
11308
11316
  toPoint$1(to || 'bottom', box, realTo$1);
11309
- const style = Platform.canvas.createRadialGradient(realFrom$1.x, realFrom$1.y, 0, realFrom$1.x, realFrom$1.y, getDistance$1(realFrom$1, realTo$1));
11317
+ const style = Platform.canvas.createRadialGradient(realFrom$1.x, realFrom$1.y, 0, realFrom$1.x, realFrom$1.y, getDistance$2(realFrom$1, realTo$1));
11310
11318
  applyStops(style, paint.stops, opacity);
11311
11319
  const data = { type, style };
11312
11320
  const transform = getTransform(box, realFrom$1, realTo$1, stretch, true);
@@ -11334,7 +11342,7 @@ function getTransform(box, from, to, stretch, rotate90) {
11334
11342
  return transform;
11335
11343
  }
11336
11344
 
11337
- const { getDistance } = PointHelper;
11345
+ const { getDistance: getDistance$1 } = PointHelper;
11338
11346
  const { toPoint } = AroundHelper;
11339
11347
  const realFrom = {};
11340
11348
  const realTo = {};
@@ -11342,7 +11350,7 @@ function conicGradient(paint, box) {
11342
11350
  let { from, to, type, opacity, blendMode, stretch } = paint;
11343
11351
  toPoint(from || 'center', box, realFrom);
11344
11352
  toPoint(to || 'bottom', box, realTo);
11345
- const style = Platform.conicGradientSupport ? Platform.canvas.createConicGradient(0, realFrom.x, realFrom.y) : Platform.canvas.createRadialGradient(realFrom.x, realFrom.y, 0, realFrom.x, realFrom.y, getDistance(realFrom, realTo));
11353
+ const style = Platform.conicGradientSupport ? Platform.canvas.createConicGradient(0, realFrom.x, realFrom.y) : Platform.canvas.createRadialGradient(realFrom.x, realFrom.y, 0, realFrom.x, realFrom.y, getDistance$1(realFrom, realTo));
11346
11354
  applyStops(style, paint.stops, opacity);
11347
11355
  const data = { type, style };
11348
11356
  const transform = getTransform(box, realFrom, realTo, stretch || 1, Platform.conicGradientRotate90);
@@ -12328,15 +12336,18 @@ let Robot = class Robot extends UI {
12328
12336
  if (typeof action === 'number') {
12329
12337
  this.now = action;
12330
12338
  }
12331
- else if (action instanceof Array) {
12332
- const { length } = action;
12339
+ else if (typeof action === 'object') {
12340
+ const isArray = action instanceof Array;
12341
+ const keyframes = isArray ? action : action.keyframes;
12342
+ this.__action = isArray ? undefined : action;
12343
+ const { length } = keyframes;
12333
12344
  if (length > 1) {
12334
- const start = this.now = action[0], end = action[action.length - 1];
12345
+ const start = this.now = keyframes[0], end = keyframes[keyframes.length - 1];
12335
12346
  this.play();
12336
12347
  this.__runAction(start, end);
12337
12348
  }
12338
12349
  else if (length)
12339
- this.now = action[0];
12350
+ this.now = keyframes[0];
12340
12351
  }
12341
12352
  }
12342
12353
  __loadRobot(frame, start, end) {
@@ -12364,16 +12375,26 @@ let Robot = class Robot extends UI {
12364
12375
  this.emitEvent(new ImageEvent(ImageEvent.LOADED, { image }));
12365
12376
  }
12366
12377
  __runAction(start, end) {
12378
+ let { FPS, loop, __action: a } = this;
12379
+ if (a) {
12380
+ if (a.FPS)
12381
+ FPS = a.FPS;
12382
+ if (a.loop !== undefined)
12383
+ loop = a.loop;
12384
+ }
12367
12385
  this.__timer = setTimeout(() => {
12368
12386
  if (this.running) {
12369
- if (this.now === end)
12387
+ if (this.now === end) {
12388
+ if (!loop)
12389
+ return this.stop();
12370
12390
  this.now = start;
12391
+ }
12371
12392
  else
12372
12393
  this.now++;
12373
12394
  this.__updateRobotBounds();
12374
12395
  }
12375
12396
  this.__runAction(start, end);
12376
- }, 1000 / this.FPS);
12397
+ }, 1000 / FPS);
12377
12398
  }
12378
12399
  __updateRobotBounds() {
12379
12400
  const { nowFrame } = this;
@@ -12486,7 +12507,7 @@ function updateStyle(leaf, style, type) {
12486
12507
  const fromStyle = transition ? getFromStyle(leaf, style) : undefined;
12487
12508
  leaf.killAnimate('transition');
12488
12509
  if (normalStyle)
12489
- leaf.set(normalStyle, true);
12510
+ leaf.set(normalStyle, 'temp');
12490
12511
  const statesStyle = getStyle(leaf);
12491
12512
  if (statesStyle) {
12492
12513
  const { animation } = statesStyle;
@@ -12500,14 +12521,14 @@ function updateStyle(leaf, style, type) {
12500
12521
  delete statesStyle.animation;
12501
12522
  }
12502
12523
  leaf.normalStyle = filterStyle(statesStyle, leaf);
12503
- leaf.set(statesStyle, true);
12524
+ leaf.set(statesStyle, 'temp');
12504
12525
  }
12505
12526
  else {
12506
12527
  leaf.normalStyle = undefined;
12507
12528
  }
12508
12529
  if (transition) {
12509
12530
  const toStyle = filterStyle(fromStyle, leaf);
12510
- leaf.set(fromStyle, true);
12531
+ leaf.set(fromStyle, 'temp');
12511
12532
  leaf.animate([fromStyle, toStyle], transition, 'transition', true);
12512
12533
  }
12513
12534
  leaf.__layout.stateStyleChanged = false;
@@ -13205,7 +13226,7 @@ let Animate = class Animate extends Eventer {
13205
13226
  this.emit(AnimateEvent.UPDATE, this);
13206
13227
  }
13207
13228
  setStyle(style) {
13208
- this.target.set(style, this.isTemp);
13229
+ this.target.set(style, this.isTemp ? 'temp' : false);
13209
13230
  }
13210
13231
  clearTimer(fn) {
13211
13232
  if (this.timer) {
@@ -13581,6 +13602,9 @@ const TransitionList = {
13581
13602
  from = fourNumber(from), to = fourNumber(to);
13582
13603
  return from.map((f, i) => number(f, to[i], t));
13583
13604
  },
13605
+ text(from, to, t) {
13606
+ return (typeof from === 'number' || typeof to === 'number') ? MathHelper.float(number(from, to, t), Math.max(getDecimalLen(from), getDecimalLen(to))) : to;
13607
+ },
13584
13608
  shadow,
13585
13609
  innerShadow: shadow
13586
13610
  };
@@ -13589,6 +13613,10 @@ const TransitionModule = {
13589
13613
  number,
13590
13614
  color
13591
13615
  };
13616
+ function getDecimalLen(num) {
13617
+ const decimal = String(num).split('.')[1];
13618
+ return decimal ? decimal.length : 0;
13619
+ }
13592
13620
  function value(from, to, t) {
13593
13621
  return (typeof from === 'number' && typeof to === 'number') ? from + (to - from) * t : to;
13594
13622
  }
@@ -13657,23 +13685,40 @@ const gaussNodes = [0.1488743389, 0.4333953941, 0.6794095682, 0.8650633666, 0.97
13657
13685
  const gaussWeights = [0.2955242247, 0.2692667193, 0.2190863625, 0.1494513491, 0.0666713443];
13658
13686
  const { sqrt } = Math;
13659
13687
  const HighBezierHelper = {
13660
- getDistance(fromX, fromY, x1, y1, x2, y2, toX, toY) {
13661
- let distance = 0, t1, t2, d1X, d1Y, d2X, d2Y;
13688
+ getDistance(fromX, fromY, x1, y1, x2, y2, toX, toY, t = 1) {
13689
+ let distance = 0, t1, t2, d1X, d1Y, d2X, d2Y, half = t / 2;
13662
13690
  for (let i = 0; i < gaussNodes.length; i++) {
13663
- t1 = 0.5 * (1 + gaussNodes[i]);
13664
- t2 = 0.5 * (1 - gaussNodes[i]);
13691
+ t1 = half * (1 + gaussNodes[i]);
13692
+ t2 = half * (1 - gaussNodes[i]);
13665
13693
  d1X = getDerivative(t1, fromX, x1, x2, toX);
13666
13694
  d1Y = getDerivative(t1, fromY, y1, y2, toY);
13667
13695
  d2X = getDerivative(t2, fromX, x1, x2, toX);
13668
13696
  d2Y = getDerivative(t2, fromY, y1, y2, toY);
13669
13697
  distance += gaussWeights[i] * (sqrt(d1X * d1X + d1Y * d1Y) + sqrt(d2X * d2X + d2Y * d2Y));
13670
13698
  }
13671
- return distance * 0.5;
13699
+ return distance * half;
13672
13700
  },
13673
13701
  getDerivative(t, fromV, v1, v2, toV) {
13674
13702
  const o = 1 - t;
13675
13703
  return 3 * o * o * (v1 - fromV) + 6 * o * t * (v2 - v1) + 3 * t * t * (toV - v2);
13676
13704
  },
13705
+ getRotation(t, fromX, fromY, x1, y1, x2, y2, toX, toY) {
13706
+ const dx = getDerivative(t, fromX, x1, x2, toX);
13707
+ const dy = getDerivative(t, fromY, y1, y2, toY);
13708
+ return Math.atan2(dy, dx) / OneRadian;
13709
+ },
13710
+ getT(distance, totalDistance, fromX, fromY, x1, y1, x2, y2, toX, toY, precision = 1) {
13711
+ let low = 0, high = 1, middle = distance / totalDistance, realPrecision = precision / totalDistance / 3;
13712
+ if (middle >= 1)
13713
+ return 1;
13714
+ if (middle <= 0)
13715
+ return 0;
13716
+ while (high - low > realPrecision) {
13717
+ getDistance(fromX, fromY, x1, y1, x2, y2, toX, toY, middle) < distance ? low = middle : high = middle;
13718
+ middle = (low + high) / 2;
13719
+ }
13720
+ return middle;
13721
+ },
13677
13722
  cut(data, t, fromX, fromY, x1, y1, x2, y2, toX, toY) {
13678
13723
  const o = 1 - t;
13679
13724
  const ax = o * fromX + t * x1, ay = o * fromY + t * y1;
@@ -13685,7 +13730,7 @@ const HighBezierHelper = {
13685
13730
  data.push(PathCommandMap.C, ax, ay, bx, by, cx, cy);
13686
13731
  }
13687
13732
  };
13688
- const { getDerivative } = HighBezierHelper;
13733
+ const { getDerivative, getDistance } = HighBezierHelper;
13689
13734
 
13690
13735
  const { M, L, C, Z } = PathCommandMap;
13691
13736
  const tempPoint = {}, tempFrom = {};
@@ -13753,11 +13798,12 @@ const HighCurveHelper = {
13753
13798
  }
13754
13799
  return { total, segments, data };
13755
13800
  },
13756
- getDistancePoint(distanceData, motionDistance) {
13801
+ getDistancePoint(distanceData, motionDistance, motionPrecision) {
13757
13802
  const { segments, data } = distanceData;
13758
13803
  motionDistance = UnitConvert.number(motionDistance, distanceData.total);
13759
13804
  let total = 0, distance, to = {};
13760
13805
  let i = 0, index = 0, x = 0, y = 0, toX, toY, command;
13806
+ let x1, y1, x2, y2, t;
13761
13807
  const len = data.length;
13762
13808
  while (i < len) {
13763
13809
  command = data[i];
@@ -13787,11 +13833,10 @@ const HighCurveHelper = {
13787
13833
  toY = data[i + 6];
13788
13834
  distance = segments[index];
13789
13835
  if (total + distance > motionDistance) {
13790
- const x1 = data[i + 1], y1 = data[i + 2], x2 = data[i + 3], y2 = data[i + 4];
13791
- motionDistance -= total;
13792
- BezierHelper.getPointAndSet(motionDistance / distance, x, y, x1, y1, x2, y2, toX, toY, to);
13793
- BezierHelper.getPointAndSet(Math.max(0, motionDistance - 0.1) / distance, x, y, x1, y1, x2, y2, toX, toY, tempFrom);
13794
- to.rotation = PointHelper.getAngle(tempFrom, to);
13836
+ x1 = data[i + 1], y1 = data[i + 2], x2 = data[i + 3], y2 = data[i + 4];
13837
+ t = HighBezierHelper.getT(motionDistance - total, distance, x, y, x1, y1, x2, y2, toX, toY, motionPrecision);
13838
+ BezierHelper.getPointAndSet(t, x, y, x1, y1, x2, y2, toX, toY, to);
13839
+ to.rotation = HighBezierHelper.getRotation(t, x, y, x1, y1, x2, y2, toX, toY);
13795
13840
  return to;
13796
13841
  }
13797
13842
  x = toX;
@@ -13808,11 +13853,12 @@ const HighCurveHelper = {
13808
13853
  }
13809
13854
  return to;
13810
13855
  },
13811
- getDistancePath(distanceData, motionDistance) {
13856
+ getDistancePath(distanceData, motionDistance, motionPrecision) {
13812
13857
  const { segments, data } = distanceData, path = [];
13813
13858
  motionDistance = UnitConvert.number(motionDistance, distanceData.total);
13814
13859
  let total = 0, distance, to = {};
13815
13860
  let i = 0, index = 0, x = 0, y = 0, toX, toY, command;
13861
+ let x1, y1, x2, y2, t;
13816
13862
  const len = data.length;
13817
13863
  while (i < len) {
13818
13864
  command = data[i];
@@ -13839,12 +13885,13 @@ const HighCurveHelper = {
13839
13885
  path.push(command, x, y);
13840
13886
  break;
13841
13887
  case C:
13842
- const x1 = data[i + 1], y1 = data[i + 2], x2 = data[i + 3], y2 = data[i + 4];
13888
+ x1 = data[i + 1], y1 = data[i + 2], x2 = data[i + 3], y2 = data[i + 4];
13843
13889
  toX = data[i + 5];
13844
13890
  toY = data[i + 6];
13845
13891
  distance = segments[index];
13846
13892
  if (total + distance > motionDistance) {
13847
- HighBezierHelper.cut(path, (motionDistance - total) / distance, x, y, x1, y1, x2, y2, toX, toY);
13893
+ t = HighBezierHelper.getT(motionDistance - total, distance, x, y, x1, y1, x2, y2, toX, toY, motionPrecision);
13894
+ HighBezierHelper.cut(path, t, x, y, x1, y1, x2, y2, toX, toY);
13848
13895
  return path;
13849
13896
  }
13850
13897
  x = toX;
@@ -13893,6 +13940,7 @@ const ui = UI.prototype;
13893
13940
  const { updateMatrix, updateAllMatrix } = LeafHelper;
13894
13941
  const { updateBounds } = BranchHelper;
13895
13942
  motionPathType()(ui, 'motionPath');
13943
+ motionPathType(1)(ui, 'motionPrecision');
13896
13944
  motionPathType()(ui, 'motion');
13897
13945
  motionPathType(true)(ui, 'motionRotation');
13898
13946
  ui.getMotionPathData = function () {
@@ -13903,7 +13951,7 @@ ui.getMotionPoint = function (motionDistance) {
13903
13951
  const data = getMotionPathData(path);
13904
13952
  if (!data.total)
13905
13953
  return {};
13906
- const point = HighCurveHelper.getDistancePoint(data, motionDistance);
13954
+ const point = HighCurveHelper.getDistancePoint(data, motionDistance, path.motionPrecision);
13907
13955
  MatrixHelper.toOuterPoint(path.localTransform, point);
13908
13956
  const { motionRotation } = this;
13909
13957
  if (motionRotation === false)
@@ -13943,7 +13991,7 @@ function updateMotion(leaf) {
13943
13991
  if (leaf.motionPath) {
13944
13992
  const data = getMotionPathData(leaf);
13945
13993
  if (data.total)
13946
- leaf.__.__pathForRender = HighCurveHelper.getDistancePath(data, motion);
13994
+ leaf.__.__pathForRender = HighCurveHelper.getDistancePath(data, motion, leaf.motionPrecision);
13947
13995
  }
13948
13996
  else {
13949
13997
  leaf.set(leaf.getMotionPoint(motion));