From 9916e072aad78ff8fd5349e377eca73429d6f5f0 Mon Sep 17 00:00:00 2001 From: Grant Sanderson Date: Sat, 20 Jan 2018 19:31:09 -0800 Subject: [PATCH] Added matching functions --- mobject/mobject.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/mobject/mobject.py b/mobject/mobject.py index a68e75e0..84f113d5 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):