Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Shell 

Fireworks animation pure batch & colored

[Image: 371785a67de80b630e72c8e6f400f805.gif]

Script ONLY runs on windows 10 due to VT100 escape sequences.

I don't expect a lot of attention on this, I just thought it would be fun to code this lol

Not going to explain how it works since no one reads code anyway. If you're really interested just pm me about it..

Enjoy!

Code
@echo off & setlocal enableDelayedExpansion
mode 100,100

call :macros

set "fireworks=3"
for /l %%a in (0,1,%fireworks%) do (
set /a "x%%a=!random! %% 95 + 5", "y%%a=!random! %% 100 + 110"
set /a "thrust%%a=!random! %% 3 + 3"
set /a "tail%%a=!random! %% 8 + 5"
set /a "size%%a=1"
set /a "hue%%a=!random! %% 100 + tail%%a"
set /a "burstLimit%%a=!random! %% 30 + 10"
)

for /l %%# in () do ( set /a "frame+=1"

for /l %%a in (0,1,%fireworks%) do (

if !y%%a! gtr !burstLimit%%a! (
set /a "y%%a-=thrust%%a"
set /a "yl=y%%a + tail%%a"
%line% !x%%a! !y%%a! !x%%a! !yl! : !hue%%a!
) else if /i "!burstID%%a!" neq "true" (
set /a "burstFrame=frame + 4"
set "bursts=!bursts!%%a "
set "burstID%%a=true"
)

for %%b in (!bursts!) do ( set /a "burstAction=frame %% burstFrame"

if !burstAction! gtr 0 (
set /a "size%%b+=1", "hue%%b-=1"
) else (
set /a "x%%b=!random! %% 95 + 5", "y%%b=!random! %% 100 + 110"
set /a "thrust%%b=!random! %% 3 + 3"
set /a "tail%%b=!random! %% 8 + 5"
set /a "size%%b=1"
set /a "hue%%b=!random! %% 100 + tail%%b"
set /a "burstLimit%%b=!random! %% 30 + 10"
set "bursts="
set "burstID%%b=false"
set "burstFrame%%b="
set "burstAction%%b="
)
)

if !y%%a! geq 0 if !y%%a! lss 100 (
%fastCircle% !x%%a! !y%%a! !size%%a! !size%%a! !hue%%a!
)
)
<nul set /p "=!esc![2J!screen!" & <nul set /p "=!screen!" & set "screen="

<nul set /p "=%marioSprite%"
)
pause >nul & exit


:macros
set ^"LF=^

^" Above empty line is required - do not remove
set ^"\n=^^^%LF%%LF%^%LF%%LF%^^"
for /F %%a in ('echo prompt $E^| cmd') do set "ESC=%%a"

:: Hide the cursor
<nul set /p "=!esc![?25l"

set "setCursor(x;y)=%ESC%[x;yf"

set "marioSprite=%setCursor(x;y):x;y=42;44%ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ[8"

rem %plot% x y 0-255 0-255 CHAR
set plot=for %%# in (1 2) do if %%#==2 ( for /f "tokens=1-5" %%1 in ("^!args^!") do (%\n%
set /a "vtx=%%~1", "vty=%%~2"%\n%
set "screen=^!screen^!!esc![^!vty^!;^!vtx^!H!esc![38;5;%%3m!esc![48;5;%%4m%%~5!esc![0m"%\n%
)) else set args=

set fastCircle=for %%# in (1 2) do if %%#==2 ( for /f "tokens=1-7" %%1 in ("^!args^! sin^(x^) cos^(x^)") do (%\n%
for /l %%a in (0,30,360) do (%\n%
set /a "xa=%%~3 * ^!%%~6:x=%%a^! + %%~1"%\n%
set /a "ya=%%~4 * ^!%%~7:x=%%a^! + %%~2"%\n%
for /f "tokens=1,2" %%x in ("^!xa^! ^!ya^!") do ^!plot^! %%x %%y %%~5 0 Û%\n%
)%\n%
)) else set args=

set line=for %%# in (1 2) do if %%#==2 ( for /f "tokens=1-6" %%1 in ("^!args^!") do (%\n%
if "%%~6" equ "" ( set "hue=30" ) else ( set "hue=%%~6")%\n%
set /a "xa=%%~1", "ya=%%~2", "xb=%%~3", "yb=%%~4", "dx=%%~3 - %%~1", "dy=%%~4 - %%~2"%\n%
for /f "tokens=1-2" %%6 in ("^!dx^! ^!dy^!") do (%\n%
if %%~7 lss 0 ( set /a "dy=-%%~7", "stepy=-1" ) else ( set "stepy=1" )%\n%
if %%~6 lss 0 ( set /a "dx=-%%~6", "stepx=-1" ) else ( set "stepx=1" )%\n%
set /a "dx<<=1", "dy<<=1"%\n%
)%\n%
for /f "tokens=1-9" %%a in ("^!dx^! ^!dy^! ^!xa^! ^!xb^! ^!ya^! ^!yb^! ^!stepx^! ^!stepy^! ^!hue^!") do (%\n%
if %%~a gtr %%~b (%\n%
set /a "fraction=%%~b - (%%~a >> 1)"%\n%
for /l %%x in (%%~c,%%~g,%%~d) do (%\n%
for /f "tokens=1" %%6 in ("^!fraction^!") do if %%~6 geq 0 set /a "ya+=%%~h", "fraction-=%%~a"%\n%
set /a "fraction+=%%~b"%\n%
for /f "tokens=1" %%6 in ("^!ya^!") do (%\n%
if 0 leq %%x if %%x lss 199 if 0 leq %%~6 if %%~6 lss 199 ^!plot^! %%x %%~6 %%i 0 %%~5%\n%
)%\n%
)%\n%
) else (%\n%
set /a "fraction=%%~a - (%%~b >> 1)"%\n%
for /l %%y in (%%~e,%%~h,%%~f) do (%\n%
for /f "tokens=1" %%6 in ("^!fraction^!") do if %%~6 geq 0 set /a "xa+=%%~g", "fraction-=%%~b"%\n%
set /a "fraction+=%%~a"%\n%
for /f "tokens=1" %%6 in ("^!xa^!") do (%\n%
if 0 leq %%~6 if %%~6 lss 199 if 0 leq %%y if %%y lss 199 ^!plot^! %%~6 %%y %%i 0 %%~5%\n%
)%\n%
)%\n%
)%\n%
)%\n%
)) else set args=


