Skip to content

Instantly share code, notes, and snippets.

@aaizemberg
Last active May 15, 2018 13:37
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/9550520 to your computer and use it in GitHub Desktop.
Save aaizemberg/9550520 to your computer and use it in GitHub Desktop.
círculo cromático (interactivo)
int portions = 3;
int PMAX = 32;
int largo;
void setup() {
size(250,250);
noStroke();
background(0);
}
void 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(int 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);
}
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>círculo cromático</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/processing.js/1.4.1/processing-api.min.js"></script>
</head>
<body>
<h1>círculo cromático</h1>
<canvas data-processing-sources="color.pde"></canvas>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment