Fireworks animation pure batch & colored - ɩᴄᴀʀᴜȿ ᴌוᴠᴇѕ™ - Apr 18, 2018
![[Image: 371785a67de80b630e72c8e6f400f805.gif]](https://gyazo.com/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%[s[3C[38;2;255;0;0mÛÛÛÛÛ[1B[6D[38;2;255;0;0mÛÛÛÛÛÛÛÛÛ[1B[9D[38;2;139;69;19mÛÛÛ[38;2;255;222;173mÛÛ[38;2;0;0;0mÛ[38;2;255;222;173mÛ[1B[8D[38;2;139;69;19mÛ[38;2;255;222;173mÛ[38;2;139;69;19mÛ[38;2;255;222;173mÛÛÛ[38;2;0;0;0mÛ[38;2;255;222;173mÛÛ[1B[9D[38;2;139;69;19mÛ[38;2;255;222;173mÛ[38;2;139;69;19mÛÛ[38;2;255;222;173mÛÛÛ[38;2;0;0;0mÛ[38;2;255;222;173mÛÛÛ[0m[1B[11D[38;2;139;69;19mÛÛ[38;2;255;222;173mÛÛÛÛ[38;2;0;0;0mÛÛÛÛ[1B[8D[38;2;255;222;173mÛÛÛÛÛÛÛ[1B[8D[38;2;255;0;0mÛÛ[38;2;0;0;255mÛ[38;2;255;0;0mÛÛÛ[1B[7D[38;2;255;0;0mÛÛÛ[38;2;0;0;255mÛ[38;2;255;0;0mÛÛ[38;2;0;0;255mÛ[38;2;255;0;0mÛÛÛ[1B[11D[38;2;255;0;0mÛÛÛÛ[38;2;0;0;255mÛÛÛÛ[38;2;255;0;0mÛÛÛÛ[0m[1B[12D[38;2;255;222;173mÛÛ[38;2;255;0;0mÛ[38;2;0;0;255mÛ[38;2;255;140;64mÛ[38;2;0;0;255mÛÛ[38;2;255;140;64mÛ[38;2;0;0;255mÛ[38;2;255;0;0mÛ[38;2;255;222;173mÛÛ[0m[1B[12D[38;2;255;222;173mÛÛÛ[38;2;0;0;255mÛÛÛÛÛÛ[38;2;255;222;173mÛÛÛ[0m[1B[12D[38;2;255;222;173mÛÛ[38;2;0;0;255mÛÛÛÛÛÛÛÛ[38;2;255;222;173mÛÛ[0m[1B[10D[38;2;0;0;255mÛÛÛ[2C[38;2;0;0;255mÛÛÛ[1B[9D[38;2;139;69;19mÛÛÛ[4C[38;2;139;69;19mÛÛÛ[1B[11D[38;2;139;69;19mÛÛÛÛ[4C[38;2;139;69;19mÛÛÛÛ[0m[1B[12D[0m[8[u"
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
RE: Fireworks animation pure batch & colored - WatermelonHazee - Apr 18, 2018
I'm no coder, and i don't know what any of that means but shit is cool 🤝 nice work OP.
RE: Fireworks animation pure batch & colored - ɩᴄᴀʀᴜȿ ᴌוᴠᴇѕ™ - Apr 18, 2018
(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
RE: Fireworks animation pure batch & colored - Phlox - Apr 19, 2018
Oh come on mate this is too much wow again fantastic work by you!
RE: Fireworks animation pure batch & colored - Sir-Teabag - Apr 19, 2018
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?
RE: Fireworks animation pure batch & colored - ɩᴄᴀʀᴜȿ ᴌוᴠᴇѕ™ - Apr 19, 2018
(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.
RE: Fireworks animation pure batch & colored - Sir-Teabag - Apr 20, 2018
(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
RE: Fireworks animation pure batch & colored - SIM-3391627 - Apr 21, 2018
This is amazing! It is a nice animation tbh.
RE: Fireworks animation pure batch & colored - ɩᴄᴀʀᴜȿ ᴌוᴠᴇѕ™ - Apr 22, 2018
(Apr 21, 2018 10:52 PM)Tony is 187 Wrote: This is amazing! It is a nice animation tbh.
Thank you very much! Let me know if you get any ideas!
RE: Fireworks animation pure batch & colored - gogglebot - Apr 22, 2018
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
|