07-17-2018, 03:42 AM

Code:

`'wavy test fcirc.txt for Naalaa 6`

' try a translation of a translation

' Wavy with Plasma.bas for QB64 fork (B+=MGA) 2017-05-05

' Wavy with Plasma Treatment.bas SmallBASIC 0.12.9 (B+=MGA) 2017-05-03

' from: animated circles started by Admin at SdlBasic 2017-05-03

' I added Plasma treatment and spacebar changer

'===================================================================

' Instructions: press spacebar for new injection of plasma

'==================================================================

constant:

xmax 800

ymax 600

DPI# 6.283032

PHIDELTA# 0.4188688

PHISTEP# 0.1256606

largeRADIUS# 20.0

SMALL_R# 20.0

DISTANCE# 23.0

W# 800.0

H# 600.0

visible:

cN# = 1.0

pR#

pG#

pB#

hidden:

set window 200, 40, xmax, ymax

set redraw 0

radians

current_phi# = 0.0

_resetPlasma

while 1

if inkey(1) = 32

cN# = 1.0

_resetPlasma

endif

current_phi# = current_phi# + PHISTEP#

x# = 0.0

while x# <= (W# + largeRADIUS#)

y# = 0.0

while y# <= (W# + largeRADIUS#)

phiIndex# = float#(int(x# + y#) % int(2.0 * W#)) / largeRADIUS#

phi# = phiIndex# * PHIDELTA# + current_phi#

xball# = cos(phi#) * largeRADIUS# + x#

yball# = sin(phi#) * largeRADIUS# + y#

_changePlasma

_DrawFilledCircle int(xball#), int(yball#), int(SMALL_R#)

y# = y# + DISTANCE#

wend

x# = x# + DISTANCE#

wend

redraw

wait 100

wend

function rrnd#(x)

return float#(rnd(10000))/10000.0

endfunc

procedure changePlasma()

cN# = cN# + 1.0

set color int(127.0 + 127.0 * sin(pR# * cN#)), int(127.0 + 127.0 * sin(pG# * cN#)), int(127.0 + 127.0 * sin(pB# * cN#))

endproc

procedure resetPlasma()

pR# = rrnd#(1)

pG# = rrnd#(1)

pB# = rrnd#(1)

endproc

'very fast but not round specially smaller circles

procedure DrawFilledCircle(x0, y0, radius)

x = radius

y = 0

err = 0

while x >= y

x2 = x*2; y2 = y*2

draw rect x0 - x, y0 + y, x2, 1, true

draw rect x0 - y, y0 + x, y2, 1, true

draw rect x0 - x, y0 - y, x2, 1, true

draw rect x0 - y, y0 - x, y2, 1, true

y = y + 1

err = err + 1 + 2*y

if 2*(err - x) + 1 > 0

x = x - 1

err = err + 1 - 2*x

endif

wend

endproc

b = b + geberation