peter
14-10-2012, 17:42
Hi,
Is this a nice larva?
Uses "ui"
DWord hdc,hwin
hwin=Canvas_Window("Mandel Larva",1,1,640,480)
Canvas_Attach(hwin,0,%TRUE)
Canvas_Font("verdana",18,%CANVAS_FONTSTYLE_BOLD)
Single przelx,przely,a2,b2,a,b,z,x2,y2
Long ix,iy,c,x,y
Canvas_Clear(0)
For ix=1 To 255
For iy=1 To 255
Canvas_SetPixel(ix+60,iy+18,Rgb(ix,iy,128))
Canvas_SetPixel(ix+60+255,iy+18,Rgb(iy,ix,128))
Next
Next
Canvas_Color(Rgb(255,255,255),0)
Canvas_SetPos(148,300)
Canvas_Print(" MANDELBROT LARVA ")
Canvas_SetPos(148,330)
Canvas_Print("Press SPACE BAR to start")
Canvas_Redraw
Canvas_WaitKey(32)
Canvas_Clear(0)
Canvas_Redraw
Canvas_SetPos(300,400)
Canvas_Color(10546565,0)
Canvas_Print("WAIT A BIT....")
Canvas_Redraw
przelx=3 / 640
przely=2 / 480
For x=1 To 639
For y=1 To 479
a=0
b=0
c=0
x2=przelx*x-2
y2=przely*y-1
While c <50
a2= a*a-b*b
b2= 2*a*b
a = a2+x2
b = b2+y2
z = a*a+b*b
If z >=4 Then Exit While
c +=1
Wend
If c=50 Then
Canvas_Color(Rgb(0,0,0))
Canvas_SetPixel(x,y)
ElseIf c <17 Then
Canvas_Color(Rgb(245-((17-c)*3),0,0))
Canvas_SetPixel(x,y)
ElseIf c <33 Then
Canvas_Color(Rgb(245,((c-16)*16)-16,0))
Canvas_SetPixel(x,y)
Else
Canvas_Color(Rgb(641-(c*12),245,((c-32)*15)))
Canvas_SetPixel(x,y)
EndIf
Next
Next
Canvas_Redraw
While IsWindow(hwin)
If GetAsyncKeyState(27) Then Exit While
Sleep 10
Wend
Is this a nice larva?
Uses "ui"
DWord hdc,hwin
hwin=Canvas_Window("Mandel Larva",1,1,640,480)
Canvas_Attach(hwin,0,%TRUE)
Canvas_Font("verdana",18,%CANVAS_FONTSTYLE_BOLD)
Single przelx,przely,a2,b2,a,b,z,x2,y2
Long ix,iy,c,x,y
Canvas_Clear(0)
For ix=1 To 255
For iy=1 To 255
Canvas_SetPixel(ix+60,iy+18,Rgb(ix,iy,128))
Canvas_SetPixel(ix+60+255,iy+18,Rgb(iy,ix,128))
Next
Next
Canvas_Color(Rgb(255,255,255),0)
Canvas_SetPos(148,300)
Canvas_Print(" MANDELBROT LARVA ")
Canvas_SetPos(148,330)
Canvas_Print("Press SPACE BAR to start")
Canvas_Redraw
Canvas_WaitKey(32)
Canvas_Clear(0)
Canvas_Redraw
Canvas_SetPos(300,400)
Canvas_Color(10546565,0)
Canvas_Print("WAIT A BIT....")
Canvas_Redraw
przelx=3 / 640
przely=2 / 480
For x=1 To 639
For y=1 To 479
a=0
b=0
c=0
x2=przelx*x-2
y2=przely*y-1
While c <50
a2= a*a-b*b
b2= 2*a*b
a = a2+x2
b = b2+y2
z = a*a+b*b
If z >=4 Then Exit While
c +=1
Wend
If c=50 Then
Canvas_Color(Rgb(0,0,0))
Canvas_SetPixel(x,y)
ElseIf c <17 Then
Canvas_Color(Rgb(245-((17-c)*3),0,0))
Canvas_SetPixel(x,y)
ElseIf c <33 Then
Canvas_Color(Rgb(245,((c-16)*16)-16,0))
Canvas_SetPixel(x,y)
Else
Canvas_Color(Rgb(641-(c*12),245,((c-32)*15)))
Canvas_SetPixel(x,y)
EndIf
Next
Next
Canvas_Redraw
While IsWindow(hwin)
If GetAsyncKeyState(27) Then Exit While
Sleep 10
Wend