Skip to content

Commit 2bb435c

Browse files
Add files via upload
1 parent 4039487 commit 2bb435c

File tree

2 files changed

+80
-1
lines changed

2 files changed

+80
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
@echo off & setlocal enableDelayedExpansion
2+
3+
set /a "wid=100,hei=70"
4+
mode %wid%,%hei%
5+
6+
call :macros
7+
8+
set /a top.x=wid / 2, top.y=20, pyramid.hei=33, pyramid.wid=19
9+
for /l %%i in (0,1,3) do set /a "angle=90 * %%i",^
10+
"cx[%%i]=pyramid.wid * !cos:x=angle!/10000 + top.x",^
11+
"cy[%%i]=(pyramid.wid / 2 - pyramid.wid / 4) * !sin:x=angle!/10000 + top.y + pyramid.hei"
12+
13+
for /f "tokens=1-4 delims=:.," %%a in ("!time: =0!") do set /a "t1=((((10%%a-1000)*60+(10%%b-1000))*60+(10%%c-1000))*100)+(10%%d-1000)"
14+
for /l %%# in (1,1,1000) do (
15+
16+
for /f "tokens=1-4 delims=:.," %%a in ("!time: =0!") do set /a "t2=(((1%%a*60)+1%%b)*60+1%%c)*100+1%%d-36610100, dt=t2-t1"
17+
18+
title %%#
19+
if !dt! gtr 5 (
20+
21+
set /a "t1=t2","frames+=6"
22+
23+
for /l %%i in (0,1,3) do ( set /a "angle=(90 * %%i + frames)",^
24+
"cx[%%i]=pyramid.wid * !cos:x=angle!/10000 + top.x",^
25+
"cy[%%i]=(pyramid.wid / 2 - pyramid.wid / 4) * !sin:x=angle!/10000 + top.y + pyramid.hei",^
26+
"next=(%%i + 1) %% 4"
27+
28+
%@aaline% !top.x! !top.y! !cx[%%i]! !cy[%%i]!
29+
set "scrn=!scrn!%\e%[!cy[%%i]!;!cx[%%i]!H!$aaline!"
30+
31+
for %%n in (!next!) do %@aaline% !cx[%%i]! !cy[%%i]! !cx[%%n]! !cy[%%n]!
32+
set "scrn=!scrn!%\e%[!cy[%%i]!;!cx[%%i]!H!$aaline!"
33+
)
34+
35+
echo=%\e%[2J%\e%[H!scrn!
36+
set "scrn="
37+
)
38+
)
39+
rem ------------------------------------------------------------------------------------------------------------------------------------
40+
:macros
41+
(set \n=^^^
42+
%= This creates an escaped Line Feed - DO NOT ALTER \n =%
43+
)
44+
for /f %%a in ('echo prompt $E^| cmd') do set "\e=%%a"
45+
46+
set "sin=(a=((x*31416/180)%%62832)+(((x*31416/180)%%62832)>>31&62832), b=(a-15708^a-47124)>>31,a=(-a&b)+(a&~b)+(31416&b)+(-62832&(47123-a>>31)),a-a*a/1875*a/320000+a*a/1875*a/15625*a/16000*a/2560000-a*a/1875*a/15360*a/15625*a/15625*a/16000*a/44800000)"
47+
set "cos=(a=((15708-x*31416/180)%%62832)+(((15708-x*31416/180)%%62832)>>31&62832), b=(a-15708^a-47124)>>31,a=(-a&b)+(a&~b)+(31416&b)+(-62832&(47123-a>>31)),a-a*a/1875*a/320000+a*a/1875*a/15625*a/16000*a/2560000-a*a/1875*a/15360*a/15625*a/15625*a/16000*a/44800000)"
48+
49+
rem %@AAline% x0 x1 y0 y1 <rtn> !$AAline!
50+
set @AAline=for %%# in (1 2) do if %%#==2 ( for /f "tokens=1-4" %%1 in ("^!args^!") do (%\n%
51+
set "$AAline="%\n%
52+
set /a "$dx=(((%%~3-%%~1)>>31|1)*(%%~3-%%~1))","$dy=(((%%~4-%%~2)>>31|1)*(%%~4-%%~2))", "$x0=%%~1,$y0=%%~2,$x1=%%~3,$y1=%%~4", "$err=$dx-$dy", "dxdy=$dx+$dy","dist=$dx"%\n%
53+
if ^^!$dx^^! lss ^^!$dy^^! ( set /a "dist=$dy" )%\n%
54+
if %%~1 lss %%~3 ( set $sx=1 ) else ( set $sx=-1 )%\n%
55+
if %%~2 lss %%~4 ( set $sy=1 ) else ( set $sy=-1 )%\n%
56+
if ^^!dxdy^^! equ 0 ( set $ed=1 ) else ( set /a "$ed=dist" )%\n%
57+
for /l %%i in (1,1,^^!dist^^!) do (%\n%
58+
set /a "$shade=255 - (255 * ((($err-$dx+$dy)>>31|1)*($err-$dx+$dy)) / $ed)", "e2=$err, x2=$x0", "$2e2=2 * e2", "color=232 + (255 - 232) * $shade / 255"%\n%
59+
set "$AAline=^!$AAline^!%\e%[48;5;^!color^!m%\e%[^!$y0^!;^!$x0^!H "%\n%
60+
if ^^!$2e2^^! geq -^^!$dx^^! (%\n%
61+
set /a "e2dy=e2 + $dy"%\n%
62+
if ^^!e2dy^^! lss ^^!$ed^^! if ^^!$x0^^! neq ^^!$x1^^! (%\n%
63+
set /a "$shade=255 - (255 * (((e2+$dy)>>31|1)*(e2+$dy)) / $ed)", "$y0sy=$y0 + $sy", "color=232 + (255 - 232) * $shade / 255"%\n%
64+
set "$AAline=^!$AAline^!%\e%[48;5;^!color^!m%\e%[^!$y0sy^!;^!$x0^!H "%\n%
65+
)%\n%
66+
set /a "$err-=$dy, $x0+=$sx"%\n%
67+
)%\n%
68+
if ^^!$2e2^^! leq ^^!$dy^^! if ^^!$y0^^! neq ^^!$y1^^! (%\n%
69+
set /a "dxe2=$dx - e2"%\n%
70+
if ^^!dxe2^^! lss ^^!$ed^^! (%\n%
71+
set /a "$shade=255 - (255 * ((($dx-e2)>>31|1)*($dx-e2)) / $ed)", "x2sx=x2 + $sx", "color=232 + (255 - 232) * $shade / 255"%\n%
72+
set "$AAline=^!$AAline^!%\e%[48;5;^!color^!m%\e%[^!$y0^!;^!x2sx^!H "%\n%
73+
)%\n%
74+
set /a "$err+=$dx, $y0+=$sy"%\n%
75+
)%\n%
76+
)%\n%
77+
set "$AAline=^!$AAline^!%\e%[0m"%\n%
78+
)) else set args=
79+
goto :eof

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1+
![](https://i.imgur.com/JLg5Ozi.gif)

0 commit comments

Comments
 (0)