set /a "PI=(35500000/113+5)/10, PI_div_2=(35500000/113/2+5)/10, PIx2=2*PI, PI32=PI+PI_div_2"
   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 "_SIN="
   set "Sqrt(N)=( x=(N)/(11*1024)+40, x=((N)/x+x)/2, x=((N)/x+x)/2, x=((N)/x+x)/2, x=((N)/x+x)/2, x=((N)/x+x)/2 )"
   set "Sign(n)=(n>>31)|((-n>>31)&1)"
   set "Abs(x)=(((x)>>31|1)*(x))"
REM  Max1(x)=  if (x geq y)  then x    else y
set "Max(x)=( ?=((x-y)>>31)+1, ?*x + ^^^!?*y )"
set "Max=( ?=(((((t1)>>31|1)*(t1))-(((t2)>>31|1)*(t2)))>>31)+1, ?*(2*(((t1)>>31|1)*(t1))-(((t2)>>31|1)*(t2))-((((t1)>>31|1)*(t1))-(((t2)>>31|1)*(t2)))) + ^^^!?*((((t1)>>31|1)*(t1))-(((t2)>>31|1)*(t2))-((((t1)>>31|1)*(t1))-(((t2)>>31|1)*(t2))*2)) )"
set "getDistance(x2,x1,y2,y1)=( @=x2-x1, $=y2-y1, ?=(((@>>31|1)*@-(($>>31|1)*$))>>31)+1, ?*(2*(@>>31|1)*@-($>>31|1)*$-((@>>31|1)*@-($>>31|1)*$)) + ^^^!?*((@>>31|1)*@-($>>31|1)*$-((@>>31|1)*@-($>>31|1)*$*2)) )"
   set "swap(x,y)=t=x, x=y, y=t"
goto :eof
I'm no coder, and i don't know what any of that means but shit is cool 🤝 nice work OP.
[Image: zAlf2Yo.png]
(Apr 18, 2018 09:17 PM)WatermelonHazee Wrote:  I'm no coder, and i don't know what any of that means but shit is cool 🤝 nice work OP.

Thanks a lot, check out some of my other animations if you thought this was neat. Spread the word yo
Oh come on mate this is too much wow again fantastic work by you!
Awesome dude! Keep it up :D


Do you think you could try explain this part to me though?
Code
set /a "thrust%%a=!random! %% 3 + 3"

What does the "%% " do?
(Apr 19, 2018 03:47 AM)Sir-Teabag Wrote:  Awesome dude! Keep it up :D


Do you think you could try explain this part to me though?
Code
set /a "thrust%%a=!random! %% 3 + 3"

What does the "%% " do?

Sure can!

In batch whenever you see maths it is basically like dividing, but we return the remainder instead!
Code
set /a "out=20 %% 6"

This will output 2 because we know 6 / 3 = 18, but if you were to add 2 more, it will give us our 20.
(Apr 19, 2018 07:16 AM)ɩᴄᴀʀᴜȿ ᴌוᴠᴇѕ™ Wrote:  Sure can!

In batch whenever you see maths it is basically like dividing, but we return the remainder instead!
Code
set /a "out=20 %% 6"

This will output 2 because we know 6 / 3 = 18, but if you were to add 2 more, it will give us our 20.

Oh that's something i didn't know, thank you very much :D
This is amazing! It is a nice animation tbh.
(Apr 21, 2018 10:52 PM)SIM-3391627 Wrote:  This is amazing! It is a nice animation tbh.

Thank you very much! Let me know if you get any ideas!
I've been way for increasing lengths of time and every time Icarus brings out even more crazy-fun stuff

Reminds me of those old DOS "New year" viruses that just had fireworks or something every new year so you couldn't work :P
Keep me fed and alive at Uni: Bitcoin Bitcoin: 16cwoYXfhaK6V5c8kJKn9SBMtDUARUs7BS
I'll draw terrible art in paint.NET for you, on request, in return <3


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Shell] by ɩᴄᴀʀᴜȿ ᴌוᴠᴇѕ™Sep 24, 2026 10:02 AM 1 153 Sep 24, 2026 10:02 AM
Last Post: Anonynuk
[Shell] by Robert RougeSep 24, 2026 10:02 AM 4 222 Sep 24, 2026 10:02 AM
Last Post: Anonynuk
[Shell] by ɩᴄᴀʀᴜȿ ᴌוᴠᴇѕ™Sep 24, 2026 09:38 AM 9 174 Sep 24, 2026 09:38 AM
Last Post: Anonynuk