45 lines
1.7 KiB
Text
45 lines
1.7 KiB
Text
To run:
|
|
Start up.
|
|
Clear the screen.
|
|
Imagine a box with the screen's left and the screen's top and the screen's right and the screen's bottom divided by 4.
|
|
Make a gradient with the box and 8 and "left-to-right".
|
|
Draw the gradient.
|
|
Draw the next gradient given the gradient.
|
|
Draw the next gradient given the gradient.
|
|
Draw the next gradient given the gradient.
|
|
Refresh the screen.
|
|
Wait for the escape key.
|
|
Shut down.
|
|
|
|
A gradient is a record with
|
|
A box,
|
|
A partitions number,
|
|
And a direction string. \"left-to-right" or "right-to-left"
|
|
|
|
To make a gradient with a box and a number and a string:
|
|
Put the box into the gradient's box.
|
|
Put the number into the gradient's partitions.
|
|
Put the string into the gradient's direction.
|
|
|
|
To draw a gradient:
|
|
Put the white color into a color.
|
|
Put 1000 [the maximum lightness] divided by the gradient's partitions into an amount.
|
|
If the gradient's direction is "left-to-right", put the black color into the color.
|
|
Put the gradient's box into a box.
|
|
Put the gradient's box's width divided by the gradient's partitions into a width number.
|
|
Put the width plus the box's left into the box's right.
|
|
Loop.
|
|
If a counter is past the gradient's partitions, exit.
|
|
Draw and fill the box with the color.
|
|
Move the box right the width.
|
|
If the gradient's direction is "left-to-right", lighten the color by the amount; repeat.
|
|
Darken the color by the amount.
|
|
Repeat.
|
|
|
|
To draw the next gradient given a gradient:
|
|
Move the gradient's box down the gradient's box's height.
|
|
Double the gradient's partitions.
|
|
If the gradient's direction is "left-to-right", set a flag.
|
|
If the flag is set, put "right-to-left" into the gradient's direction.
|
|
If the flag is not set, put "left-to-right" into the gradient's direction.
|
|
Draw the gradient.
|