Welcome, guest | Sign In | My Account | Store | Cart

small animation using ascii

Python, 13 lines
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
import ascii
def bounce_ball():
    ball="o"
    a=ascii()
    film1=["_\no\n\n\n\n\n\n_", "_\n\no\n\n\n\n\n_", "_\n\n\no\n\n\n\n_",
           "_\n\n\n\no\n\n\n_", "_\n\n\n\n\no\n\n_", "_\n\n\n\n\n\no\n_"]
    filmb=["_\no\n\n\n\n\n\n_", "_\n\no\n\n\n\n\n_", "_\n\n\no\n\n\n\n_",
          "_\n\n\n\no\n\n\n_", "_\n\n\n\n\no\n\n_", "_\n\n\n\n\n\no\n_"]
    filmb=filmb[::-1]
    main=True
    while main:
        a.roll_film(film1, 2)
        a.roll_film(filmb, 2)
        

plz download

2 comments

Barry Walker 10 years, 7 months ago  # | flag

A little constructive criticism...

I am not sure whether this is intended to be platform independent, so remember, there are many of them.

You haven't indicated which one this code was intended for.

Also your animation module, (I assume it is yours), looks as though it is intended for Python 2.x.x. WHich is the minimum Python Version? This _module_ has _newlines_ to clear the CLI/CommandPrompt/Terminal window. Why 1000 of them? Double the number on a default Windows 7 CMD.EXE, (which is 80 x 25), of 50 would be well over the top. I often use 64 if I decide on a generic CLS...

Although this code might work on your platform and assuming it is platform independent, running this on say AMIGAOS will result in an irritatingly SSLLOOWW display __refresh__. Windows has an annoying flicker in its Terminal/Command prompt on _fast_clear_screen(s)_. Linux has so many variants now that without testing on various Terminals/Shells you should quote which ones you have tested on.

I will try it all out on my ACER ASPIRE ONE netbook running PCLinuxOS 2009 from a bootable USB, (this unit has NO internal drive), and see how it performs...

LBNL, I am not voting on this code as I am just pointing you to the pitfalls of anims in differing platforms...

Bazza...

Andrew Wayne Teesdale Jr. (author) 10 years, 7 months ago  # | flag

it was made on windows so... idk about other platforms :) XD