xxxxxxxxxx
float hue, br, hoehe, num, totN, loc;
boolean allow;
void setup() {
background(0, 0, 100);
size(400, 430);
hue = 360;
loc = 15;
noStroke();
colorMode(HSB, 360, 100, 100);
ellipseMode(CENTER);
drawSlider();
}
void draw() {
background(0, 0, 100);
br = width/num;
totN = 360/(num*num);
hoehe = (height-30)/num;
for (float x = 0; x < num; x++) {
for (float y = 0; y < num; y++) {
hue -= totN;
pushMatrix();
translate(x*br, y*hoehe);
fill(hue, 100, 100);
ellipse(0.5*br, 0.5*hoehe, br, hoehe);
popMatrix();
}
}
hue = 360;
drawSlider();
}
void drawSlider() {
num = map(loc-10.55, 0.0, width, 0.0, 90);
fill(0, 0, 100);
rect(0, height-30, width, 30);
fill(200, 35, 100);
rect(10, height-15, width-20, 5);
fill(245, 50, 99);
ellipse(loc, height-13, 15, 15);
}
void mousePressed() {
if (mouseY > height-30) allowed = true;
}
void mouseReleased() {
allowed = false;
}
void mouseDragged() {
if (mousePressed){
if (allowed) {
loc = mouseX;
if (loc < 15) loc = 15;
if (loc > width-15) loc = width-15;
}
}
mousPressed = false;
}