xxxxxxxxxx
function setup() {
createCanvas(windowWidth, windowHeight);
background(0);
noStroke();
translate(width/2, height/2);
for(var i=0; i<360; i+=10) {
rotate(radians(5));
drawJewels(width * random(0.05, 0.1), 0);
}
}
function draw() {}
function mouseDragged() {
drawJewels(mouseX, mouseY);
}
function drawJewels(x, y) {
blendMode(MULTIPLY);
drawPolygons(x, y, 10, width * 0.07);
blendMode(ADD);
drawPolygons(x, y, 30, width * 0.07);
}
function drawPolygons(x, y, count, r) {
push();
beginShape();
translate(x, y);
for(var i=0; i<count; i++) {
rotate(random(1));
fill(random(20, 50), random(20, 50), random(50, 255));
vertex(random(-r, r), random(-r, r));
}
endShape();
pop();
}