From 3d9f370bceadf2ba104f7b32c31b574de388a013 Mon Sep 17 00:00:00 2001 From: mirefek Date: Sun, 28 Jan 2018 20:31:55 +0100 Subject: [PATCH] Feature: DashedMObject --- topics/objects.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/topics/objects.py b/topics/objects.py index b4643dec..e5e8a602 100644 --- a/topics/objects.py +++ b/topics/objects.py @@ -575,3 +575,22 @@ class BraceText(BraceLabel): CONFIG = { "label_constructor" : TextMobject } + +class DashedMobject(VMobject): + CONFIG = { + "dashes_num" : 15, + "spacing" : 0.5, + "color" : WHITE + } + def __init__(self, mob, **kwargs): + digest_locals(self) + VMobject.__init__(self, **kwargs) + + buff = float(self.spacing) / self.dashes_num + + for i in range(self.dashes_num): + a = ((1+buff) * i)/self.dashes_num + b = 1-((1+buff) * (self.dashes_num-1-i)) / self.dashes_num + dash = VMobject(color = self.color) + dash.pointwise_become_partial(mob, a, b) + self.submobjects.append(dash)