beanz Magazine

Make a Bird Wave!

A simple animation is a fun way to play with and learn the Python programming language.

When watching your favourite cartoon, or the latest superhero blockbuster, it’s tempting to think that the characters on screen are actually moving. Everything just looks so fluid! In reality, video is a clever deception. It’s actually a series of a still images flashed so quickly our brains is tricked into thinking that the images are one smooth sequence.

Of course, the difference between neighbouring images has to be very small, or the motion looks jerky. There also has to be enough images — or ‘frames’ — per second for the illusion to hold. 24 frames per second (FPS) is the industry standard, but research suggests that our minds can create a smooth video out of as little as 16 FPS.

Today, we’re going to make a simple animation with Python!

Setup

First, open up your browser and navigate to www.repl.it and then type ‘Python’ or ‘Python3’ into the search box and hit enter.

Drawing Frames

The most important part of animation is creating the images. To make things simple, we’re going to use ‘ASCII art’. This is a fancy of way of saying we’re making images out of typed letters, numbers, and symbols. For example:

Faces!
:-) :-D :-O

Waving!
\(^u^)/ _(^u^)_ _(^.^)_ \(^.^)/

Fish!
><(((* > ><(((* < ><(((^ < ><(((^ >

ASCII is an abbreviation of ‘American Standard Code for Information Interchange’. It’s one of several systems programmers used to encode text on a computer.

Remember: since these images are strung together, the difference between them needs to be small!

The Code

Write the code snippet on the next page into the left-hand window at the repl.it website:

 

Become a subscriber and get access to the rest of this article. Plus all our magazine articles.

Stories also include numerous links to help parents, kids, and teachers learn more. Get access today at just $15 per year!

Subscribe Today!

Also In The June 2017 Issue

Can we measure the time and steps required for things to happen?

This Canadian experiment used a robot to explore how people respond to robots and technology.

An amazing new book turns math problems into shapes and illustrations.

This pen and paper project helps organize ideas into stories with a finite state machine.

While you can't use soap and water on your code, you can keep your code as sparkly clean as any dish or silverware.

This project explores the basics of using Google's Static Map software to display your own maps.

Most people love cookies. But these cookies are the kind that make the internet possible.

Links from the bottom of all the June 2017 articles, collected in one place for you to print, share, or bookmark.

Interesting stories about computer science, software programming, and technology for June 2017.

Software languages don't magically appear. They're created by design. First in a series.