************************************************** *-- Form: form1 (m:\rad\rad\probe\swing.scx) *-- ParentClass: form *-- BaseClass: form *-- Time Stamp: 07/12/06 12:07:12 PM * DEFINE CLASS form1 AS form Top = 0 Left = 0 Height = 9971 Width = 9992 DoCreate = .T. Caption = "Dragan's swingograph emulator" DrawWidth = 1 WindowState = 2 ForeColor = RGB(255,255,255) BackColor = RGB(0,0,0) Name = "Form1" ADD OBJECT command1 AS commandbutton WITH ; Top = 12, ; Left = 888, ; Height = 37, ; Width = 49, ; Caption = "draw", ; Name = "Command1" PROCEDURE qrnd LPARAMETERS a, b RETURN INT(RAND() * (b - a) + a) ENDPROC PROCEDURE swing *!* DECLARE FUNCTION qrnd! (a!, b!) *!* pi = ATN(1) * 4 *!* RANDOMIZE TIMER *!* DO *!* SCREEN 12 ' ovo 12 za VGA, za Herkulesa... neki drugi broj *!* ' p0 je odnos brzina između ljuljanja po x i y osi *!* ' ograničio sam se na jednostavnije razlomke This.Cls * hide the first line This.ForeColor=This.BackColor Local aColors(6) aColors[1]=0x0064FF64 aColors[2]=0x00DDDD00 aColors[3]=0x00FF6666 aColors[4]=0x00FD5BD5 aColors[5]=0x00B32DFB aColors[6]=0x004FC8F0 p0 = This.qrnd(1, 6) / This.qrnd(2, 7) * fazni pomeraj p1 = Rand() * Pi() / 2 pi3=Pi()/3 * a ovo je pokušaj da se dobije dovoljno gust crtež If p0 > 0 Then p5 = 1 / p0 Else p5 = p0 Endif p5 = p5 * (1 - p5) p3 = 1 + .02 * Rand() * p5 p5 = .0014 p4 = Rand() * 2 - 1 p6 = p5 / 2 s1 = Rand() * 2 - 1 s2 = Rand() * 2 - 1 Max = 800 c = 0 bx0=0 by0=0 xCent=This.Width/2 yCent=This.Height /2 This.Visible=.T. For T = Max To Max / 5 Step -.1 ax = Sin(T) + s1 ay = Cos(T * p0 + p1) + s2 cx = ((ax * Sin(T * p5) + ay * Cos(T * p6 + p4))) cy = ((ax * Cos(T * p5) + ay * Sin(T * p6 + p4))) bx = ((cx * Sin(T * p3) + cy * Cos(T * p3 + p4)) * T / Max + 1) * xCent By = ((cx * Cos(T * p3) + cy * Sin(T * p3 + p4)) * T / Max + 1) * yCent This.Line(bx0, by0, bx, By) * c = 15 + (bx0 > bx) + 2 * (by0 > by) *-- this GWBasic color picker becomes this: nColor=Int(T/pi3)%6+1 This.ForeColor=aColors[ncolor] bx0 = bx by0 = By Next T *!* t = TIMER + 60 *!* DO *!* LOOP UNTIL INKEY$ = CHR$(27) OR t <= TIMER *!* SCREEN 0 *!* LOOP ENDPROC PROCEDURE command1.Click thisform.Swing() ENDPROC ENDDEFINE * *-- EndDefine: form1 **************************************************And, BTW, this was written for QBasic, not GWBasic. I've finally read the rest of my comments there :).