setSubmobjectColorsByGradient method
void
setSubmobjectColorsByGradient(
- List<Color> colors
)
Implementation
void setSubmobjectColorsByGradient(List<Color> colors) {
if (colors.isEmpty) {
throw 'Need at least one color';
} else if (colors.length == 1) {
setColor(color: colors[0]);
}
var mobs = getFamilyWithPoints();
var newColors = colorGradient(colors, mobs.length);
for (var k in IterableZip([mobs, newColors])) {
var mob = k.first as Mobject;
var color = k.last as Color;
mob.setColor(color: color);
}
}