neorobin: Cool, so.. is that even faster then or how does it differ?
I suppose you already know this, but for some real scripting speed something like Python is hard for Batch to beat... here is my hires bezier lines in Python (in a bat file), it runs a lot smoother for sure... (even though rendering probably takes the majority of time, so the difference is not as big as it can be)
Code: Select all
0<0# : ^
'''
@echo off
setlocal ENABLEDELAYEDEXPANSION
cmdwiz setfont 0 & cls & mode 180,80
cmdwiz showcursor 0
cmdwiz gettime&set STARTT=!errorlevel!
python %~f0 %*
rem pause
mode 80,50 & cls
rem cmdwiz gettime&set /a FPS=(!errorlevel!-%STARTT%)/1000&set /a FPS=400/!FPS!&echo !FPS!
cmdwiz setfont 6
cmdwiz showcursor 1
endlocal
exit /b 0
'''
from subprocess import Popen
from random import randint, uniform
from math import sin
from subprocess import call
W, H, DIV = 180*4, 80*6, 2
XMID, YMID = W/2/DIV, H/2/DIV
XMUL, YMUL = W/2/DIV, H/2/DIV
SXMID, SYMID = W/2, H/2
DELAY, KEY = 0, 0
LINEGAP, NOFBEZ, SINDIV = 5, 22, 75
CHANGE, CHANGESTEPS = 1, 400
CHANGECOUNT = CHANGESTEPS
PALETTES=["000000,000000,000000,000000,000000,0020ff,0040ff,0060ff,0080ff,20a0ff,20b0ff,50c0ff,80e0ff,b0f0ff,f0ffff,ffffff", "","000000,00ff00,00ff00,00ff00,00ff00,00ff00,00ff00,00ff00,00ff00,00ff00,00ff00,00ff00,00ff00,00ff00,00ff00,00ff00", "000000,000040,000050,000060,000070,000080,0050a0,0050a0,0050a0,0070c0,2090e0,50b0ff,80d0ff,b0f0ff,f0ffff,ffffff"]
DRAWOP, BITOP, PAL = 0, 3, 0
DRAWS=["line", "ipoly", "fellipse", "fbox", "fcircle", "ellipse"]
S=[0, 0, 0, 0, 0, 0, 0, 0]
P=[0, 3, 0, 0, -2, -3, -3, 3]
SB=[35962, 7098, -26481, -5009, 61416, -41598, -32963, 26096]
#P=[3, 2.99, -2, 2, 0, 0, -1, -1]
#SB=[41341.21999999964, 16061.609999999948, -25810.830000000027, -528.31000000008, 61528, -47065.68999999749, -37120, 33081.20999999951]
P=[2, 2, 2, 3.01, 0, -1, -2, 1]
SB=[34053, 9497, -25587.770000000517, -4603.32999999992, 61032, -42626.240000001475, -33496, 28050]
out, process = 0, 0
P=[-3, 1, -2.01, 0.0, 2.01, 2.01, 0.99, 1.0]
SB=[28712.570000000116, 19988.01000000009, -26999.879999996017, 5247.810000000997, 68958.06999999368, -37988.6600000038, -36060.44999999826, 35267.98999999772]
#for x in range(0, 400):
while (out != 27):
outString=""
for i in range(0, 8):
S[i]=SB[i]
COL, COLPLUS = 1, 14/NOFBEZ
for j in range(0, NOFBEZ):
outString=outString + "& " + DRAWS[DRAWOP] + " "+ str(int(COL)) +" 0 A "
if (DRAWOP==1):
outString += str(int(BITOP)) + " "
COL+=COLPLUS
for i in range(0, 4):
if (i == 0) or (i == 2) or ((DRAWOP==1) and (i == 1)):
outString = outString + str(int(XMID+sin(S[i*2]/SINDIV)*XMUL)) + "," + str(int(YMID+sin(S[i*2+1]/SINDIV)*YMUL)) + ","
elif (i == 1) or (i == 3):
outString = outString + str(int(XMID+sin(S[i*2]/SINDIV)*XMUL)) + "," + str(int(YMID+sin(S[i*2+1]/SINDIV)*YMUL)) + " "
for i in range(0, 8):
S[i]+=P[i]*LINEGAP
for i in range(0, 8):
SB[i]+=P[i]
CHANGECOUNT-=1
if (CHANGECOUNT < 0):
P[randint(0,7)]+=(randint(0,1)*2-1)/100
CHANGECOUNT=CHANGESTEPS
if (DIV == 2):
outString += " & block 0 0,0,"+str(int(SXMID))+","+str(int(SYMID))+" "+str(int(SXMID))+",0 -1 1 0"
outString += " & block 0 0,0,"+str(int(SXMID))+","+str(int(SYMID))+" 0,"+str(int(SYMID))+" -1 0 1"
outString += " & block 0 0,0,"+str(int(SXMID))+","+str(int(SYMID))+" "+str(int(SXMID))+","+str(int(SYMID))+" -1 1 1"
if (out == 112): #p
call(["cmdwiz.exe", "getch"])
if (out == 32): #space
for i in range(0, 8):
P[i]=randint(0,6)-3
if (out == 99): #c
PAL+=1
if (PAL>3):
PAL=0
if (out == 111): #o
DRAWOP+=1
BITOP=3
if (DRAWOP>5):
DRAWOP=0
if (out == 68): #D
DELAY+=15
if (out == 100): #d
DELAY-=15
if (DELAY<0):
DELAY=0
if (out == 98): #b
BITOP+=1
if (BITOP>10):
BITOP=1
if (out == 13): #ENTER
DIV+=1
if (DIV > 2):
DIV=1
XMID, YMID, XMUL, YMUL = W/2/DIV, H/2/DIV, W/2/DIV, H/2/DIV
if (out == 97): #a
call(["cmd", "/C", "cls"])
print("P=[" + str(P[0]) + ", " + str(P[1]) + ", " + str(P[2]) + ", " + str(P[3]) + ", " + str(P[4]) + ", " + str(P[5]) + ", " + str(P[6]) + ", " + str(P[7]) + "]")
print("SB=[" + str(SB[0]) + ", " + str(SB[1]) + ", " + str(SB[2]) + ", " + str(SB[3]) + ", " + str(SB[4]) + ", " + str(SB[5]) + ", " + str(SB[6]) + ", " + str(SB[7]) + "]")
call(["cmdwiz.exe", "getch"])
if process != 0:
out = process.wait()
process = Popen(["cmdgfx_gdi.exe", outString, "w"+str(DELAY)+"kfa:0,0,"+str(W)+","+str(H), PALETTES[PAL]])
Edit: oops, I accidentally included a 2ms wait per frame in this code. Try it again, it will run much more smooth