getVMobjectSubpath method

String getVMobjectSubpath(
  1. VMobject vmob,
  2. List<Vector3> subpath
)

Implementation

String getVMobjectSubpath(VMobject vmob, List<Vector3> subpath) {
  var path = '';
  var quads = vmob.genCubicBezierTuplesFromPoints(subpath);
  var start = subpath.first;
  path += 'M ${start.x} ${start.y}';

  var closedPath = vmob.considerPointsEquals2D(subpath.first, subpath.last);

  for (var pts in quads) {
    var p1 = pts.item2;
    var p2 = pts.item3;
    var p3 = pts.item4;

    path += ' C ${p1.x} ${p1.y} ${p2.x} ${p2.y} ${p3.x} ${p3.y}';
  }

  if (closedPath) {
    path += ' Z';
  }

  return path;
}