DashedVMobject constructor

DashedVMobject(
  1. VMobject vmob, {
  2. int numDashes = 15,
  3. double positiveSpaceRatio = 0.5,
  4. Color color = WHITE,
})

Implementation

DashedVMobject(
  VMobject vmob, {
  int numDashes = 15,
  double positiveSpaceRatio = 0.5,
  Color color = WHITE,
}) : super(color: color) {
  if (numDashes > 0) {
    var fullDAlpha = 1 / numDashes;
    var partialDAlpha = fullDAlpha * positiveSpaceRatio;

    var alphas = (linspace(start: 0, end: 1, count: numDashes + 1) / 1 -
            fullDAlpha +
            partialDAlpha)
        .getColumn(0);

    add([
      for (var alpha in alphas) vmob.getSubcurve(alpha, alpha + partialDAlpha)
    ]);
  }

  matchStyle(vmob, family: false);
}