Friday, 3 May 2013

How To Make Batch File Animations!


In this instructable I am going to show you how to make simple batch file animations.
Similar to "The Star Wars" batch.

So lets Get Started!

Step 1: The Bouncing Ball

The Bouncing Ball!

After seeing the "Batch Star Wars" I decided to make The Bouncing Ball a simple batch that I coded in my free time (during school study halls).
This was my first attempt at an animation in batch.
After about a 5 days of trial and error. I got it working.

So now im going to show you how to make one yourself.

Step 2: The Bouncing Ball Code and Explanation

Of Course you need some code to make this animation.

Just like a camera having frames or "pictures" to make a video batch Can be used the same way.

So we need to make a bunch of "pictures" for the batch file to display in an timed order.

Here is some example code of a bouncing ball....

echo -------------------
echo *
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo -------------------
ping localhost -n 1 >nul
cls
echo -------------------
echo.
echo *
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo -------------------
ping localhost -n 1 >nul
cls

The * is the ball. After every frame the ball moves one space down.

After Every "Frame" we use cls to clear the screen so its ready for the next "frame".

And ping localhost -n 1 >nul is a code used to pause the code just for a fraction of a second.

You can download my full bouncing ball Batch below.

Step 3: Party Time Batch!

Ah Yes The Party Time Batch!

Once again the "Party Time Batch" was a Batch I coded in my free time.

This batch is Still Suitable to be an "Animation". This is one of the most Fun batches I ever created.
This is Similar to the Bouncing Ball that they both have "Frames" but this one changes color.

Here is a Code Sample But Download the full batch.

:top
cls
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo *********
echo *** ***
echo *** *** ******
echo ********* ****** **
echo *** *** ** * ** ** **
echo *** ** ** ****** ** ** **
echo *** ******* ** ** ** **
echo *** ** ** ** ** ** **
echo *** ** ** ** ** ** **
echo.
color 1a
ping localhost -n 0 >nul
color 2b
ping localhost -n 0 >nul
color 3c
ping localhost -n 0 >nul
color 4d
ping localhost -n 0 >nul
color 5e
ping localhost -n 0 >nul
color 6f
ping localhost -n 0 >nul
color 7a
ping localhost -n 0 >nul
color 8b
ping localhost -n 0 >nul
color 9c
ping localhost -n 0 >nul
goto time
Party Time.zip592 bytes

Step 4: Post Your Creations!

Have Fun with this information.

If You Could Post Your Animations I would love to see how they came out.

Below Are the 2 Files Again.
Party Time.zip592 bytes

Step 5: Upcoming.......

Right Now Im working on a Batch Pong!!!

2 comments:

  1. Thanks for posting. How would I change the length of the animation I create? Currently, it goes by really fast and there isn't much to see due to that. Thanks in advanced.

    ReplyDelete
    Replies
    1. edit it and change the ping value as you wish.If you choose 1 then that colour will remian for 1 second.

      Delete