Radial Gradient?

Blitz3D Forums/Blitz3D Programming/Radial Gradient?

This should work for ya :o)
What usually happens now is someone comes along with 2 lines of code that do the same thing ;o)

Graphics 800,600
SetBuffer BackBuffer()

Global start_R = 0
Global start_G = 0
Global start_B = 0

Global end_R = 255
Global end_G = 255
Global end_B = 255

Global steps = 64
Global size# = 512 ; texture size


For loop = 0 To (size/2)

	stage_percent# = 1.0/steps ; get the number between 0 and 1, that step will be set against1
	percent# = loop/(size/2) ; get the percentage of the loop completed (0 to 1 basically)
	
	temp = Int(percent / stage_percent) ; count number of steps done so far.
	
	temp1# = temp ; make the temp variable into a float number
	temp1# = temp1/steps ; round number between 0 and 1 so to work out color information
	
	temp_r# = (end_R - start_R) * temp1
	temp_g# = (end_G - start_G) * temp1
	temp_b# = (end_B - start_B) * temp1
	Color temp_r,temp_g,temp_b

	Oval loop,loop,size-(loop*2),size-(loop*2)
	Flip

Next