Double Plasma Spiral

Started by bplus, January 02, 2023, 01:54:23

Previous topic - Next topic

bplus


' Double spiral.bas  SmallBASIC 0.12.8 [B+=MGA] 2017-03-28
'from figosdev post at http://smallbasic.sourceforge.net/?q=node/1684#comment-1955
'translating fig to SmallBASIC for alittle cross pollination...

randomize timer
while 1
  cls
  red = 0 : green = 0 : blue = 0 : nPlasma = 0
  v = 1 : c = 400 : w = 3.14159 / 2
  for r = 490 to 300 step -.25
    e = w - pi / 4 / (490 - 300) : swap e,  w
    for p = -pi to pi step .003067958984375
      e = int((cos(w) * 380) / 2) : rc = int(r /2)
      x = int(cos(p * 2) * e + c) : y = int(sin(p * 2) * e + r - 50)
      m = 2.5 * pi / 108.503 / 2
      now = v + m : swap now, v : rc = int(r /4) mod 2
      if rc then
        now = int(v) mod 2
        if now then plasma else color 0
        pset x, y : y2 = y - 1 : pset x, y2
      end if
    next
    showpage
  next
  delay 1000
wend

sub plasma
  'not local calledMe, red, green, blue, nPlasma
  calledMe += 1
  if red = 0 then red = rnd ^ 2
  if green = 0 then green = rnd ^ 2
  if calledMe mod 3 then
    if calledMe mod 2 then blue = 1 - red else blue = 1 - green
  else
    blue = rnd ^ 2
  end if
  nPlasma += .001
  plasum = rgb(127+127*sin(red*nPlasma),127+127*sin(green*nPlasma),127+127*sin(blue*nPlasma))
  color plasum
end


1 person likes this

kay63

Very Nice Sphere!!
It ran immediately.
With my own posts I have some problems with leading spaces ...