Created
June 8, 2020 11:24
-
-
Save aaizemberg/2f4544efe65d79ad8f57ffb9ef9af542 to your computer and use it in GitHub Desktop.
circulo cromatico (p5.js)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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