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.
icculus@1
     1
function main() returns nothing
icculus@1
     2
icculus@1
     3
	number i = 0
icculus@1
     4
	number stepSizeH = 1 / getTurtleSpaceWidth()
icculus@1
     5
	number stepSizeV = 1 / getTurtleSpaceHeight()
icculus@1
     6
	number r = 0.0
icculus@1
     7
	number g = 1.0
icculus@1
     8
	number b = 0.0
icculus@1
     9
icculus@1
    10
	disableFence()
icculus@1
    11
	hideTurtle()
icculus@1
    12
	turnRight(90)
icculus@1
    13
icculus@1
    14
	for b = 0.0 to 1.0 step stepSizeV
icculus@1
    15
		setTurtleXY(0, i)
icculus@1
    16
		for r = 0.0 to 1.0 step stepSizeH
icculus@1
    17
			setPenColorRGB(r, g, b)
icculus@1
    18
			goForward(1)
icculus@1
    19
		endfor
icculus@1
    20
		g = g - stepSizeV
icculus@1
    21
		i = i + 1
icculus@1
    22
	endfor
icculus@1
    23
icculus@1
    24
endfunction
icculus@1
    25
icculus@1
    26
icculus@1
    27
icculus@1
    28
icculus@1
    29
icculus@1
    30
icculus@1
    31
icculus@1
    32
icculus@1
    33
icculus@1
    34