' ScriptBasic GFX - Fern
IMPORT gfx.sbi
s = gfx::Window(640,500,"ScriptBasic GFX Fern")
RANDOMIZE(gfx::Time())
SPLITA STRING(3,"0") BY "" TO xy
SUB Fern
r = RND() % 100
IF r <= 10 THEN
SPLIT "0,0,0,0.16,0,0" BY "," TO a,b,c,d,e,f
ELSE IF r > 1 AND r <=86 THEN
SPLIT "0.85,0.04,-.04,0.85,0,1.60" BY "," TO a,b,c,d,e,f
ELSE IF r > 86 AND r <=93 THEN
SPLIT "0.2,-.26,0.23,0.22,0,0.16" BY "," TO a,b,c,d,e,f
ELSE
SPLIT "-.15,0.28,0.26,0.24,0,0.44" BY "," TO a,b,c,d,e,f
END IF
newx = ((a * xy[1]) + (b * xy[2]) + e)
newy = ((c * xy[1]) + (d * xy[2]) + f)
xy[1] = newx
xy[2] = newy
gfx::pixelRGBA s, INT(xy[1]*40+300), INT(-xy[2]*40+450), 0, 210, 55, 255
END SUB
ts = gfx::Time()
FOR w=1 TO 250000
Fern
NEXT
te = gfx::Time()
gfx::stringColor s, 20, 15, "Time: " & FORMAT("%.4f",(te-ts)/1000) & " Seconds." & CHR(0), 0xffffffff
gfx::Update
WHILE gfx::KeyName(1) <> "+escape"
WEND
gfx::Close