News:

PlayBASIC2DLL V0.99 Revision I Commercial Edition released! - Convert PlayBASIC programs to super fast Machine Code. 

Main Menu

endless zoom demo!

Started by Vee, July 16, 2010, 08:05:29 PM

Previous topic - Next topic

Vee

I played around a bit with fractals and this came out:

PlayBASIC Code: [Select]
; PROJECT : EndlosFraktal
; AUTHOR : Knieb
; CREATED : 17.07.2010
; EDITED : 17.07.2010
; ---------------------------------------------------------------------
OpenScreen 1280, 1024, 32, 1

oldTime = Timer()
Do
Cls RGB(34, 6, 6)
dT# = (Timer()-oldTime)*0.001
oldTime = Timer()
prog# = prog#+0.75*dT#
If prog# > 1.0
prog# = prog#-1.0
EndIf
angle# = 300+prog#*30 : length# = 751.716+prog#*666.6
xOffset# = -Cos(angle#)*length#*Sin(prog#*90)
yOffset# = -Sin(angle#)*length#*Sin(prog#*90)
colourMulti# = 19+prog#*2.8
branch(640-375.858+xOffset#, 1675+yOffset#, angle#, length#, colourMulti#, 9)
Sync
Loop

Function branch(x, y, angle#, length, colourMulti#, passes)
x2 = x+Cos(angle#)*length : y2 = y+Sin(angle#)*length
Ink RGB(255-passes*colourmulti#, 200-passes*colourmulti#*0.5, 200-passes*colourmulti#)
If PointInBox(x2, y2, -length*0.45, -length*0.45, 1280+length*0.45, 1024+length*0.45)
Circle x2, y2, length*0.45, 1
EndIf
If passes > 1
branch(x2, y2, angle#+20, length*0.53, colourMulti#, passes-1)
branch(x2, y2, angle#-30, length*0.53, colourMulti#, passes-1)
EndIf
EndFunction



Fractals rule :)
Maybe I'll add that it zooms into a random branch one day, but that's quite compli...

kevin


nice, but isn't this more a code snippet ?

Vee

thanks, do you mean the resources-source codes-subforum?

kevin