Page 1 of 1
Tree generator
Posted: Wed Sep 13, 2017 8:32 pm
by Mr. Kibernetik
Code: Select all
#.scrclear(0.7,0.8,1)
w,h = #.scrsize()
tree(w/2,h,3*#.pi/2,h/4)
tree(x,y,a,b)=
? b<1, <=
x1 = x+b*#.cos(a)
y1 = y+b*#.sin(a)
p = b*(#.rnd(0.15)+0.85)
? p<.h*0.1
#.drawcolor(#.hsv2rgb(120,#.rnd(0.5)+0.5,#.rnd(0.6)+0.3):3,0.5)
#.drawsize(.h/80)
#.drawline(x,y,x1,y1)
!
#.drawcolor(0.6,0.25,0)
#.drawsize(p/6)
#.drawline(x,y,x1,y1)
#.drawcolor(0.5,0.2,0)
#.drawsize(p/18)
#.drawline(x-p/18,y,x1-p/18,y1)
.
> i, 0..9-#.rnd(7)
s = #.rnd(b*0.85)+b*.15
a1 = a+0.15*(5-#.rnd(11))
x1 = x+s*#.cos(a)
y1 = y+s*#.sin(a)
tree(x1,y1,a1,p-.h*0.01-#.rnd(.h*0.06))
<
.
- tree1.PNG (395.89 KiB) Viewed 2372 times
- tree2.PNG (339.23 KiB) Viewed 2372 times
- tree3.PNG (324 KiB) Viewed 2372 times
Re: Tree generator
Posted: Thu Sep 14, 2017 4:26 am
by rbytes
This is a lot of fun. I created a variable called leaf, which I start at a value of 80. It sets the draw size of the leaves. Smaller values create bigger leaves and larger ones create very tiny ones so that the drawing looks more like a fern or a evergreen.
Great drawing speed from SPL.
Re: Tree generator
Posted: Thu Sep 14, 2017 4:30 am
by Mr. Kibernetik
rbytes wrote: ↑Thu Sep 14, 2017 4:26 am
This is a lot of fun. I created a variable called leaf, which I start at a value of 80. It sets the draw size of the leaves. Smaller values create bigger leaves and larger ones create very tiny ones so that the drawing looks more like a fern or a evergreen.
Great drawing speed from SPL.
Any screenshots are welcome!
Re: Tree generator
Posted: Thu Sep 14, 2017 4:45 am
by rbytes
Leaf size of 400.
Re: Tree generator
Posted: Thu Sep 14, 2017 4:48 am
by Mr. Kibernetik
Maybe for such trees the branches width also should be made thinner...
Re: Tree generator
Posted: Thu Sep 14, 2017 4:51 am
by rbytes
Yes, with a few sliders and switches this could generate endless fun.
Re: Tree generator
Posted: Thu Sep 14, 2017 4:53 am
by Mr. Kibernetik
Yes, sliders and switches will be added as interface objects.