Spiral Kaleidoscope

Spiral KaleidoscopeBuilding on my randomly generated spirals developed earlier, I was aiming to get the spirals to either spin, or change either on their own, or in response to a user’s input. I have not yet been able to get it to work like this, but I have gotten it to change and spin with the appearance of a kaleidoscope.

Have a look at it online here.

Each time it loads, a random spiral will be generated, as with the original, the spiral will then disappear into the spinning kaleidoscope. The source code is below.

Point[]p = new Point[3];
float shift = 2.0;
float fade = 0;
float fillCol = 0;
float rot = 0;
float spin = 0;
float value = random(100);
float valuex = random(200);
float valuey = random(300);

void setup(){
size(800, 800);

void draw() {
fade = 255.0/(width/2.0/shift);
spin = 360.0/(width/2.0/shift);
p[0] = new Point(-width/2, height/2);
p[1] = new Point(width/2, height/2);
p[2] = new Point(0, -height/2);
translate(width/2, height/2);
spiral(value, valuex, valuey);

void spiral(float shift1, float shift2, float shift3){
float r = random(100, 255);
float g = random(100, 255);
float b = random(100, 255);
fill(r, g, b, 10);
triangle(p[0].x+=shift, p[0].y-=shift/(random(shift1)), p[1].x-=shift, p[1].y-=shift/(random(shift2)), p[2].x, p[2].y+=shift*(random(shift3)));
// recursive call
spiral(shift1, shift2, shift3);

Tags: , , ,

One Response to “Spiral Kaleidoscope”

  1. [...] have added some mouse controls to my kaleidoscope so that the type of motion changes based on the position of the [...]

Leave a Reply