Spirale von ??? |
Hi, bin zufällig draufgekommen, wie man eine Spirle zeichnen kann :D [code:1:2979da41f7]Graphics 800,600,16,1 SetBuffer BackBuffer() Repeat Cls For i=0 To 10000 WritePixel i*Sin(i+j)*0.05+400, i*Cos(i+j)*0.05+300, i*$100 Next j=(j+10) Mod 360 Flip 0 Until KeyDown(1) End[/code:1:2979da41f7] Viel Spass beim schwindligwerden :D |
von ??? |
Genial ;) Man muss nur die Amplitude immer größer/kleiner werden lassen. |
von walski |
Hier ist ma meiner Version [code:1:d05453156a] ; Just a tiny 2D coil demo ; (c) 2003 by walski Const Key_ESC = 1 Const coil_factor# = 0.005, dgr_factor# = .1 Const speed# = -5,Length# = 300 Const Screen_Width = 800, Screen_Height = 600, Screen_Depth = 32, Screen_Mode = 1 Graphics Screen_Width,Screen_Height,Screen_Depth,Screen_Mode SetBuffer BackBuffer() timer = CreateTimer(50) ColorFactor# = 255.0 / (Length / coil_factor#) While Not KeyHit(Key_ESC) Cls WaitTimer(timer) frames = frames + 1 If LastFPSTime + 1000 < MilliSecs() Then fps = frames frames = 0 LastFPSTime = MilliSecs() If fps < 40 Then Color 255,0,0 ElseIf fps<50 Then Color 255,100,0 Else Color 0,255,0 EndIf EndIf Text 1,1,"FPS " + Str(fps) x1 = Screen_Width/2 y1 = Screen_Height/2 x2 = x1 y2 = y1 coil# = 0 dgr# = dgr_o# + speed# dgr_o# = dgr# col# = 255 LockBuffer BackBuffer() While coil# < Length col# = col# - ColorFactor# rgb=255*$1000000 + Int(col#)*$10000 + Int(col#)*$100 + Int(col#) coil# = coil# + coil_factor# dgr# = dgr# + dgr_factor# If y2>=0 And y2<Screen_Height And x2<Screen_Width And x2>=0 Then WritePixelFast x2,y2,rgb EndIf x2 = Cos(dgr)*coil + x1 y2 = Sin(dgr)*coil + y1 Wend UnlockBuffer BackBuffer() Flip() Wend [/code:1:d05453156a] walski |