programs/gradient.toby
author Ryan C. Gordon <icculus@icculus.org>
Tue, 18 Mar 2008 02:05:22 +0000
changeset 499 96e88f292dc8
parent 1 d7cb562e4e24
permissions -rw-r--r--
Updated Lua from 5.1.1 to 5.1.3.
function main() returns nothing

	number i = 0
	number stepSizeH = 1 / getTurtleSpaceWidth()
	number stepSizeV = 1 / getTurtleSpaceHeight()
	number r = 0.0
	number g = 1.0
	number b = 0.0

	disableFence()
	hideTurtle()
	turnRight(90)

	for b = 0.0 to 1.0 step stepSizeV
		setTurtleXY(0, i)
		for r = 0.0 to 1.0 step stepSizeH
			setPenColorRGB(r, g, b)
			goForward(1)
		endfor
		g = g - stepSizeV
		i = i + 1
	endfor

endfunction