// Main const N = 10; let strips = []; function setup() { createCanvas(400, 300); strips = createStrips(N); // TODO sort the strips by luminance } function draw() { background(0); noStroke(); const h = height / strips.length; // TODO draw the strips } // HELPERS /** * * @typedef {{red:number, green:number, blue:number}} Color */ /** * createRndColorStrip * @returns Color */ function createRndColorStrip() { return { red: Math.floor(Math.random() * 255), green: Math.floor(Math.random() * 255), blue: Math.floor(Math.random() * 255), }; } /** * getLuminance -- get luminance given an array of Color * @param {Color} strip * @returns number */ function getLuminance(strip) { // TODO } /** * createStrips -- create an array of random colors * @param {number} n * @returns Color[] */ function createStrips(n) { // TODO }