Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

Bugfix: Interpolate stroke opacity in FadeIn and update stroke_opacity and fill_opacity in VMobject.set_stroke and VMobject.set_fill (#944)

Devin Neal9a1811bd186a
diff --git a/manim/animation/fading.py b/manim/animation/fading.py
index 4a9267641..de2f49a9d 100644
--- a/manim/animation/fading.py
+++ b/manim/animation/fading.py
@@ -117,7 +117,7 @@ class FadeIn(Transform):
start = super().create_starting_mobject()
start.fade(1)
if isinstance(start, VMobject):
- start.set_stroke(width=0)
+ start.set_stroke(opacity=0)
start.set_fill(opacity=0)
return start
diff --git a/manim/mobject/types/vectorized_mobject.py b/manim/mobject/types/vectorized_mobject.py
index b93d3356a..5b6c64c04 100644
--- a/manim/mobject/types/vectorized_mobject.py
+++ b/manim/mobject/types/vectorized_mobject.py
@@ -171,6 +171,8 @@ class VMobject(Mobject):
for submobject in self.submobjects:
submobject.set_fill(color, opacity, family)
self.update_rgbas_array("fill_rgbas", color, opacity)
+ if opacity is not None:
+ self.fill_opacity = opacity
return self
def set_stroke(
@@ -188,6 +190,8 @@ class VMobject(Mobject):
self.update_rgbas_array(array_name, color, opacity)
if width is not None:
setattr(self, width_name, width)
+ if opacity is not None:
+ self.stroke_opacity = opacity
return self
def set_background_stroke(self, **kwargs):