Advertisement
IcarusLives

Batch Animation NO CURSORPOS

Aug 8th, 2017
436
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 2.65 KB | None | 0 0
  1. @echo off & setlocal enableDelayedExpansion
  2.  
  3. set /a "width=50 - 1", "height=50 - 1"
  4. for /l %%a in (0,1,%width%)  do set "widthBuffer=!widthBuffer! "
  5. for /l %%a in (0,1,%height%) do ( set "_[%%a]=%widthBuffer%" )
  6. mode con: cols=52 lines=52
  7.  
  8. REM Define Math functions
  9.     set /a "PI=(35500000/113+5)/10, PI_div_2=(35500000/113/2+5)/10, PIx2=2*PI, PI32=PI+PI_div_2"
  10.     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"
  11.     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"
  12.     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"
  13.     set "_SIN="
  14.  
  15. for %%a in ("p1x=22" "p2x=20" "p3x=18" "p4x=16" "p5x=14" "p1y=14" "p2y=14" "p3y=14"
  16.             "p4y=14" "p5y=14" "p6x=12" "p6y=14" "p7x=10" "p7y=14") do set %%~a
  17.  
  18.  
  19. REM --- END INITIALIZE STAGE -----------------------------------------
  20.  
  21. REM Infinite loop
  22. for /l %%# in (0 0 0) do ( set /a "angle+=1"
  23.        
  24.     set /a "p1x=20 * !cos(x):x=7 * angle! * !sin(x):x=angle! + width/2"
  25.     set /a "p1y=20 * !cos(x):x=7 * angle! * !cos(x):x=angle! + height/2"
  26.        
  27.     set /a "next_p2x=p1x", "next_p2y=p1y", "next_p3x=p2x", "next_p3y=p2y", "next_p4x=p3x", "next_p4y=p3y", "next_p5x=p4x", "next_p5y=p4y", "next_p6x=p5x", "next_p6y=p5y", "next_p7x=p6x", "next_p7y=p6y"
  28.     set /a "p7x=p6x", "p7y=p6y", "p6x=p5x", "p6y=p5y", "p5x=p4x", "p5y=p4y", "p4x=p3x", "p4y=p3y","p3x=p2x", "p3y=p2y", "p2x=p1x", "p2y=p1y"
  29.        
  30.     REM Draw our circles, and plot the tail
  31.     for /l %%y in (-1,1,1) do for /l %%x in (-1,1,1) do (
  32.         set /a "S=(%%x * %%x) + (%%y * %%y) - (1 * 1)", "_3div2=1 / 2"
  33.         if !S! geq -1 if !S! leq !_3div2! (
  34.             set /a "_y=%%y+p1y", "_x=%%x+p1x", "_x2=%%x+p1x + 1"
  35.             for /f "tokens=1-4" %%1 in ("_y !_y! !_x! !_x2!") do set "_[!%%1!]=!_[%%2]:~0,%%3!*!_[%%2]:~%%4!
  36.         )
  37.     )
  38.     for /l %%y in (-3,1,3) do for /l %%x in (-3,1,3) do (
  39.         set /a "S=(%%x * %%x) + (%%y * %%y) - (3 * 3)"
  40.         if !S! leq 1 (
  41.             set /a "_y=%%y+24", "_x=%%x+24", "_x2=%%x+25"
  42.             for /f "tokens=1-4" %%1 in ("_y !_y! !_x! !_x2!") do set "_[!%%1!]=!_[%%2]:~0,%%3!o!_[%%2]:~%%4!
  43.         )
  44.     )
  45.    
  46.     for /l %%a in (2,1,7) do (
  47.         set /a "_y=next_p%%ay", "_x=next_p%%ax", "_x2=next_p%%ax + 1"
  48.         for /f "tokens=1-4" %%1 in ("_y !_y! !_x! !_x2!") do set "_[!%%1!]=!_[%%2]:~0,%%3!*!_[%%2]:~%%4!
  49.     )
  50.        
  51.     REM Display the screen
  52.     cls
  53.     for /l %%a in (0,1,%height%) do ( echo= !_[%%a]!)
  54.     for /l %%a in (0,1,%height%) do ( set "_[%%a]=%widthBuffer%" )
  55. )
  56. exit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement