Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

Added matching functions

Grant Sanderson9916e072aad7
diff --git a/mobject/mobject.py b/mobject/mobject.py
index a68e75e03..84f113d5b 100644
--- a/mobject/mobject.py
+++ b/mobject/mobject.py
@@ -428,6 +428,26 @@ class Mobject(object):
self.shift(start-self.points[0])
return self
+ ## Match other mobvject properties
+
+ def match_color(self, mobject):
+ return self.highlight(mobject.get_color())
+
+ def match_dim(self, mobject, dim, **kwargs):
+ return self.rescale_to_fit(
+ mobject.length_over_dim(dim), dim,
+ **kwargs
+ )
+
+ def match_width(self, mobject):
+ return self.match_dim(mobject, 0)
+
+ def match_height(self, mobject):
+ return self.match_dim(mobject, 1)
+
+ def match_depth(self, mobject):
+ return self.match_dim(mobject, 2)
+
## Color functions
def highlight(self, color = YELLOW_C, family = True):