def demo(screen): scenes = [] effects = [ Print(screen, FigletText("JOGET BRO", font='banner3' if screen.width > 80 else 'banner'), screen.height//2-3, colour=7, bg=7 if screen.unicode_aware else 0), ] scenes.append(Scene(effects)) effects = [ Print(screen, ColourImageFile(screen, "joget.gif", screen.height, uni=screen.unicode_aware), screen.height, speed=1), Scroll(screen, 2) ] scenes.append(Scene(effects)) effects = [ BannerText(screen, ColourImageFile(screen, "joget.gif", screen.height-2, uni=screen.unicode_aware, dither=screen.unicode_aware), 0, 0), ] scenes.append(Scene(effects)) effects = [ Print(screen, FigletText("THANKS", font='banner3' if screen.width > 80 else 'banner'), screen.height//2-3, colour=7, bg=7 if screen.unicode_aware else 0), ] scenes.append(Scene(effects)) screen.play(scenes, stop_on_resize=True)
def demo(screen): scenes = [] effects = [ Print(screen, ColourImageFile(screen, "colour_globe.gif", screen.height - 2), 0, stop_frame=200), Print(screen, FigletText("ASCIIMATICS NEWS", font='banner3'), screen.height // 2 - 3, colour=7), ] scenes.append(Scene(effects)) effects = [ Print(screen, ColourImageFile(screen, "grumpy_cat.jpg", 40), screen.height, stop_frame=(40 + screen.height) * 3), Scroll(screen, 3) ] scenes.append(Scene(effects)) effects = [ BannerText(screen, ColourImageFile(screen, "python.png", screen.height - 2), 0, 0), ] scenes.append(Scene(effects)) screen.play(scenes, stop_on_resize=True)
def internal_checks(screen): screen.play([ Scene([ MockEffect(count=5), Print(screen, FigletText("hello"), 2), Cycle(screen, FigletText("world"), 6), BannerText(screen, FigletText("world"), 10, 3), Mirage(screen, FigletText("huh?"), 14, 2)], 0)])
def demo(screen): scenes = [] effects = [ Print(screen, ImageFile("globe.gif", screen.height - 2, colours=screen.colours), 0, stop_frame=100), ] scenes.append(Scene(effects)) effects = [ Print(screen, ColourImageFile(screen, "colour_globe.gif", screen.height - 2, uni=screen.unicode_aware, dither=screen.unicode_aware), 0, stop_frame=200), Print(screen, FigletText("ASCIIMATICS", font='banner3' if screen.width > 80 else 'banner'), screen.height // 2 - 3, colour=7, bg=7 if screen.unicode_aware else 0), ] scenes.append(Scene(effects)) effects = [ Print(screen, ColourImageFile(screen, "grumpy_cat.jpg", screen.height, uni=screen.unicode_aware), screen.height, speed=1, stop_frame=(40 + screen.height) * 3), Scroll(screen, 3) ] scenes.append(Scene(effects)) effects = [ BannerText( screen, ColourImageFile(screen, "python.png", screen.height - 2, uni=screen.unicode_aware, dither=screen.unicode_aware), 0, 0), ] scenes.append(Scene(effects)) screen.play(scenes, stop_on_resize=True)
def demo(screen): effects = [ Cycle( screen, FigletText("ASCIIMATICS", font='big'), screen.height // 2 - 8), BannerText( screen, FigletText("ROCKS!", font='big'), screen.height // 2 + 3, Screen.COLOUR_CYAN, Screen.COLOUR_BLACK), Stars(screen, (screen.width + screen.height) // 2) ] screen.play([Scene(effects, 500)])
def test_banner(self): """ Check that BannerText works. """ # Check that banner redraws every frame. screen = MagicMock(spec=Screen, colours=8) canvas = Canvas(screen, 10, 100, 0, 0) effect = BannerText(canvas, StaticRenderer(images=["hello"]), 2, 3) effect.reset() effect.update(0) self.assertEqual(canvas.get_from(canvas.width - 1, 2), (ord("h"), 3, 0, 0)) effect.update(1) self.assertEqual(canvas.get_from(canvas.width - 1, 2), (ord("e"), 3, 0, 0)) # Check there is some stop frame - will vary according to screen width self.assertGreater(effect.stop_frame, 0)
def test_banner(self): """ Check that BannerText works. """ # Check that banner redraws every frame. screen = MagicMock(spec=Screen, colours=8, unicode_aware=False) canvas = Canvas(screen, 10, 100, 0, 0) effect = BannerText(canvas, StaticRenderer(images=["hello"]), 2, 3) effect.reset() effect.update(0) self.assertEqual(canvas.get_from(canvas.width - 1, 2), (ord("h"), 3, 0, 0)) effect.update(1) self.assertEqual(canvas.get_from(canvas.width - 1, 2), (ord("e"), 3, 0, 0)) # Check there is some stop frame - will vary according to screen width self.assertGreater(effect.stop_frame, 0) # This effect should ignore events. event = object() self.assertEqual(event, effect.process_event(event))
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)
def demo(screen): scenes = [] centre = (screen.width // 2, screen.height // 2) # Title effects = [ BannerText(screen, ColourImageFile(screen, "pacman.png", 16, 0, True), (screen.height - 16) // 2, Screen.COLOUR_WHITE), Print( screen, StaticRenderer(images=[ "A tribute to the classic 80's " "video game by Namco." ]), screen.height - 1) ] #scenes.append(Scene(effects, 0)) # Scene 1 - run away, eating dots path = Path() path.jump_to(screen.width + 16, centre[1]) path.move_straight_to(-16, centre[1], (screen.width + 16) // 3) path.wait(100) if screen.colours <= 16: inky = 6 pinky = 5 blinky = 1 clyde = 2 else: inky = 14 pinky = 201 blinky = 9 clyde = 208 effects = [ PacMan(screen, path), Ghost(screen, deepcopy(path), inky, start_frame=40), Ghost(screen, deepcopy(path), pinky, start_frame=60), Ghost(screen, deepcopy(path), blinky, start_frame=80), Ghost(screen, deepcopy(path), clyde, start_frame=100), ] for x in range(5, screen.width, 16): effects.insert( 0, Print(screen, StaticRenderer(images=[dot]), screen.height // 2, x=x, speed=1, stop_frame=4)) scenes.append(Scene(effects, 100 + screen.width)) # Scene 2 - Chase ghosts after a power pill scenes.append(EatingScene(screen)) # Scene 3 - Thanks... effects = [ Print(screen, FigletText("Thank you,"), screen.height // 3 - 3, colour=Screen.COLOUR_RED), Print(screen, StaticRenderer(images=[namco]), screen.height * 2 // 3 - 2, colour=Screen.COLOUR_RED), Print(screen, StaticRenderer(images=["< Press X to exit. >"]), screen.height - 1) ] scenes.append(Scene(effects, 0)) screen.play(scenes, stop_on_resize=True, repeat=False)
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)
def demo(screen): #empty array to save all effects scenes = [] #show text effects = [ Print(screen, FigletText("yourname", font='banner3' if screen.width > 80 else 'banner'), screen.height // 2 - 3, colour=7, bg=7 if screen.unicode_aware else 0), ] scenes.append(Scene(effects)) #show taki.gif effects = [ Print(screen, ColourImageFile(screen, "assets/images/taki.gif", screen.height, uni=screen.unicode_aware), screen.height, speed=1), Scroll(screen, 2) ] scenes.append(Scene(effects)) #show mitsuha.gif effects = [ BannerText( screen, ColourImageFile(screen, "assets/images/mitsuha.gif", screen.height - 2, uni=screen.unicode_aware, dither=screen.unicode_aware), 0, 0), ] scenes.append(Scene(effects)) #show mitshua2.gif effects = [ Print( screen, ColourImageFile(screen, "assets/images/mitsuha2.gif", screen.height, uni=screen.unicode_aware), screen.height, speed=1, ), Scroll(screen, 2) ] scenes.append(Scene(effects)) #show both.gif effects = [ Print(screen, ColourImageFile(screen, "assets/images/both.gif", screen.height - 2, uni=screen.unicode_aware, dither=screen.unicode_aware), 0, stop_frame=200), ] scenes.append(Scene(effects)) #show end text effects = [ Cycle(screen, FigletText("KimiNoNamaewa?", font="big"), int(screen.height / 2 - 8)), Cycle( screen, FigletText("YourName", font="small"), int(screen.height / 2 + 3), ), ] scenes.append(Scene(effects)) screen.play(scenes, stop_on_resize=True)
def _credits(screen): scenes = [] effects = [ Matrix(screen, stop_frame=200), Print(screen, FigletText("Catch Me", "banner3"), screen.height - 31, colour=Screen.COLOUR_WHITE, bg=Screen.COLOUR_WHITE, speed=1, start_frame=50, stop_frame=200), Print(screen, FigletText("(On Time)", "banner3"), screen.height - 21, colour=Screen.COLOUR_WHITE, bg=Screen.COLOUR_WHITE, speed=1, start_frame=75, stop_frame=200), Print(screen, FigletText("If You Can", "banner3"), screen.height - 11, colour=Screen.COLOUR_WHITE, bg=Screen.COLOUR_WHITE, speed=1, start_frame=100, stop_frame=200) ] scenes.append(Scene(effects, 250, clear=False)) effects = [ Background(screen, bg=Screen.COLOUR_BLACK), Print(screen, FigletText("Understanding the", "banner"), screen.height - 31, colour=Screen.COLOUR_WHITE, bg=Screen.COLOUR_WHITE, speed=1, start_frame=0, stop_frame=200), Print(screen, FigletText("Effectiveness of", "banner"), screen.height - 21, colour=Screen.COLOUR_WHITE, bg=Screen.COLOUR_WHITE, speed=1, start_frame=25, stop_frame=200), Print(screen, FigletText("Twitter URL Blacklist", "banner"), screen.height - 11, colour=Screen.COLOUR_WHITE, bg=Screen.COLOUR_WHITE, speed=1, start_frame=50, stop_frame=200) ] scenes.append(Scene(effects, 250, clear=False)) effects = [ Background(screen, bg=Screen.COLOUR_BLACK), Print(screen, FigletText("Authors:", "banner"), screen.height - 21, colour=Screen.COLOUR_WHITE, bg=Screen.COLOUR_WHITE, speed=1, start_frame=0, stop_frame=50, clear=1), Print(screen, FigletText("Simon Bell", "banner"), screen.height - 21, colour=Screen.COLOUR_WHITE, bg=Screen.COLOUR_WHITE, speed=1, start_frame=50, stop_frame=100, clear=1), Print(screen, FigletText("Lorenzo Cavallaro", "banner"), screen.height - 21, colour=Screen.COLOUR_WHITE, bg=Screen.COLOUR_WHITE, speed=1, clear=1, start_frame=100, stop_frame=150), Print(screen, FigletText("Kenny Paterson", "banner"), screen.height - 21, colour=Screen.COLOUR_WHITE, bg=Screen.COLOUR_WHITE, speed=1, start_frame=150, stop_frame=200), ] scenes.append(Scene(effects)) effects = [ Background(screen, bg=Screen.COLOUR_BLACK), BannerText( screen, FigletText("Live measurement experiments in progress", font='banner3', width=400), #screen.height // 2 - 3, screen.height - 21, Screen.COLOUR_GREEN) ] scenes.append(Scene(effects)) screen.play(scenes, stop_on_resize=True)
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)