About
Scroll art is a form of ASCII art where a program generates text output in a command line terminal. After the terminal window fills, it begins to scroll the text upwards and create an animated effect. These programs are simple, beautiful, and accessible as programming projects for beginners. The SAM is a online collection of several scroll art examples.
Here are some select pieces:
- Zig-zag, a simple periodic pattern in a dozen lines of code.
- Orbital Travels, sine waves intertwining.
- Toggler, a woven triangular pattern restricted to two characters.
- Proton Stream, a rapid, chaotic lightning pattern.
There are two limitations to most scroll art:
- Program output is limited to text (though this could include emoji and color.)
- Once printed, text cannot be erased. It can only scroll up.
But these restrictions compel creativity. The benefit of scroll art is that beginner programmers can create scroll art apps with a minimal amount of experience. Scroll art requires knowing only the programming concepts of print, looping, and random numbers. Every programming langauge has these features, so scroll art can be created in any programming language without additional steps. You don't have to learn heavy abstract coding concepts or configure elaborate software libraries.
Many scroll art programs are under a couple dozen lines long. Here's the Python source code for "Starfield":
# Press Ctrl-C to stop the program.
import random, time, os
change_amount = 0.5 # How fast the density changes.
density = 0.0
while True:
width = os.get_terminal_size()[0] - 1
if density < 0 or density > 100:
change_amount *= -1 # Reverse the density direction.
density = density + change_amount
line = '' # Create the line of asterisks.
for i in range(width):
if random.randint(0, 100) < density:
line = line + '*' # Add an asterisk.
else:
line = line + ' ' # Add an empty space.
print(line)
time.sleep(0.02)
You can look at the infinitely generated output on the "Starfield" exhibit page or this excerpt here:
* *
* * * * * * *
** * * * * * ** *
* ** * * * * * **
* * *** * * * * * *
* * * *** * ** ** * ** * *
* ** * * ** * * * * * ** * * * *
* * ** * * * * * * ** ** ** *
* * ** * * * *** * * *** * * * ** *
*** * **** * * ** * * ** * * * * *** * **
* * * * * * *** **** * * ***** **** * * * * ** * ** *
* * * * * *** *** *** ** * * ** * **** ****
** ***** * ******* * ** * * *** ** *** * * * ** * ****
** ** ** * *** ** ***** *** * ** * *** * **** *** **** * * *
** * **** * * * *** **** ** *** *** **** ** * ***** * * * *** * **
* * * *** ** * ** * *** ******* * * * * * * *** * * **** * *
* * *** ** *** ** * * **** ** * *********** *** *** ** **** ** ********
** ** **** * ** *** * ** *** * ** * ****** *** *** ** ******** *****
**** *** **** ******* ****** ***** * ******** ***** *** * **** *****
* ***** ****** ****** **** ** * **** ** ** ** ** **** * * ******* *****
**** * * ** ****** *** * **** ******** * ****** ** * ** *************** * **
*** ********** **** *** *** *** *** * ******* ******** * * ***** ****** ** ****
*** *** ** ***** **** *** * **** ***** * **** *** ** ** ************* *** ***
***** ** ********** ************* * *** ***** ** *** * ******* ***** ***** **
*********** * ********** *** ********** *** ************* **** ** ******* ****
***** ** **** ***************** ******* * ** ***************** ***************
************************************** ***** **********************************
*******************************************************************************
*******************************************************************************
******** ****** **************************** ***** ***************** * ********
** ******* ***** *********** ****************************** ******* **********
* ***************** ***** ***************** ******* ******************** ******
********** ** ********** *** * ******************* ******* *******************
***** ******** *** **** ** * * ** * * * *** * ********* *********************
* ***** *** ****** * **** ** ************ ****** ***** **** ******* *********
**** * **** * ** ******** * ** ** ** * ** *** *** ********** ************
** * **** ** **** ** ***** ****** * ****** **** **** * * * ******
** * * *** ** * *** *** ***** * **** * ******** ** **** *** *******
* ** * * **** * ** **************** ** * *** * ************ *** ****** **
*** * ** * ** ***** ** * **** *** **** * ***** * * * ** ** ****
* * ******* * * * ***** ** * * * * *** ***** ** *** **** * * * *
* * * * * * * * * * * ** * ****** *** ** ** ****** *
*** ** * ** *** **** *** * * **** * ** ** ** * **** ** *
******* **** * * * ** **** ** **** * *** *** ** ** * * ** *
* * * * * ** * * * * * *** ***** * * * ** * **** * *
* * * * ** * * ** ** * * * * ** ** * * **
****** * ** * * **** * **** ** * * * * **** **** **** * * * * * *
* * * ** * * * *** ****** ***** * ** ** * * ** *
* ** * * * * * * * ** *** * * * ** ** * *
*** * * * * * * * * * * * * * ** ** * * * * **
** ** **** * ** ** * * ** * * * * * ** * * * *
* * * * * * * *
* * * * ** * * * * * * *
* * * * * * * * * *
* * * * * **
* * * **
* *
Scroll art's animation isn't the same as the animation of most computer graphics that redraws the screen or flip books that have a series of images. But there is still a wide variety of possible scroll art programs to write. The constraints of scroll art form a garden for creativity.
Scroll art is an idea that isn't dependent on modern computers. All of the scroll art at the SAM could be recreated on personal computers from the 1970s and 1980s.
About the Artist
Al Sweigart coined the term "scroll art" and is the curator of https://scrollart.org. He has written several programming books for beginners, including Automate the Boring Stuff with Python. All of his books are freely available under a Creative Commons license at https://inventwithpython.com. His The Big Book of Small Python Projects has several animated works, which he later expanded upon to create scroll art and the SAM.