Multi Target Cycling Colours with Openframeworks

I wrote this code to share the principles behind the smooth colour changing functions used in my interactive work.

The code in the repository is a non general version of the colour changing function written for the Australian Open 2017 interactive installation, restricting the blending across three colours. The main source files to look at are MultiTargetColourCycling.h and MultiTargetColourCycling.cpp.

The core of the colour swap happens in the update() section of MultiTargetColourCycling.cpp, using lerp(), fmodf(), OfGetElapsedTimef() to blend the three chosen colors between sub-groups of three objects in a timely manner, and can be virtually applied to any number of objects .

Applying some simple object oriented programming iteration (also shared in the repository) the resulting output will be:


The resulting visual effect is the color shades "moving" across groups of objects . Observing a single circle object will reveal the cycling nature of the effect in blending the colours in a distributed way. The effect can be also noticed choosing one shade of the colour currently on screen and observing it blending along to the other objects.

If your goal is to iterate between more than three colours or affect the timing of the swap you'll need to modify the function (shared under MIT Licence).

Adding a third dimension, iterating across different objects, using ofNode,some rotations and adding sound reactivity could result in something more interesting, like these 3D mandala shapes

In more general terms, these concepts can be used to apply properties comprised of multiple(>2) steps to groups of objects in a cycling and distributed way.

Go to the full source code

Go to more Github repositories

Contact