interpolateColor method
Implementation
@override
void interpolateColor(Mobject _mob1, Mobject _mob2, double alpha) {
assert(_mob1 is VMobject && _mob2 is Mobject);
var mob1 = _mob1 as VMobject;
var mob2 = _mob2 as VMobject;
fillColors =
interpolateColorList(mob1.getFillColors(), mob2.getFillColors(), alpha);
strokeColors = interpolateColorList(
mob1.getStrokeColors(), mob2.getStrokeColors(), alpha);
backgroundStrokeColors = interpolateColorList(
mob1.getStrokeColors(background: true),
mob2.getStrokeColors(background: true),
alpha);
strokeWidth = interpolateValue(mob1.strokeWidth, mob2.strokeWidth, alpha);
backgroundStrokeWidth = interpolateValue(
mob1.backgroundStrokeWidth, mob2.backgroundStrokeWidth, alpha);
var copyColors = (List<Color> colors) => [...colors.map((c) => c.copy())];
if (alpha == 1.0) {
fillColors =
mob2.fillColors != null ? copyColors(mob2.fillColors!) : null;
strokeColors =
mob2.strokeColors != null ? copyColors(mob2.strokeColors!) : null;
backgroundStrokeColors = mob2.backgroundStrokeColors != null
? copyColors(mob2.backgroundStrokeColors!)
: null;
strokeWidth = mob2.strokeWidth;
backgroundStrokeWidth = mob2.backgroundStrokeWidth;
}
}