Exemplo n.º 1
0
def demo_boxes(scene: CodeScene):
    scene.add_background(f"{example_dir}/resources/blackboard.jpg")

    title = Text("examples/boxes.py", font=DEFAULT_FONT)
    title.to_edge(UP)
    scene.add(title)
    comp1 = TextBox("Component A", shadow=False)
    comp2 = TextBox("Component B", shadow=False)
    comp3 = TextBox("Component C", shadow=False)
    comp1.next_to(title, DOWN, buff=2)
    comp1.to_edge(LEFT)
    comp2.next_to(comp1, DOWN, buff=1)
    comp3.next_to(comp1, RIGHT, buff=4)
    arrow1 = Connection(comp2, comp1, "Do something")
    arrow2 = Connection(comp1, comp3, "Do another thing")

    scene.play(FadeIn(comp2))
    scene.wait_until_beat(1)
    scene.play(Create(arrow1))
    scene.play(FadeIn(comp1))
    scene.wait_until_beat(1)
    scene.play(Create(arrow2))
    scene.play(FadeIn(comp3))

    scene.wait_until_beat(4)
    scene.clear()
Exemplo n.º 2
0
def demo_boxes(scene: CodeScene):
    scene.add_background(f"{example_dir}/resources/blackboard.jpg")
    lib = Library()

    comp1 = lib.text_box("Component A", shadow=False)
    comp2 = lib.text_box("Component B", shadow=False)
    comp3 = lib.text_box("Component C", shadow=False)
    comp1.to_edge(LEFT)
    comp2.next_to(comp1, DOWN, buff=1)
    comp3.next_to(comp1, RIGHT, buff=4)
    arrow1 = lib.connect(comp2, comp1, "Do something")
    arrow2 = lib.connect(comp1, comp3, "Do another thing")

    scene.play(FadeIn(comp2))
    scene.wait_until_beat(1)
    scene.play(ShowCreation(arrow1))
    scene.play(FadeIn(comp1))
    scene.wait_until_beat(1)
    scene.play(ShowCreation(arrow2))
    scene.play(FadeIn(comp3))

    scene.wait_until_beat(4)
    scene.clear()