Amiga Plasma

Paul59

Active Member
CX Code Contributor
Joined
Dec 13, 2018
Location
UK
My old BB code for creating a plasma effect - can't remember what it looks like, probably quite blocky! I've got half a dozen versions and probably as many again written in other languages. Might slap this into CX later see how it looks.

Graphics 640,480,16,1
SetBuffer BackBuffer()
Global r1,r2,ainc
Dim lut(640,480)

For y=0 To 479
For x=0 To 639
If Sin(x+y)>0.1 Then lut(x,y)=1
Next
Next

angle=10
ainc=12
maxcol=64
col_set=1

While Not KeyDown(1)
;Cls
For y=0 To 476 Step 4
For x=0 To 636 Step 4

If lut(x,y) Then

r1 = 20 * Sin( (x)+(angle Shr 3) ) + 40* Sin( (x*2)+(angle Shr 1) ) + 30 * Sin( (x Shr 1) + angle)
r2 = Sin(y+(angle Shr 1)) + 11 * Sin( (y*2)+angle ) + 40 * Sin( y + angle)
col=r1+r2

;don't draw some!
If col >0 And col <maxcol Then
Select col_set
Case 1
Color 0,col,0
Case 2
Color col,0,0
Case 3
Color 0,0,col
End Select
Rect x,y,4,4,1
EndIf
EndIf
Next
Next
Flip

If Rand(50)=1 Then
col_set=Rand(1,3)
EndIf

angle=angle+ainc

Wend
End
 
Top Bottom