Drawing Machine

int symmetry = 6;
int angle = 360 / symmetry;
float strokeSize = 9; // use + and – keys to change instead of slider
float xoff;
// press s to save
// press c to clear to screen

void setup() {
size(600, 600);
//background(200);
colorMode(HSB, 100);
noStroke();
}

void keyPressed() {
if (key == ‘s’ || key == ‘S’) {
save(“snowflake.png”);
println(“snowflake saved!”);
} else if (key == ‘c’ || key == ‘C’) {
background(random(225), random(225), random(225));
// frameRate(100);
}
}

void draw() {
translate(width / 3, height / 3);

int mx = mouseX – width / 3;
int my = mouseY – height / 3;
int pmx = pmouseX – width / 3;
int pmy = pmouseY – height / 3;

if (mousePressed) {
int hu = int(map(sin(radians(xoff)), -1, 1, 0, 255));
xoff += 1;
stroke(random(225), random(225), random(225));
for (int i = 0; i < symmetry; i++) {
rotate(radians(angle));

float sw = strokeSize;
strokeWeight(sw);

line(mx, my, pmx, pmy);

pushMatrix();
scale(1, -1);
line(mx, my, pmx, pmy);
popMatrix();
}
}
}

My drawing machine creates a sort of Kaleidescope 6 point formation. Color changes as you press and drag mouse around. The background changes color when you clear background with ‘c’, endless fun with this design    Johanna Bonilla Recendez