Strangeness!!!!

Blitz3D Forums/Blitz3D Programming/Strangeness!!!!

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.

Oops, I think I left my brain somewhere other than my head yesterday :S. Here's how to do it in a way that works correctly:

Graphics3D 800,600,32,2 
SeedRnd MilliSecs 

camera = CreateCamera() 
light = CreateLight() 

old_r = Rnd(0, 255) 
old_g = Rnd(0, 255) 
old_b = Rnd(0, 255) 
r = Rnd(50, 255) 
g = Rnd(50, 255) 
b = Rnd(50, 255) 

CameraClsColor camera, old_r, old_g, old_b 

While Not KeyDown( 28 ) 

If r < old_r 
	r = r + 1 
ElseIf r > old_r 
	r = r - 1 
Else
	rDone = True
EndIf 

If g < old_g 
	g = g + 1 
ElseIf g > old_g 
	g = g - 1 
Else
	gDone = True
EndIf 

If b < old_b 
	b = b + 1 
ElseIf b > old_b 
	b = b - 1 
Else
	bDone = True
EndIf 

If rDone = True And gDone = True And bDone = True
	rDone = False
	gDone = False
	bDone = False
	old_r=Rnd(50, 255) 
	old_g=Rnd(50, 255) 
	old_b=Rnd(50, 255) 
EndIf 

CameraClsColor camera, r, g, b 

UpdateWorld 
RenderWorld 

Text 1,1,"old_r:" + old_r + " r:" + r + " old_g:" + old_g + " g:" + g + " old_b:" + old_b + " b:" + b 

Flip 
Wend
Of course, the best way would be to only check the Red colour and then just set the Green and Blue colours based on the Red colour using an Interpolate() function. That way all 3 values will reach the target colour at the same time.