TheGreatRambler /
AnimASCII.js
ASCII art animation library in Javascript using Canvas
Loading repository data…
bejd / repository
An ASCII art music video animated with JavaScript
Music videos are an essential part of any band's promotional materials. Charlotte Light and Dark live in different countries, so on the rare occasion we're all together it can be hard to find time to film a traditional music video. The limited hours we have tend to be reserved for higher priority pursuits such as writing new music, rehearsing songs, and occasionally playing shows. As such, I aimed to create a music video using animated ASCII art that could be hosted on a simple webpage.
After a fair amount of searching it seems that there is very little in the way of ASCII art animation software. So I decided to keep things simple and write an ASCII art animator in JavaScript.
The music video can be viewed being animated in real time at https://clad.band. Alternatively, a recording of the animation is on YouTube.
I've borrowed from film terminology in the naming of many elements in this project. The text files that contain each separate ASCII animation are referred to as "reels", and when these are processed they are split into "frames".
When the page has finished loading, the function loadFiles() is called. This gets each unique item from the PLAYLIST array and fetches the relevant text file from the server. When the files are returned, it stores the file name and contents in a reels array for later use. When all files have been fetched, the Play button is enabled.
On clicking Play, the song begins. As no animation happens during the intro, the function introWait() delays the start of the animation functions.
When ready, the playlistController() function is called. This iterates through each element in the PLAYLIST array, calling functions based on the current position in the array. For example, if the current position contains the string "!i", the fxInvertColours() function is called (see below). If the array is a reel name (e.g. "v3" or "g2"), string data is retrieved from the reel array by findReel() and animation begins.
At this point getReady() takes the reel string and splits it into frames based on the number of characters and lines defined in the FRAME-WIDTH and FRAME-HEIGHT constants. Certain effects are also implemented here, before adding the combined lines to a frames array.
Once all frames have been created, they can be animated on the page by drawFrames(). This is relatively simple: it replaces the contents of the <pre> element with an item from frames, waits for a short time (defined by the FPS constant), then repeats. On playing all frames in the reel, the playlistController() is called again, the next reel or effect is called, and the whole process repeats.
In addition to setting the play order of reel files, the PLAYLIST array can also be used to trigger visual and temporal effects. These can be specified sequentially in the array to apply multiple effects to a single reel.
Playlist keyword: !f
What it does: flips the reel horizontally by reversing the order of each line as it's loaded into the frame before animation begins.
Playlist keyword: !h
What it does: halves the rate at which the reel file appears to play by doubling each frame as they are added to the frames array.
Playlist keyword: !i
What it does: inverts colours in the web page by adding the .invert class to the body and button elements. The colours stay inverted until the invert effect is called again, or the music video reaches its end.
Playlist keyword: !r
What it does: reverses the order in which the frames are played for the next reel file in the playlist.
Playlist keyword: !s, a, b (where a and b are integers and the following items in the array)
What it does: plays only a certain amount of frames starting at a (where the first frame is 1) and ending at b for the next reel file in the playlist. If b is greater than the amount of frames in the reel, the reel is played through to the end (i.e. it doesn't repeat frames or anything).
I'm not an artist. Rather than create the hundreds of images using a pure text editor, I used a crutch: JavE. It hasn't been updated in a decade and it crashes frequently, but without it this would have taken magnitudes longer. My general workflow would be:
All in all it's a painstaking, time-consuming, tiring, yet rewarding process. Much like traditional pencil-and-paper animation, I suppose.
Selected from shared topics, language and repository description—not editorial ratings.
TheGreatRambler /
ASCII art animation library in Javascript using Canvas
oZaGGo /
This is a project I made while learning about functions, arrays, and file reading in JavaScript. You can upload an ASCII art text file made with '*' characters, and it will create a basic fluid simulation. It's a fun way to practice coding while exploring ASCII art and basic animations.
patrikbartas /
Animated ASCII wordmark canvas engine and demo with monochrome themes, particle accents, and reusable integration patterns.
horacehoff /
A very simple and lightweight JavaScript library (676 bytes minified) to animate ASCII art. Essentially, what it does is animate an "intro animation" of your ASCII art.
bedigambar /
An advanced, interactive browser-based studio for creating stunning dithered art, retro ASCII animations, and custom dot matrix graphics.