addToFront method

void addToFront(
  1. List<Mobject> mobjects
)

Implementation

void addToFront(List<Mobject> mobjects) {
  if (mobjects.contains(this)) {
    throw 'Mobject can\'t contain itself';
  }

  submobjects = [
    ...mobjects,
    for (var mob in submobjects)
      if (!mobjects.contains(mob)) mob,
  ];
}