xxxxxxxxxx
27
let h = 0; // variables with a value of zero
let s = 0;
let b = 0;
function setup() {
createCanvas(400, 400);
colorMode(HSB);
// HSB colour mode stands for hue, saturation, brightness
// hue goes from 0 (red) - 360 (also red) 180 is cyan
// saturation goes from 0 - 100 (black and white to colour)
// brightness goes from 0 - 100 (black to white)
}
function draw() {
background(h, s, b); //background colour is using
h++; //the increment operator ++ increases the value of a variable by 1.
if( h >= 360){
h = 0;
}
// using mouse X,Y coordinates as the values for the S, B variables.
s = map(mouseX, 0, width, 0, 100);
b = map(mouseY, 0, height, 0, 100);
}