RetroBASIC

Basicprogramming(.org) => Code and examples => Topic started by: B+ on January 18, 2017, 08:59:38 PM

Title: Full Circle
Post by: B+ on January 18, 2017, 08:59:38 PM
Code: [Select]
'full circle.bas SmallBASIC 0.12.8 [B+= MGA] 2017-01-18

xc=xmax/2:yc=ymax/2
while 1
  cls
  r += pi/180
  w += pi/6
  ww += pi/12
  w3 += pi/24
  w4 += pi/48
  for i=1 to 12
    x=xc+200*cos(w+i*pi/6)*sin(r)
    y=yc+200*sin(w+i*pi/6)*sin(r)
    circle x,y,40,1,15
    for j=1 to 12
      xx=x+50*cos(ww + j*pi/6)*sin(r)
      yy=y+50*sin(ww + j*pi/6)*sin(r)
      circle xx,yy,20,1,14   
      for k=1 to 12
        x3=xx+100*cos(w3 + k*pi/6)*sin(r)
        y3=yy+100*sin(w3 + k*pi/6)*sin(r)
        circle x3,y3,5,1,9
      next
    next
  next
  showpage
  delay 30
wend
Title: Re: Full Circle
Post by: B+ on January 19, 2017, 06:02:51 PM
I see I posted code after my unsuccessful attempt to make a recursive function of the whole thing (for way less lines).

Every circle was supposed to be turning around some circle with the expansions and contractions, especially the main 12, here is the fix:

Code: [Select]
'full circle fix.bas SmallBASIC 0.12.8 [B+= MGA] 2017-01-19
'everything was supposed to be turning around another circle

xc=xmax/2:yc=ymax/2
while 1
  cls
  r += pi/180
  w += pi/72
  for i=1 to 12
    x=xc+200*cos(w+i*pi/6)*sin(r)
    y=yc+200*sin(w+i*pi/6)*sin(r)
    circle x,y,40,1,15
    ww += pi/80
    for j=1 to 12
      xx=x+100*cos(ww + j*pi/6)*sin(r)
      yy=y+100*sin(ww + j*pi/6)*sin(r)
      circle xx,yy,20,1,14
      w3 += pi/88
      for k=1 to 12
        x3=xx+50*cos(w3 + k*pi/6)*sin(r)
        y3=yy+50*sin(w3 + k*pi/6)*sin(r)
        circle x3,y3,10,1,9
      next
    next
  next
  showpage
  delay 30
wend

Of course screen shots don't do justice but:
Title: Re: Full Circle
Post by: Rick3137 on January 23, 2017, 12:28:02 AM
  Nice work.

  I like computer art.
Title: Re: Full Circle
Post by: B+ on January 23, 2017, 04:12:51 AM
I like it too, specially when it moves.  :)