コード例 #1
0
ファイル: 256colour.py プロジェクト: Rensykes/PythonScripts
def demo(screen):
    effects = [
        Print(screen, Rainbow(screen, FigletText("256 colours")),
              y=screen.height//2 - 8),
        Print(screen, Rainbow(screen, FigletText("for xterm users")),
              y=screen.height//2 + 3),
        Clock(screen, screen.width//2, screen.height//2, screen.height//2),
    ]
    screen.play([Scene(effects, -1)], stop_on_resize=True)
コード例 #2
0
def demo(screen):
    effects = [
        Print(screen, Rainbow(screen, FigletText("Hacktoberfest")),
              y=screen.height//2 - 8),
        Print(screen, Rainbow(screen, FigletText("ASCII Art 2020")),
              y=screen.height//2 + 3),
        Clock(screen, screen.width//2, screen.height//2, screen.height//2),
    ]
    screen.play([Scene(effects, -1)], stop_on_resize=True)
    screen.refresh()
コード例 #3
0
def demo(screen=None, output1="", output2="", duration=50):

    effects = [
        Print(screen, Rainbow(screen, FigletText("{}".format(str(output1)))),
              screen.height // 2 - 7),
        Print(screen, Rainbow(screen, FigletText("{}".format(str(output2)))),
              screen.height // 2),
        Stars(screen, (screen.width + screen.height) // 2)
    ]

    screen.play([Scene(effects, duration)], repeat=False)
コード例 #4
0
def demo(screen=None, output1="", output2=""):

    effects = [
        Print(screen, Rainbow(screen, FigletText("{}".format(str(output1)))),
              screen.height // 2 - 7),
        Print(screen, Rainbow(screen, FigletText("{}".format(str(output2)))),
              screen.height // 2),
        Stars(screen, (screen.width + screen.height) // 2)
    ]

    screen.play([Scene(effects, 500)])
コード例 #5
0
def fireworks(screen):
    scenes = []
    effects = [
        Stars(screen, screen.width),
        Print(screen,
              SpeechBubble("Press space to see it again"),
              y=screen.height - 3,
              start_frame=300)
    ]
    for _ in range(20):
        fireworks = [
            (PalmFirework, 25, 30),
            (PalmFirework, 25, 30),
            (StarFirework, 25, 35),
            (StarFirework, 25, 35),
            (StarFirework, 25, 35),
            (RingFirework, 20, 30),
            (SerpentFirework, 30, 35),
        ]
        firework, start, stop = choice(fireworks)
        effects.insert(
            1,
            firework(screen,
                     randint(0, screen.width),
                     randint(screen.height // 8, screen.height * 3 // 4),
                     randint(start, stop),
                     start_frame=randint(0, 250)))

    effects.append(
        Print(screen,
              Rainbow(screen, FigletText("CONGRATULATIONS")),
              screen.height // 2 - 6,
              speed=1,
              start_frame=100))
    effects.append(
        Print(screen,
              Rainbow(screen, FigletText("TO YOUR")),
              screen.height // 2 + 1,
              speed=1,
              start_frame=100))
    effects.append(
        Print(screen,
              Rainbow(screen, FigletText("OPTIMAL SCHEDULE")),
              screen.height // 2 + 1,
              speed=1,
              start_frame=100))
    scenes.append(Scene(effects, -1))

    screen.play(scenes, stop_on_resize=True, repeat=False)
コード例 #6
0
def demo(wout, win):
    while True:
        screen = Screen.from_windows(wout, win)
        effects = [
            Print(screen, Rainbow(screen, FigletText("256 colours")),
                  y=screen.height//2 - 8),
            Print(screen, Rainbow(screen, FigletText("for xterm users")),
                  y=screen.height//2 + 3),
            Clock(screen, screen.width//2, screen.height//2, screen.height//2),
        ]
        try:
            screen.play([Scene(effects, -1)], stop_on_resize=True)
            return
        except ResizeScreenError:
            pass
コード例 #7
0
ファイル: matics.py プロジェクト: chafgames/writer
def run(screen):
    scenes = []
    centre = (screen.width // 2, screen.height // 2)

    # Intro
    effects = [
        Stars(screen, (screen.width + screen.height) // 2, start_frame=0),
        Print(
            screen,
            FigletText(
                """I’m afraid sometimes you’ll play lonely games too, games you can’t win because
              you’ll play against you."""),
            x=centre[0] - 100,
            y=centre[1] - 20,
            clear=True,
            start_frame=0,
            stop_frame=200),
        Print(screen,
              Rainbow(screen, FigletText("Press <SPACE> to start")),
              x=centre[0] - 100,
              y=centre[1] - 20,
              clear=True,
              start_frame=200,
              stop_frame=2000),
    ]

    scenes.append(Scene(effects, -1))

    # Scene 1, start the game
    side_panel = [
        Print(screen,
              Box(screen.width // 5, screen.height, uni=screen.unicode_aware),
              0,
              0,
              start_frame=0),
        Print(screen,
              FigletText("Side", font="big"),
              x=0,
              y=1,
              clear=True,
              start_frame=0,
              stop_frame=100),
    ]

    effects = [
        Print(screen,
              Box((screen.width // 5) * 4,
                  screen.height,
                  uni=screen.unicode_aware),
              0,
              screen.width // 5,
              start_frame=0),
    ]

    final = side_panel + effects
    scenes.append(Scene(final, -1))
    screen.refresh()
    # sleep(100)

    screen.play(scenes, stop_on_resize=True)
コード例 #8
0
ファイル: test_renderers.py プロジェクト: zed/asciimatics
        def internal_checks(screen):
            # Create a base renderer
            plain_text = (".-------.\n" +
                          "| hello |\n" +
                          "`-------`\n")
            renderer = SpeechBubble("hello")
            self.assertEqual(str(renderer), plain_text)

            # Pretend that we always have an 8 colour palette for the test.
            screen.colours = 8

            # Check that the Rainbow renderer doesn't change this.
            rainbow = Rainbow(screen, renderer)
            self.assertEqual(str(rainbow), plain_text)

            # Check rainbow colour scheme.
            self.assertEqual(
                rainbow.rendered_text[1], [
                    [(1, 1, None), (1, 1, None), (3, 1, None), (3, 1, None), (2, 1, None),
                     (2, 1, None), (6, 1, None), (6, 1, None), (4, 1, None)],
                    [(1, 1, None), (3, 1, None), (3, 1, None), (2, 1, None), (2, 1, None),
                     (6, 1, None), (6, 1, None), (4, 1, None), (4, 1, None)],
                    [(3, 1, None), (3, 1, None), (2, 1, None), (2, 1, None), (6, 1, None),
                     (6, 1, None), (4, 1, None), (4, 1, None), (5, 1, None)],
                    []])
コード例 #9
0
def demo(screen):
    scenes = []
    cell1 = Rainbow(screen,
                    RotatedDuplicate(screen.width // 2,
                                     max(screen.width // 2, screen.height),
                                     FigletText("ASCII" if screen.width < 80 else "ASCII rules",
                                                font="banner",
                                                width=screen.width // 2)))
    cell2 = ""
    size = int(sqrt(screen.height ** 2 + screen.width ** 2 // 4))
    for _ in range(size):
        for x in range(size):
            c = x * screen.colours // size
            cell2 += "${%d,2,%d}:" % (c, c)
        cell2 += "\n"
    for i in range(8):
        scenes.append(
            Scene([Print(screen,
                         Kaleidoscope(screen.height, screen.width, cell1, i),
                         0,
                         speed=1,
                         transparent=False),
                   Print(screen,
                         FigletText(str(i)), screen.height - 6, x=screen.width - 8, speed=1)],
                  duration=360))
        scenes.append(
            Scene([Print(screen,
                         Kaleidoscope(screen.height, screen.width, StaticRenderer([cell2]), i),
                         0,
                         speed=1,
                         transparent=False)],
                  duration=360))
    screen.play(scenes, stop_on_resize=True)
コード例 #10
0
ファイル: farewall_dan.py プロジェクト: forter/goodbye-dan
def demo(screen):
    effects = [
        RandomNoise(screen,
                    signal=Rainbow(screen,
                                   FigletText("DAN  IS  THE  MAN!")))
    ]
    screen.play([Scene(effects, -1)], stop_on_resize=True)
コード例 #11
0
def fireworks(screen):
    scenes = []
    # Leer xlsx y seleccionar un estudiante
    student = get_student_from_xlsx(generation)
    student_split = student.split()
    effects = [
        Stars(screen, screen.width),
        Print(screen,
              SpeechBubble("Pulsa espacio para volver a ver"),
              y=screen.height - 3,
              start_frame=300)
    ]
    for _ in range(20):
        fireworks = [
            (PalmFirework, 25, 30),
            (PalmFirework, 25, 30),
            (StarFirework, 25, 35),
            (StarFirework, 25, 35),
            (StarFirework, 25, 35),
            (RingFirework, 20, 30),
            (SerpentFirework, 30, 35),
        ]
        firework, start, stop = choice(fireworks)
        effects.insert(
            1,
            firework(screen,
                     randint(0, screen.width),
                     randint(screen.height // 8, screen.height * 3 // 4),
                     randint(start, stop),
                     start_frame=randint(0, 250)))

    effects.append(Print(screen,
                         Rainbow(screen, FigletText("{} {}".format(student_split[0], student_split[1]), font='big')),
                         screen.height // 2 - 6,
                         speed=1,
                         start_frame=100))
    effects.append(Print(screen,
                         Rainbow(screen, FigletText("{} {}".format(student_split[2], student_split[3]), font='big')),
                         screen.height // 2 + 1,
                         speed=1,
                         start_frame=100))
    scenes.append(Scene(effects, -1))

    screen.play(scenes, stop_on_resize=True)
コード例 #12
0
ファイル: droplet.py プロジェクト: sellenth/algorithms
def demo(screen):
    effects = [
        RandomNoise(screen,
                    signal=Rainbow(screen,
                                   FigletText("ASCIIMATICS")))
    ]
    screen.play([Scene(effects, -1)], stop_on_resize=True)
    # Draw a large with a smaller rectangle hole in the middle.
    screen.fill_polygon([[(60, 0), (70, 0), (70, 10), (60, 10)],
                     [(63, 2), (67, 2), (67, 8), (63, 8)]])
コード例 #13
0
def demo(screen):
    scenes = []
    effects = [
        Stars(screen, screen.width),
        Print(screen,
              SpeechBubble("Press space to see it again"),
              y=screen.height - 3,
              start_frame=300)
    ]
    for i in range(20):
        fireworks = [
            (PalmFirework, 25, 30),
            (PalmFirework, 25, 30),
            (StarFirework, 25, 35),
            (StarFirework, 25, 35),
            (StarFirework, 25, 35),
            (RingFirework, 20, 30),
            (SerpentFirework, 30, 35),
        ]
        firework, start, stop = choice(fireworks)
        effects.insert(
            1,
            firework(screen,
                     randint(0, screen.width),
                     randint(screen.height // 8, screen.height * 3 // 4),
                     randint(start, stop),
                     start_frame=randint(0, 250)))

    effects.append(Print(screen,
                         Rainbow(screen, FigletText("HAPPY")),
                         screen.height // 2 - 6,
                         speed=1,
                         start_frame=100))
    effects.append(Print(screen,
                         Rainbow(screen, FigletText("NEW YEAR!")),
                         screen.height // 2 + 1,
                         speed=1,
                         start_frame=100))
    scenes.append(Scene(effects, -1))

    screen.play(scenes, stop_on_resize=True)
コード例 #14
0
def panic_demo(screen):
    scenes = []

    effects = [
        RandomNoise(screen, signal=Rainbow(screen, FigletText("Help!"))),
        Print(screen,
              FigletText("Panic!", "banner3"), (screen.height - 4) // 2,
              colour=Screen.COLOUR_MAGENTA,
              speed=1,
              stop_frame=30),
    ]
    scenes.append(Scene(effects, -1))
    screen.play(scenes, stop_on_resize=True, repeat=False)
コード例 #15
0
def suspense(screen):
    # Leer xlsx y seleccionar un estudiante
    student = get_student_from_xlsx(generation)
    student_split = student.split()
    text = "{} {} \n{} {}".format(
        student_split[0],
        student_split[1],
        student_split[2],
        student_split[3]
    )
    effects = [
        RandomNoise(screen,
                    signal=Rainbow(screen,
                                   FigletText(text)))
    ]
    screen.play([Scene(effects, -1)], stop_on_resize=True)
コード例 #16
0
ファイル: plasma.py プロジェクト: zencd/asciimatics
 def _add_cheesy_comment(self):
     msg = FigletText(choice(self._comments), "banner3")
     self._effects.append(
         Print(self._screen,
               msg, (self._screen.height // 2) - 4,
               x=(self._screen.width - msg.max_width) // 2 + 1,
               colour=Screen.COLOUR_BLACK,
               stop_frame=80,
               speed=1))
     self._effects.append(
         Print(self._screen,
               Rainbow(self._screen, msg), (self._screen.height // 2) - 4,
               x=(self._screen.width - msg.max_width) // 2,
               colour=Screen.COLOUR_BLACK,
               stop_frame=80,
               speed=1))
コード例 #17
0
ファイル: foundtext.py プロジェクト: chafgames/writer
 def reset(self, old_scene=None, screen=None):
     effects = [
         # Stars(screen, (screen.width + screen.height) // 2, start_frame=0),
         Print(self._screen,
               Plasma(self._screen.height, self._screen.width,
                      self._screen.colours),
               x=0,
               y=0,
               speed=10,
               start_frame=0,
               stop_frame=110,
               transparent=False),
         Print(
             self._screen,
             # Rainbow(self._screen, FigletText( "You found something, the memories are coming back.", font='thin', width=self._screen.width)),  # noqa: E501
             FigletText(
                 "You found something, the memories are coming back.",
                 font='thin',
                 width=self._screen.width),
             x=2,
             y=16,
             clear=False,
             transparent=True,
             start_frame=0,
             stop_frame=110),
         DropScreen(self._screen, 100, start_frame=100),
         Print(self._screen,
               Rainbow(
                   self._screen,
                   FigletText("Tom is alive...",
                              font='standard',
                              width=self._screen.width)),
               x=20,
               y=16,
               clear=True,
               start_frame=150,
               stop_frame=self.duration),
     ]
     for fx in effects:
         self.add_effect(fx)
コード例 #18
0
 def demo(screen):
     effects = [
         RandomNoise(screen,
                     signal=Rainbow(screen, FigletText("TEAM DROP TABLES")))
     ]
     screen.play([Scene(effects, 0)], stop_on_resize=True, repeat=False)
コード例 #19
0
def _credits(screen):
    scenes = []
    centre = (screen.width // 2, screen.height // 2)
    curve_path = []
    for i in range(0, 11):
        curve_path.append(
            (centre[0] + (screen.width / 3 * math.sin(i * math.pi / 5)),
             centre[1] - (screen.height / 3 * math.cos(i * math.pi / 5))))
    path = Path()
    path.jump_to(-20, centre[1] - screen.height // 3)
    path.move_straight_to(centre[0], centre[1] - screen.height // 3, 10),
    path.wait(30)
    path.move_round_to(curve_path, 80)
    path.wait(30)
    path.move_straight_to(7, 4, 10)
    path.wait(300)

    effects = [
        Sam(screen, path),
        Print(screen,
              SpeechBubble("WELCOME TO ASCIIMATICS", "L"),
              x=centre[0] + 12,
              y=(centre[1] - screen.height // 3) - 4,
              colour=Screen.COLOUR_CYAN,
              clear=True,
              start_frame=20,
              stop_frame=50),
        Print(screen,
              SpeechBubble("Wheeeeeee!"),
              y=centre[1],
              colour=Screen.COLOUR_CYAN,
              clear=True,
              start_frame=100,
              stop_frame=250),
        Print(screen,
              SpeechBubble("A world of possibilities awaits you...", "L"),
              x=18,
              y=0,
              colour=Screen.COLOUR_CYAN,
              clear=True,
              start_frame=350,
              stop_frame=400),
        Print(screen,
              ImageFile("globe.gif", colours=screen.colours),
              0,
              start_frame=400),
    ]
    scenes.append(Scene(effects, 600))

    effects = [
        Matrix(screen, stop_frame=200),
        Mirage(screen,
               FigletText("Asciimatics"),
               screen.height // 2 - 3,
               Screen.COLOUR_GREEN,
               start_frame=100,
               stop_frame=200),
        Wipe(screen, start_frame=150),
        Cycle(screen,
              FigletText("Asciimatics"),
              screen.height // 2 - 3,
              start_frame=200)
    ]
    scenes.append(Scene(effects, 250, clear=False))

    effects = [
        BannerText(
            screen,
            Rainbow(
                screen,
                FigletText("Reliving the 80s in glorious ASCII text...",
                           font='slant')), screen.height // 2 - 3,
            Screen.COLOUR_GREEN)
    ]
    scenes.append(Scene(effects))

    effects = [
        Mirage(screen, FigletText("Conceived and"), screen.height,
               Screen.COLOUR_GREEN),
        Mirage(screen, FigletText("written by:"), screen.height + 8,
               Screen.COLOUR_GREEN),
        Mirage(screen, FigletText("Peter Brittain"), screen.height + 16,
               Screen.COLOUR_GREEN),
        Scroll(screen, 3)
    ]
    scenes.append(Scene(effects, (screen.height + 24) * 3))

    effects = [
        Cycle(screen, FigletText("ASCIIMATICS", font='big'),
              screen.height // 2 - 8),
        Cycle(screen, FigletText("ROCKS!", font='big'),
              screen.height // 2 + 3),
        Stars(screen, (screen.width + screen.height) // 2)
    ]
    scenes.append(Scene(effects, 200))

    screen.play(scenes, stop_on_resize=True)
コード例 #20
0
def demo(screen):
    screen.set_title("ASCIIMATICS demo")

    scenes = []

    # First scene: title page
    effects = [
        Print(screen,
              Rainbow(screen, FigletText("ASCIIMATICS", font="big")),
              y=screen.height // 4 - 5),
        Print(screen,
              FigletText("Particle System"),
              screen.height // 2 - 3),
        Print(screen,
              FigletText("Effects Demo"),
              screen.height * 3 // 4 - 3),
        Print(screen,
              SpeechBubble("Press SPACE to continue..."),
              screen.height - 3,
              transparent=False,
              start_frame=70)
    ]
    scenes.append(Scene(effects, -1))

    # Next scene: just dissolve the title.
    effects = [
        ShootScreen(screen, screen.width // 2, screen.height // 2, 100),
    ]
    scenes.append(Scene(effects, 40, clear=False))

    # Next scene: sub-heading.
    effects = [
        DropScreen(screen, 100),
        Print(screen,
              Rainbow(screen, FigletText("Explosions", font="doom")),
              y=screen.height // 2 - 5,
              stop_frame=30),
        DropScreen(screen, 100, start_frame=30)
    ]
    scenes.append(Scene(effects, 80))

    # Next scene: explosions
    effects = []
    for _ in range(20):
        effects.append(
            Explosion(screen,
                      randint(3, screen.width - 4),
                      randint(1, screen.height - 2),
                      randint(20, 30),
                      start_frame=randint(0, 250)))
    effects.append(Print(screen,
                         SpeechBubble("Press SPACE to continue..."),
                         screen.height - 6,
                         speed=1,
                         transparent=False,
                         start_frame=100))
    scenes.append(Scene(effects, -1))

    # Next scene: sub-heading.
    effects = [
        Print(screen,
              Rainbow(screen, FigletText("Rain", font="doom")),
              y=screen.height // 2 - 5,
              stop_frame=30),
        DropScreen(screen, 100, start_frame=30)
    ]
    scenes.append(Scene(effects, 80))

    # Next scene: rain storm.
    effects = [
        Rain(screen, 200),
        Print(screen,
              SpeechBubble("Press SPACE to continue..."),
              screen.height - 6,
              speed=1,
              transparent=False,
              start_frame=100)
    ]
    scenes.append(Scene(effects, -1))

    # Next scene: sub-heading.
    effects = [
        Print(screen,
              Rainbow(screen, FigletText("Fireworks", font="doom")),
              y=screen.height // 2 - 5,
              stop_frame=30),
        DropScreen(screen, 100, start_frame=30)
    ]
    scenes.append(Scene(effects, 80))

    # Next scene: fireworks
    effects = []
    for _ in range(20):
        effects.append(
            StarFirework(screen,
                         randint(3, screen.width - 4),
                         randint(1, screen.height - 2),
                         randint(20, 30),
                         start_frame=randint(0, 250)))
    effects.append(Print(screen,
                         SpeechBubble("Press SPACE to continue..."),
                         screen.height - 6,
                         speed=1,
                         transparent=False,
                         start_frame=100))
    scenes.append(Scene(effects, -1))

    screen.play(scenes, stop_on_resize=True)
コード例 #21
0
ファイル: rainbow.py プロジェクト: clozach/xparrot
def demo(screen):
    render = Rainbow(screen, SpeechBubble('              \n              \n    This is   \n  a rainbow   \n              \n              '))
    effects = [RandomNoise(screen, signal=render)]
    screen.play([Scene(effects, -1)], stop_on_resize=True)
コード例 #22
0
ファイル: hny.py プロジェクト: Zdsk/Fun-projects
def demo(screen):
    scenes = []
    effects = [
        Stars(screen, screen.width),
        Print(screen,
              SpeechBubble("Press space to see it again"),
              y=screen.height - 3,
              start_frame=300)
    ]
    effects.append(
        Print(
            screen,
            Rainbow(screen, FigletText("3", font='roman')),
            screen.height // 2,
            speed=0.5,
            start_frame=0,
            clear=True,
            stop_frame=30,
        ))
    effects.append(
        Print(
            screen,
            Rainbow(screen, FigletText("2", font='roman')),
            screen.height // 2,
            speed=0.5,
            start_frame=35,
            clear=True,
            stop_frame=70,
        ))
    effects.append(
        Print(
            screen,
            Rainbow(screen, FigletText("1", font='roman')),
            screen.height // 2,
            speed=0.5,
            start_frame=75,
            clear=True,
            stop_frame=100,
        ))

    for _ in range(70):
        fireworks = [(PalmFirework, 25, 30), (PalmFirework, 25, 30),
                     (StarFirework, 20, 35), (StarFirework, 25, 35),
                     (StarFirework, 20, 35), (RingFirework, 30, 30),
                     (SerpentFirework, 35, 35), (SerpentFirework, 35, 35)]
        firework, start, stop = choice(fireworks)
        effects.append(
            firework(screen,
                     randint(0, screen.width),
                     randint(screen.height // 8, screen.height * 3 // 4),
                     randint(start, stop),
                     start_frame=randint(100, 250)))

    effects.append(
        Print(screen,
              Rainbow(screen, FigletText("HAPPY", font='roman')),
              screen.height // 2 - 8,
              speed=1,
              start_frame=100))
    effects.append(
        Print(screen,
              Rainbow(screen, FigletText("NEW YEAR !", font='roman')),
              screen.height // 2,
              speed=1,
              start_frame=100))
    effects.append(
        Print(screen,
              Rainbow(screen, FigletText("2021", font='roman')),
              screen.height // 2 + 8,
              speed=1,
              start_frame=100))
    scenes.append(Scene(effects, -1))

    screen.play(scenes, stop_on_resize=True)
コード例 #23
0
def demo(screen):
    render = Rainbow(screen, SpeechBubble('Gaurav D. Sharma'))
    effects = [RandomNoise(screen, signal=render)]
    screen.play([Scene(effects, -1)], stop_on_resize=True)
コード例 #24
0
def demo(screen):
    render = Rainbow(screen, SpeechBubble('D - C R Y P T O R'))
    effects = [RandomNoise(screen, signal=render)]
    screen.play([Scene(effects, 280)], stop_on_resize=True, repeat=False)
コード例 #25
0
ファイル: fire.py プロジェクト: sellenth/algorithms
def demo(screen):
    scenes = []

    effects = [
            RandomNoise(screen,
                signal=Rainbow(screen,
                    FigletText("ASCIIMATICS"))),
                Print(screen,
                    Fire(screen.height, 80, "*" * 70, 0.8, 60, screen.colours,
                        bg=screen.colours >= 256),
                    0,
                    speed=1,
                    transparent=False),
                Print(screen,
                    FigletText("Help!", "banner3"),
                    (screen.height - 4) // 2,
                    colour=Screen.COLOUR_BLACK,
                    speed=1,
                    stop_frame=30),
                Print(screen,
                    FigletText("I'm", "banner3"),
                    (screen.height - 4) // 2,
                    colour=Screen.COLOUR_BLACK,
                    speed=1,
                    start_frame=30,
                    stop_frame=50),
                Print(screen,
                    FigletText("on", "banner3"),
                    (screen.height - 4) // 2,
                    colour=Screen.COLOUR_BLACK,
                    speed=1,
                    start_frame=50,
                    stop_frame=70),
                Print(screen,
                    FigletText("Fire!", "banner3"),
                    (screen.height - 4) // 2,
                    colour=Screen.COLOUR_BLACK,
                    speed=1,
                    start_frame=70),
                ]
    scenes.append(Scene(effects, 100))

    text = Figlet(font="banner", width=200).renderText("ASCIIMATICS")
    width = max([len(x) for x in text.split("\n")])

    effects = [
            Print(screen,
                Fire(screen.height, 80, text, 0.4, 40, screen.colours),
                0,
                speed=1,
                transparent=False),
            Print(screen,
                FigletText("ASCIIMATICS", "banner"),
                screen.height - 9, x=(screen.width - width) // 2 + 1,
                colour=Screen.COLOUR_BLACK,
                bg=Screen.COLOUR_BLACK,
                speed=1),
            Print(screen,
                FigletText("ASCIIMATICS", "banner"),
                screen.height - 9,
                colour=Screen.COLOUR_WHITE,
                bg=Screen.COLOUR_WHITE,
                speed=1),
            ]
    scenes.append(Scene(effects, -1))

    screen.play(scenes, stop_on_resize=True)
コード例 #26
0
def demo(screen):
    scenes = []
    centre = (screen.width // 2, screen.height // 2)
    podium = (38, 20, 30, 20)
    podium2 = (30, 20)

    # Scene 1.
    path = Path()
    path.jump_to(-20, centre[1])
    path.move_straight_to(centre[0], centre[1], 10)
    path.wait(30)
    path.move_straight_to(podium[0], podium[1], 10)
    path.wait(100)

    effects = [
        Arrow(screen, path, colour=Screen.COLOUR_GREEN),
        _speak(screen, "BIENVENIDO A  ~~THE MINERS~~~ !!!", centre, 30),
        _speak(screen, "Tercera parte de Postdigital (Enrique Tomás).", podium,
               110),
        _speak(screen, "Quiero explicarte algo sobre la obra.", podium, 180),
    ]
    scenes.append(Scene(effects))

    # Scene 2.
    path = Path()
    path.jump_to(podium[0], podium[1])
    path.wait(1000)

    effects = [
        Arrow(screen, path, colour=Screen.COLOUR_GREEN),
        _speak(screen, "The Miners? ... ¿Los mineros?", podium, 10),
        _speak(screen, "Va sobre las criptomonedas y sus efectos...", podium,
               80),
        #Print(screen,
        #      Box(screen.width, screen.height, uni=screen.unicode_aware),
        #      0, 0, start_frame=90),
        _speak(screen, "Las criptomonedas son dinero electrónico.", podium,
               150),
        _speak(
            screen,
            "Sirven para transferir dinero sin intermediarios (como los bancos).",
            podium, 220),
        _speak2(
            screen,
            "Las transacciones necesitan ser verificadas por otros ordenadores de la red",
            podium, 300),
        _speak(screen, "que resuelven un complejo problema matemático.",
               podium, 400),
        _speak(screen, "...consumiendo mucha electricidad.", podium, 480),
        _speak2(screen, "Al año, tanta como un país como Irlanda o Suiza.",
                podium, 580),
        _speak(screen,
               "Por este motivo se recompensa económicamente a los nodos.",
               podium, 700),
        _speak2(
            screen,
            "El primero en resolverlo gana 12.5 bitcoins (1 bitcoin =~ 4200 euro) ",
            podium, 780),
        Stars(screen, (screen.width + screen.height) // 2, start_frame=360)
    ]
    scenes.append(Scene(effects, -1))

    # Scene 3.
    path = Path()
    path.move_straight_to(podium[2], podium[3], 10)
    path.wait(800)

    effects = [
        Arrow(screen, path, colour=Screen.COLOUR_GREEN),
        _speak(screen, "Durante esta obra, vamos a minar bitcoins...", podium2,
               10),
        _speak2(screen, "Cada nota que tocará el Emsemble Container...",
                podium2, 70),
        _speak2(
            screen,
            "verificará (minará) una transaccion de bitcoins en tiempo real",
            podium2, 160),
        _speak(screen, " y si tenemos suerte (1 elevado a menos 36)...",
               podium2, 260),
        _speak(screen, "¡¡¡ganaremos 12.5 bitcoins en este concierto!!!",
               podium2, 340),
        _speak(screen, "El minado (ejem... el concierto) va a empezar...",
               podium2, 420),
        RandomNoise(screen,
                    signal=Rainbow(
                        screen,
                        FigletText("El concierto... va a empezar...",
                                   font="term")),
                    start_frame=490)
    ]
    scenes.append(Scene(effects, -1))

    screen.play(scenes, stop_on_resize=True)
コード例 #27
0
ファイル: finish_screen.py プロジェクト: Alvoras/qtap
def animate(screen, game):
    score_text = FigletText(f"Score : {game.score}", font='slant')
    song_text = Rainbow(screen, FigletText(game.song.name, font='slant'))
    failure_text = FigletText(f"Failure : {game.missed}", font='slant')
    continue_text = FigletText("Press any key to continue", font="term")

    scenes = []
    effects = [Stars(screen, screen.width)]
    for _ in range(20):
        fireworks = [
            (PalmFirework, 25, 30),
            (PalmFirework, 25, 30),
            (StarFirework, 25, 35),
            (StarFirework, 25, 35),
            (StarFirework, 25, 35),
            (RingFirework, 20, 30),
            (SerpentFirework, 30, 35),
        ]
        firework, start, stop = choice(fireworks)
        effects.insert(
            1,
            firework(screen,
                     randint(0, screen.width),
                     randint(screen.height // 8, screen.height * 3 // 4),
                     randint(start, stop),
                     start_frame=randint(0, 250)),
        )

        effects.append(
            Print(
                screen,
                continue_text,
                screen.height - 3,
                5,
                transparent=False,
                speed=1,
            ))

        effects.append(
            Print(
                screen,
                continue_text,
                screen.height - 3,
                5,
                transparent=False,
                speed=1,
            ))

        effects.append(
            Print(screen,
                  song_text, (screen.height // 4) - 3,
                  (screen.width - song_text.max_width) // 2,
                  Screen.COLOUR_GREEN,
                  transparent=False,
                  speed=1,
                  start_frame=seconds_to_frame(1)))
        effects.append(
            Print(screen,
                  score_text, ((screen.height // 4) * 2) - 3,
                  (screen.width - score_text.max_width) // 2,
                  transparent=False,
                  speed=1,
                  start_frame=seconds_to_frame(2)))
        effects.append(
            Print(screen,
                  failure_text, ((screen.height // 4) * 3) - 3,
                  (screen.width - failure_text.max_width) // 2,
                  transparent=False,
                  speed=1,
                  start_frame=seconds_to_frame(3)))

    # effects.append(Print(screen,
    #                      Rainbow(screen, FigletText("NEW YEAR!")),
    #                      screen.height // 2 + 1,
    #                      speed=1,
    #                      start_frame=100))
    scenes.append(Scene(effects, -1))
    # scenes.append(Scene([ListView(screen)], -1))

    screen.play(scenes, repeat=False, stop_on_resize=True)
コード例 #28
0
def _credits(screen):
    scenes = []

    text = Figlet(font="banner", width=200).renderText("ASCIIMATICS")
    width = max([len(x) for x in text.split("\n")])

    effects = [
        Print(screen,
              Fire(screen.height, 80, text, 0.4, 40, screen.colours),
              0,
              speed=1,
              transparent=False),
        Print(screen,
              FigletText("ASCIIMATICS", "banner"),
              screen.height - 9,
              x=(screen.width - width) // 2 + 1,
              colour=Screen.COLOUR_BLACK,
              bg=Screen.COLOUR_BLACK,
              speed=1),
        Print(screen,
              FigletText("ASCIIMATICS", "banner"),
              screen.height - 9,
              colour=Screen.COLOUR_WHITE,
              bg=Screen.COLOUR_WHITE,
              speed=1),
    ]
    scenes.append(Scene(effects, 100))

    effects = [
        Matrix(screen, stop_frame=200),
        Mirage(screen,
               FigletText("Asciimatics"),
               screen.height // 2 - 3,
               Screen.COLOUR_GREEN,
               start_frame=100,
               stop_frame=200),
        Wipe(screen, start_frame=150),
        Cycle(screen,
              FigletText("Asciimatics"),
              screen.height // 2 - 3,
              start_frame=200)
    ]
    scenes.append(Scene(effects, 250, clear=False))

    effects = [
        BannerText(
            screen,
            Rainbow(
                screen,
                FigletText("Reliving the 80s in glorious ASCII text...",
                           font='slant')), screen.height // 2 - 3,
            Screen.COLOUR_GREEN)
    ]
    scenes.append(Scene(effects))

    effects = [
        Mirage(screen, FigletText("Conceived and"), screen.height,
               Screen.COLOUR_GREEN),
        Mirage(screen, FigletText("written by:"), screen.height + 8,
               Screen.COLOUR_GREEN),
        Mirage(screen, FigletText("Peter Brittain"), screen.height + 16,
               Screen.COLOUR_GREEN),
        Scroll(screen, 3)
    ]
    scenes.append(Scene(effects, (screen.height + 24) * 3))

    effects = [
        Mirage(screen, FigletText("With help from:"), screen.height,
               Screen.COLOUR_GREEN),
        Mirage(screen, FigletText("Cory Benfield"), screen.height + 8,
               Screen.COLOUR_GREEN),
        Mirage(screen, FigletText("Bryce Guinta"), screen.height + 16,
               Screen.COLOUR_GREEN),
        Mirage(screen, FigletText("Aman Orazaev"), screen.height + 24,
               Screen.COLOUR_GREEN),
        Mirage(screen, FigletText("Daniel Kerr"), screen.height + 32,
               Screen.COLOUR_GREEN),
        Mirage(screen, FigletText("Dylan Janeke"), screen.height + 40,
               Screen.COLOUR_GREEN),
        Scroll(screen, 3)
    ]
    scenes.append(Scene(effects, (screen.height + 48) * 3))

    effects = [
        Cycle(screen,
              FigletText("ASCIIMATICS", font='big'),
              screen.height // 2 - 8,
              stop_frame=100),
        Cycle(screen,
              FigletText("ROCKS!", font='big'),
              screen.height // 2 + 3,
              stop_frame=100),
        Stars(screen, (screen.width + screen.height) // 2, stop_frame=100),
        DropScreen(screen, 100, start_frame=100)
    ]
    scenes.append(Scene(effects, 200))

    effects = [
        Print(screen,
              SpeechBubble("Press 'X' to exit."),
              screen.height // 2 - 1,
              attr=Screen.A_BOLD)
    ]
    scenes.append(Scene(effects, -1))

    screen.play(scenes, stop_on_resize=True)
コード例 #29
0
def demo(screen):
    scenes = []
    effects = (
        Cycle(screen=screen,
              renderer=Fire(height=100,
                            width=100,
                            emitter='X',
                            intensity=0.5,
                            spot=5,
                            colours=5),
              y=int(screen.height / 2 - 8)),
        Cycle(screen=screen,
              renderer=FigletText('ACM @ Miami University'),
              y=int(screen.height / 2 - 6)),
        Cycle(screen=screen,
              renderer=FigletText('ROCKS!', font='big'),
              y=int(screen.height / 2 + 3)),
        Stars(screen=screen, count=200),
    )
    scenes.append(Scene(effects, duration=50))

    effects = (
        Print(screen=screen,
              renderer=Fire(screen.height,
                            80,
                            '*' * 70,
                            0.8,
                            60,
                            screen.colours,
                            bg=screen.colours >= 256),
              y=0,
              speed=1,
              transparent=False),
        Print(screen=screen,
              renderer=FigletText('Python', font='banner3'),
              y=(screen.height - 4) // 2,
              colour=Screen.COLOUR_BLACK,
              speed=1,
              start_frame=30,
              stop_frame=50),
        Print(screen=screen,
              renderer=FigletText('is', font='banner3'),
              y=(screen.height - 4) // 2,
              colour=Screen.COLOUR_BLACK,
              speed=1,
              start_frame=50,
              stop_frame=70),
        Print(screen=screen,
              renderer=FigletText('Awesome!', font='banner3'),
              y=(screen.height - 4) // 2,
              colour=Screen.COLOUR_BLACK,
              speed=1,
              start_frame=70),
    )
    scenes.append(Scene(effects, duration=100))

    effects = [Stars(screen, screen.width)]
    for _ in range(20):
        fireworks = [
            (PalmFirework, 25, 30),
            (PalmFirework, 25, 30),
            (StarFirework, 25, 35),
            (StarFirework, 25, 35),
            (StarFirework, 25, 35),
            (RingFirework, 20, 30),
            (SerpentFirework, 30, 35),
        ]
        firework, start, stop = choice(fireworks)
        effects.append(
            firework(screen,
                     randint(0, screen.width),
                     randint(screen.height // 8, screen.height * 3 // 4),
                     randint(start, stop),
                     start_frame=randint(0, 250)))

    effects.append(
        Print(screen,
              Rainbow(screen, FigletText("Join our")),
              screen.height // 2 - 6,
              speed=1,
              start_frame=100))
    effects.append(
        Print(screen,
              Rainbow(screen, FigletText("club!")),
              screen.height // 2 + 1,
              speed=1,
              start_frame=100))
    scenes.append(Scene(effects, duration=150))

    screen.play(scenes, repeat=True)
コード例 #30
0
def _credits(screen):
    scenes = []

    text = Figlet(font="banner", width=200).renderText("ASCIIMATICS")
    width = max([len(x) for x in text.split("\n")])

    effects = [
        Print(screen,
              Fire(screen.height, 80, text, 0.4, 40, screen.colours),
              0,
              speed=1,
              transparent=False),
        Print(screen,
              FigletText("ASCIIMATICS", "banner"),
              screen.height - 9,
              x=(screen.width - width) // 2 + 1,
              colour=Screen.COLOUR_BLACK,
              bg=Screen.COLOUR_BLACK,
              speed=1),
        Print(screen,
              FigletText("ASCIIMATICS", "banner"),
              screen.height - 9,
              colour=Screen.COLOUR_WHITE,
              bg=Screen.COLOUR_WHITE,
              speed=1),
    ]
    scenes.append(Scene(effects, 100))

    effects = [
        Matrix(screen, stop_frame=200),
        Mirage(screen,
               FigletText("Asciimatics"),
               screen.height // 2 - 3,
               Screen.COLOUR_GREEN,
               start_frame=100,
               stop_frame=200),
        Wipe(screen, start_frame=150),
        Cycle(screen,
              FigletText("Asciimatics"),
              screen.height // 2 - 3,
              start_frame=200)
    ]
    scenes.append(Scene(effects, 250, clear=False))

    effects = [
        BannerText(
            screen,
            Rainbow(
                screen,
                FigletText("Reliving the 80s in glorious ASCII text...",
                           font='slant')), screen.height // 2 - 3,
            Screen.COLOUR_GREEN)
    ]
    scenes.append(Scene(effects))

    effects = [
        Scroll(screen, 3),
        Mirage(screen, FigletText("Conceived and"), screen.height,
               Screen.COLOUR_GREEN),
        Mirage(screen, FigletText("written by:"), screen.height + 8,
               Screen.COLOUR_GREEN),
        Mirage(screen, FigletText("Peter Brittain"), screen.height + 16,
               Screen.COLOUR_GREEN)
    ]
    scenes.append(Scene(effects, (screen.height + 24) * 3))

    colours = [
        Screen.COLOUR_RED,
        Screen.COLOUR_GREEN,
    ]
    contributors = [
        "Cory Benfield", "Bryce Guinta", "Aman Orazaev", "Daniel Kerr",
        "Dylan Janeke", "ianadeem", "Scott Mudge", "Luke Murphy", "mronkain",
        "Dougal Sutherland", "Kirtan Sakariya", "Jesse Lieberg",
        "Erik Doffagne", "Noah Ginsburg", "Davidy22", "Christopher Trudeau",
        "Beniamin Kalinowski"
    ]

    effects = [
        Scroll(screen, 3),
        Mirage(
            screen,
            FigletText("With help from:"),
            screen.height,
            Screen.COLOUR_GREEN,
        )
    ]

    pos = 8
    for i, name in enumerate(contributors):
        effects.append(
            Mirage(
                screen,
                FigletText(name),
                screen.height + pos,
                colours[i % len(colours)],
            ))

        pos += 8
    scenes.append(Scene(effects, (screen.height + pos) * 3))

    effects = [
        Cycle(screen,
              FigletText("ASCIIMATICS", font='big'),
              screen.height // 2 - 8,
              stop_frame=100),
        Cycle(screen,
              FigletText("ROCKS!", font='big'),
              screen.height // 2 + 3,
              stop_frame=100),
        Stars(screen, (screen.width + screen.height) // 2, stop_frame=100),
        DropScreen(screen, 200, start_frame=100)
    ]
    scenes.append(Scene(effects, 300))

    effects = [
        Print(screen,
              SpeechBubble("Press 'X' to exit."),
              screen.height // 2 - 1,
              attr=Screen.A_BOLD)
    ]
    scenes.append(Scene(effects, -1))

    screen.play(scenes, stop_on_resize=True)