Skip to content

Instantly share code, notes, and snippets.

@aaizemberg
Created June 8, 2020 11:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aaizemberg/2f4544efe65d79ad8f57ffb9ef9af542 to your computer and use it in GitHub Desktop.
Save aaizemberg/2f4544efe65d79ad8f57ffb9ef9af542 to your computer and use it in GitHub Desktop.
circulo cromatico (p5.js)
var portions = 3;
var PMAX = 32;
var largo;
function setup() {
createCanvas(400, 400);
noStroke();
background(0);
}
function draw() {
portions = int(1 + (PMAX * mouseX / float(width)));
if (portions < 3) portions = 3;
largo = mouseY;
if (largo == 0) largo = width;
colorMode(HSB, portions);
background(0);
for (var i = 0; i < portions; i = i + 1) {
fill(i, 100, 100);
arc(width / 2, height / 2, largo, largo, i * TWO_PI / portions, (i + 1) * TWO_PI / portions);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment