From fae819695a80888b9c06b42ec3cae5b77155d6e3 Mon Sep 17 00:00:00 2001 From: Grant Sanderson Date: Wed, 25 Oct 2017 14:20:45 -0700 Subject: [PATCH] There's some (as of yet unresolved) bug associated with fill colors when they become negative during an animation --- camera.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/camera.py b/camera.py index ba67dd50..b298ae33 100644 --- a/camera.py +++ b/camera.py @@ -141,15 +141,21 @@ class Camera(object): def get_pen_and_fill(self, vmobject): pen = aggdraw.Pen( - self.get_stroke_color(vmobject).get_hex_l(), + self.color_to_hex_l(self.get_stroke_color(vmobject)), max(vmobject.stroke_width, 0) ) fill = aggdraw.Brush( - self.get_fill_color(vmobject).get_hex_l(), + self.color_to_hex_l(self.get_fill_color(vmobject)), opacity = int(255*vmobject.get_fill_opacity()) ) return (pen, fill) + def color_to_hex_l(self, color): + try: + return color.get_hex_l() + except: + return Color(BLACK).get_hex_l() + def get_stroke_color(self, vmobject): return vmobject.get_stroke_color()