Left mouse to toggle between rect or ellipse particles. Right mouse to toggle rotation/roll of particles.
xxxxxxxxxx
// Left mouse to toggle between rect or ellipse particles.
// Right mouse to toggle rotation/roll of particles.
// Kaleidoscope structure from "Kaleidoscope" by Jeremy English, sketch #30186.
// boolean, PGraphics, PImage, class, function, translate, rotate, particle system
// PVector, pixels, ArrayList, frameCount, color, random, kaleidoscope
shapeGen sGen;
PGraphics sourcePG, next;
Triangle tri;
boolean isRect, rtt;
void setup() {
frameRate(30);
size(700, 600);
colorMode(HSB, 360, 100, 100, 100);
tri = new Triangle();
sGen = new shapeGen();
sourcePG = createGraphics(100, 173);
next = createGraphics(100, 173);
isRect = false;
rtt = true;
}
void draw() {
background(0);
drawHex();
sourcePG = makeShapes(); // make PGraphic from moving particles
tri.clipSourcePG(); // clip tri from sourcePG
float theta = 0;
for (int i = 0; i < 6; i++) {
pushMatrix();
translate(width/2, height/2);
rotate(theta);
tri.drawImgTri(); // draw clipped tri collected by clipSourcePG
PImage img = flipImage(tri.clippedImg); // then flip
image(img, -100, 0); // and draw flipped img
popMatrix();
theta += PI/3;
}
overlay();
}
void mousePressed() {
if (mouseButton == LEFT) isRect = !isRect;
if (mouseButton == RIGHT) rtt = !rtt;
}