Lab 3

Create a program that shows three boxes, and changes the hue of each box (to a random hue) when the user clicks the box or types the box’s number. Here is an example:


Use colorMode(HSB, 360, 100, 100) to make it easy to switch hues. Use a float variable for each of the three hues, and set each randomly with something like random(0, 360).

Display text with the following command: text("1", 100, 200), where the "1" is the text to display, and 100,200 is the x,y coordinate. Make sure you set the fill to white before writing text with this command (in HSB mode): fill(0, 0, 100) (no color saturation, maximum brightness). Also, for a larger font size, use textSize(32) in setup().

CSCI 111 material by Joshua Eckroth is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License. Source code for this website available at GitHub.