Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

Added ShowIncreasingSubsets

Grant Sanderson66075aa5d2fa
diff --git a/manimlib/animation/creation.py b/manimlib/animation/creation.py
index 652d38927..42f4f92f8 100644
--- a/manimlib/animation/creation.py
+++ b/manimlib/animation/creation.py
@@ -113,6 +113,17 @@ class Write(DrawBorderThenFill):
else:
self.run_time = 2
+
+class ShowIncreasingSubsets(Animation):
+ def __init__(self, group, **kwargs):
+ self.all_submobs = group.submobjects
+ Animation.__init__(self, group, **kwargs)
+
+ def update_mobject(self, alpha):
+ n_submobs = len(self.all_submobs)
+ index = int(alpha * n_submobs)
+ self.mobject.submobjects = self.all_submobs[:index]
+
# Fading