Colorful animation using VT100 - Pure batch WIN 10 only
Posted: 22 Aug 2017 08:18
Hello Everyone!
Recently I've been playing with VT100 escape sequences, and learning how to utilize them. This is the begining of what I've come up with.
I recycled my Rose petal algorithm, and implemented VT100 macros to move the cursor X;Y and to color the characters
I really hope you all enjoy the pretty colors !
Recently I've been playing with VT100 escape sequences, and learning how to utilize them. This is the begining of what I've come up with.
I recycled my Rose petal algorithm, and implemented VT100 macros to move the cursor X;Y and to color the characters
Code: Select all
@echo off
set "moveCursor=<nul set /p "=[x;yH""
REM The important bit [x;yH
REM Contains ESC character[x;yH to position your cursor
%moveCursor:x;y=12;15%
echo [38;5;195mHello World[0m
Code: Select all
@echo off & setlocal enableDelayedExpansion
for /F %%a in ('echo prompt $E^| cmd') do set "ESC=%%a"
set /a "hei=50", "wid=50", "heiXwid=hei * wid"
set "moveCursor=<nul set /p "=!ESC![x;yH""
mode con: cols=%wid% lines=%hei%
set "_SIN=a-a*a/1920*a/312500+a*a/1920*a/15625*a/15625*a/2560000-a*a/1875*a/15360*a/15625*a/15625*a/16000*a/44800000"
set "SIN(x)=(a=(x * 31416 / 180)%%62832, c=(a>>31|1)*a, a-=(((c-47125)>>31)+1)*((a>>31|1)*62832) + (-((c-47125)>>31))*( (((c-15709)>>31)+1)*(-(a>>31|1)*31416+2*a) ), %_SIN%) / 10000"
set "COS(x)=(a=(15708 - x * 31416 / 180)%%62832, c=(a>>31|1)*a, a-=(((c-47125)>>31)+1)*((a>>31|1)*62832) + (-((c-47125)>>31))*( (((c-15709)>>31)+1)*(-(a>>31|1)*31416+2*a) ), %_SIN%) / 10000"
for /l %%e in () do (
set /a "angle+=1", "x=20 * !cos(x):x=5 * angle! * !sin(x):x=angle! + wid / 2", "y=20 * !cos(x):x=5 * angle! * !cos(x):x=angle! + hei / 2"
%moveCursor:x;y=!x!;!y!%
set /a "hue=angle / 15 %% 256"
<nul set /p "=!ESC![38;5;!hue!m*!ESC![0m"
)
I really hope you all enjoy the pretty colors !