Hack Forums
[Shell] Colorful animation using VT100 - Pure batch WIN 10 only - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [Shell] Colorful animation using VT100 - Pure batch WIN 10 only (/showthread.php?tid=5700693)



Colorful animation using VT100 - Pure batch WIN 10 only - ɩᴄᴀʀᴜȿ ᴌוᴠᴇѕ™ - Aug 22, 2017

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.

[Image: 20436587e24916f05d3b7daf364802b9.gif]

I recycled my Rose petal algorithm, and implemented VT100 macros to move the cursor X;Y and to color the characters

Code
@echo off
set "moveCursor=<nul set /p "=;yH""
REM The important bit    ;yH
REM Contains ESC character[x;yH to position your cursor

%moveCursor:x;y=12;15%
echo Hello World



Code
@echo off & setlocal enableDelayedExpansion

set /a "hei=50", "wid=50", "heiXwid=hei * wid"
set "moveCursor=<nul set /p "=;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"

set "char=*"

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 / 3 %% 250"
    <nul set /p "=[38;5;!hue!m!char!"
)


I really hope you all enjoy the pretty colors :)!


* - SIM-1073426 - Aug 24, 2017

Someone get White Light up in here, we got some 1337 codes yo


* - ɩᴄᴀʀᴜȿ ᴌוᴠᴇѕ™ - Aug 24, 2017

(Aug 24, 2017 09:14 AM)Aces. Wrote:  Someone get White Light up in here, we got some 1337 codes yo

Aces, Whitey's gone lol I'm the only oldbie. Annikk, and qwerty sometimes come to visit.


* - SIM-1073426 - Aug 26, 2017

(Aug 24, 2017 11:21 AM)ɩᴄᴀʀᴜȿ ᴌוᴠᴇѕ™ Wrote:  Aces, Whitey's gone lol I'm the only oldbie. Annikk, and qwerty sometimes come to visit.

Rest in peace 😭