octobanana / asciimation Goto Github PK
View Code? Open in Web Editor NEWAn ASCII animation interpreter for the terminal.
License: MIT License
An ASCII animation interpreter for the terminal.
License: MIT License
From a reddit threat:
Nice.
This still seems to be a lot of work, though. The plane file has 814 lines. Wouldn't it be nice to allow specifying a function (with frame number, width and hight as arguments) and use its output as the image of the frame?
I wrote an example how this could look (simple bash script written today in the tramway, so don't expect too much of it):
#!/usr/bin/env bash
function scroll {
scroll_by=$1
max_length=$2
line=$3
end_chars=$(printf %"$max_length"s)
# from the string $line take the last $scroll_by chars, then take
# only the last max_lenght chars of those.
echo -n "$end_chars" "$line" | tail -c $scroll_by | head -c $max_length
# if the newline in the command above wouldn't be suppressed it
# might be cut away by head, so we add it here afterwards
echo ""
}
function plane {
# naming the arguments for readability
frame=$1
width=$2
height=$3
case $(($frame%4)) in
0)
scroll $frame $width "/----------------------\ ___ "
scroll $frame $width "| | \~~\_____/~~\__ "
scroll $frame $width "| Automation |______________ \______====== )-+"
scroll $frame $width "| | ~~|/~~ "
scroll $frame $width "\----------------------/ () "
;;
2)
scroll $frame $width "/----------------------\ ___ "
scroll $frame $width "| | \~~\_____/~~\__ |"
scroll $frame $width "| Automation |______________ \______====== )-+"
scroll $frame $width "| | ~~|/~~ |"
scroll $frame $width "\----------------------/ () "
;;
[1,3])
scroll $frame $width "/----------------------\ ___ "
scroll $frame $width "| | \~~\_____/~~\__ ."
scroll $frame $width "| Automation |______________ \______====== )-+"
scroll $frame $width "| | ~~|/~~ '"
scroll $frame $width "\----------------------/ () "
;;
esac
}
# main
clear
for i in $(seq 150);
do
plane $i 50 5
sleep 0.08
clear
done
I think it provides a simpler way to compose animations and to adapt them later (like in the example to add another frame to the plane.
Hey there,
I have a project in ruby where I use animated ASCII. I collect these
into standalone text files though.
Is it possible for asciimation to also show/dump these text files?
I could then e. g. display them on the web-browser via javascript
just to give a use case.
IF this would be possible it would be great if the main README
could have one short example in how to make this work; it
suffices to just dump this on the commandline, don't need
anything fancy. I do understand that this is just a hobby
project though. :)
Esc or something to exit (eg. for infinitely loops).
Pressing ^C works, but the VT stuck and you have to kill it.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.