[004]mob.next_to
1. next_to(obj, ORIGIN/LEFT/RIGHT/UP/DOWN/UL/UR/DL/DR) class NextToTest(Scene): def construct(self): dir_str = ['ORIGIN', 'LEFT', 'RIGHT', 'UP', 'DOWN', 'UL', 'UR', 'DL', 'DR'] dir_list = [ORIGIN, LEFT, RIGHT, UP, DOWN, UL, UR, DL, DR] #1. next_to(obj, ORIGIN/LEFT/RIGHT/UP/DOWN/UL/UR/DL/DR) for str, d in zip(dir_str, dir_list): self.next_to_obj(str,d) def next_to_obj(self, str, direction=ORIGIN,..
[002]mob.to_edge
# based on the 'Scene' class def construct(self): self.to_edge_test() # self.to_edge_test(buff=0.5) def to_edge_test(self, buff=0): text = Text("Hello", font='Arial', stroke_width=1, size=0.4) rect = Rectangle(width=0.3, height=text.get_height(),stroke_color=RED) group = VGroup(rect,text).arrange(RIGHT) group.save_state() self.add(group) for d in [LEFT,RIGHT,UP,DOWN]: self.play(group.to_edge, d,..
[001]mob.move_to
# based on the 'Scene' def construct(self): direction = [ORIGIN, LEFT, RIGHT, UP, DOWN] for d in direction: self.move_to_obj(d) def move_to_obj(self, direction): rect1 = Rectangle(width=0.4, height=0.2, stroke_color=RED) rect2 = Rectangle(width=1, height=1, stroke_color=BLUE).move_to(np.array([2, 3, 0])) self.add(rect1,rect2) self.wait() self.play(rect1.move_to, rect2, {"aligned_edge":direction}..