Author Topic: Tree Swirl  (Read 2398 times)

B+

  • Guest
Tree Swirl
« on: May 28, 2017, 03:26:11 AM »
hmm... trees instead of stars?

Code: [Select]
' tree swirl.bas SmallBASIC 0.12.9 (B+=MGA) 2017-05-27
' mod with trees
' Psychedelic Star Swirl.bas  SmallBASIC 0.12.8 [B+=MGA] 2017-03-03

cx = xmax / 2 : cy = ymax / 2 : StartAngle = 0
clr = 1 : r = rnd : g = rnd : b = rnd

while 1
  cls
  Bang
  showpage
  delay 1
  StartAngle = StartAngle - pi/72
wend
 
sub Bang()
  angle = StartAngle
  size = 3 : radius = .1 : ds = .1
  while radius < 400
    x = cos(angle) * radius
    y = sin(angle) * radius
    chColor
    branch cx + x, cy + y, deg(atan2((y-cy),(x-cx))-90), size, 1
    angle = angle + 41.0
    radius = radius + 2.0
    size = size + ds
    ds = ds + 0.0001
  wend
end

sub chColor()
  clr = clr + 1
  color rgb(30+20*sin(r*clr), 167+80*sin(g*clr), 30+20*sin(r*clr))
  if clr > 10000 then r = rnd : g = rnd : b = rnd : clr = 0
end

sub branch(x, y, angD, length, lev)
  local x2, y2, dx, dy, bc, i
  x2 = x + cos(rad(angD)) * length
  y2 = y - sin(rad(angD)) * length
  line x, y, x2, y2
  if lev>6 or length<1 then exit sub
  lev+=1
  branch x2,y2,angD+10+30*rnd,.8*length+.2*rnd*length,lev
  branch x2,y2,angD-10-30*rnd,.8*length+.2*rnd*length,lev
end

:)


jj2007

  • Guest
Re: Tree Swirl
« Reply #1 on: May 28, 2017, 04:02:09 PM »
Beautiful!

B+

  • Guest
Re: Tree Swirl
« Reply #2 on: May 28, 2017, 04:36:43 PM »

Galileo

  • Guest
Re: Tree Swirl
« Reply #3 on: May 31, 2017, 05:21:02 PM »
Very good.