I'm now interested in plasma stuff

Miscellaneous Forums/General Discussion/I'm now interested in plasma stuff

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

lil' fix here

Strict

' CS_TBL

Local window:TGadget=CreateWindow("plasma",200,100,400,300)
Local canvas:TGadget=CreateCanvas(0,0,256,192,window)


Local timer:TTimer=CreateTimer(30)

Local f1:Int
Local f2:Int
Local f3:Int

Local x:Int
Local y:Int

Local r:Int
Local g:Int
Local b:Int

Local m1:Float
Local m2:Float

Repeat
	WaitEvent()
	If EventID()=EVENT_WINDOWCLOSE End
	
	If EventID()=EVENT_TIMERTICK
	
		SetGraphics CanvasGraphics(canvas)
			Cls
			f1:+2
			f2:+3
			f3:+4
			
			For y=0 To 191 Step 4
				For x=0 To 255 Step 4
				
					m1=Cos(f1+y)*128
					m2=Cos(f2+x)*128
			
					r=Sin(f1-x+y*2+m1)*127+128
					g=Sin(f2+y*2-m1+x*3+m2)*127+128
					b=Sin(f3+x+y-m1*3)*127+128
					
					r:+Sin(f2+x+y*2+m2)*127+128
					g:+Sin(f3-y*2-x*3-m1)*127+128
					b:+Sin(f1+x-y*2)*127+128
					
					r=Limit(r/2,0,255)
					g=Limit(g/2,0,255)
					b=Limit(b/2,0,255)
					
					
					SetColor r,g,b
					DrawRect x,y,4,4
				
				Next
			
			Next
		
		Flip
		
	EndIf
	
Forever

Function Limit:Int(v:Int,lo:Int,hi:Int)
	If v<lo Return lo
	If v>hi Return hi
	Return v
End Function


The bottomline is: just fool around a bit with sines and such..