Lilac Chaser
in
Programming Questions
•
9 months ago
Hey,
I'm trying to create the Lilac Chaser but I am having a pretty hard time implementing it.
This is the code I've got:
- void drawCircles() {
- noStroke();
- fill(182, 102, 210);
- float radius = 190;
- int numCircles = 12;
- float angle = TWO_PI/(float)numCircles;
- int discolor = 11;
- for (int i = 0; i < numCircles; i++) {
- ellipse(radius * sin(angle*i), radius * cos(angle*i), 40, 40);
- }
- }
- void coverCircle(float rot) {
- noStroke();
- rotate(rot);
- fill(170,170,170);
- float radius = 190;
- float angle = TWO_PI;
- ellipse(radius*sin(angle),radius*cos(angle),50,50);
- }
- void setup() {
- size(500, 500);
- }
- float rot = 0;
- void draw() {
- background(170,170,170);
- translate(width/2, height/2);
- drawCircles();
- coverCircle(rot);
- rot += 0.08;
- }
Now, I realize that in the original Lilac Chaser, the circles disappear and appear in a way that they give the impression of a grey circle (and then a green circle) going around. I tried to create that by adding a background colored circle that goes around the 12 circles. But it ends up being pretty weird and not what I want.
I would really appreciate if you guys could help me out with this with ideas that I could try out. I am a noob at Processing so I would really appreciate it if your explanations were dumbed down for me.
PS: This is what I am trying to achieve in case you weren't familiar with the Lilac Chaser illusion:
Also I tried looking for a Processing implementation of Lilac Chaser over at openprocessing.org but couldn't find any. If you are familiar with such an implementation, I'd appreciate if you could direct me to it.
1