programs/gradient2.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.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
d7cb562e4e24 Initial revision
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     1
function main() returns nothing
d7cb562e4e24 Initial revision
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     2
d7cb562e4e24 Initial revision
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     3
	number i = 0
d7cb562e4e24 Initial revision
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     4
	number stepSizeH = 1 / getTurtleSpaceWidth()
d7cb562e4e24 Initial revision
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     5
	number stepSizeV = 1 / getTurtleSpaceHeight()
d7cb562e4e24 Initial revision
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     6
	number r = 0.0
d7cb562e4e24 Initial revision
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     7
	number b = 0.0
d7cb562e4e24 Initial revision
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     8
d7cb562e4e24 Initial revision
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     9
	disableFence()
d7cb562e4e24 Initial revision
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    10
	hideTurtle()
d7cb562e4e24 Initial revision
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    11
	turnRight(90)
d7cb562e4e24 Initial revision
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    12
d7cb562e4e24 Initial revision
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    13
	for b = 0.0 to 1.0 step stepSizeV
d7cb562e4e24 Initial revision
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    14
		setTurtleXY(0, i)
d7cb562e4e24 Initial revision
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    15
		for r = 0.0 to 1.0 step stepSizeH
d7cb562e4e24 Initial revision
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    16
			setPenColorRGB(r, 0.0, b)
d7cb562e4e24 Initial revision
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    17
			goForward(1)
d7cb562e4e24 Initial revision
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    18
		endfor
d7cb562e4e24 Initial revision
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    19
		i = i + 1
d7cb562e4e24 Initial revision
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    20
	endfor
d7cb562e4e24 Initial revision
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    21
d7cb562e4e24 Initial revision
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    22
endfunction
d7cb562e4e24 Initial revision
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    23
d7cb562e4e24 Initial revision
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    24
d7cb562e4e24 Initial revision
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    25
d7cb562e4e24 Initial revision
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    26
d7cb562e4e24 Initial revision
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    27
d7cb562e4e24 Initial revision
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    28
d7cb562e4e24 Initial revision
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    29
d7cb562e4e24 Initial revision
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    30
d7cb562e4e24 Initial revision
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    31
d7cb562e4e24 Initial revision
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    32