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

The motion is slow if the mouse is in the top-left corner and speeds up as you move in any direction from the top-left, moving in different ways depending on the direction of the mouse.

I have added the ability to be able to control the animation by clicking the mouse as well. This is commented out in the online file and in the source code, but can easily be turned back on by uncommenting it.

It’s available online here.

If the comments are removed, then no animation will occur until the left mouse button is pressed. When it is pressed it will behave the same way as when the mouse button control is commented out. When the mouse button is released, the animation stops.

Note that with the mousePressed() function commented out, nothing will happen until the mouse first moves over the sketch.

The source code is below.

Read the rest of this entry »

Spiral Kaleidoscope

June 6th, 2008

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.

Read the rest of this entry »

Random Spirals

June 6th, 2008

Random SpiralsBased on the Triangle Flower example from the Processing learning basics site, I’ve come up with a rendered image that will generate a random, coloured spiral every time it loads. It’s similar to the appearance of a kaleidoscope. You can have a look at it online here.

At this point, to see a new spiral, you have to re-run the Java, or re-load the page rather than pressing a button, moving the mouse or anything like that. Hopefully I’ll be able to get that to work soon as I think it would look pretty cool if I could get it to change as you move the mouse over it, similar to the way a kaleidoscope changes as you move it around.

I suspect it is to do with the lack of a draw() function, but when I add it in and run the spiral() function from within the draw() function, it completely changes the way the spirals render and I haven’t yet been able to get it to behave correctly.

Read the rest of this entry »

Continuing on from the clouds I had generated earlier, I thought it would be pretty cool if I could get it to move and appear to grow.

Unfortunately, I haven’t been able to make it do that yet. I have however, gotten it to generate random cloud combinations and position them randomly on the canvas with semi-random colours based around reds, yellows and oranges.

It is available online here.

Read the rest of this entry »

I have been having a look at using recursion in Processing to tile things, however, I got a little bit sidetracked.

Going through the online learning basics, there are two recursion examples, “Recursion” and “Recursion 2“. In the first of these, recursion is used to have a circle repeat itself twice at half the original size inside itself, and continue doing this with each smaller circle until the level is no longer greater than 1. The level is basically the amount of times the function will call itself.

The second of these examples builds on the first, but instead of repeating the circle’s inside themselves, it generates random sizes and shades of circles in semi-random x and y co-ordinates around the main circle until the level is no longer greater than 1. The level again basically being how many times the function calls itself.

Experimenting with these two recursive functions, I combined the two to create a cartoonish cloud that slightly resembles a mushroom cloud which can be found online here.

Read the rest of this entry »