browse OpenProcessing

Ritoque 2
emergent colors
ritokazo
browse all>

browse the portfolio of emoc

optical wave
five grams of bichromatic turtle
swarm Pong
vintage Pong
see more>
emergent colors

emergent colors

uploaded by
emoc
Where do colors come from ? No color allocation is done by code, colors emerge slowly from grey + grey operations and processing internal magic.

(tiny sketch < 200 chars)
Embed Code
Fave'd by 1 users
Sketch added to your favorites in your portfolio.
You must login/register to add this sketch to your favorites.

comments

source code

Comments

Bill Robinson
23 Sep 2009, 00:39
Well, maybe the pixels array will probably be filled with 0xffcccccc values to start with. As you add these together, the first time, you get an increasing amount of values which are almost like an l-system, really.

ffcccccc+ffcccccc => ff999998
ffcccccc+ff999998 => ff666664
ffcccccc+ff666664 => ff333330
ff999998+ff999998 => ff333330

The lowest byte will wrap around fastest (making a quick blue<->yellow change), then green, then red, then alpha.

I just tried to put a
background(0x01010101); in the setup method. That's kind of cool (but slow to build).

This is what I was using to examine it:



static HashSet h=new HashSet();
void setup(){
size(800,800);
// background(0x01010101);
// background(0x08080808);
// background(0x10101010);
// background(0x20202020);
// background(0x80808080);
}
void draw(){
loadPixels();
for(int i=1;i<width*height-1;i+=random(1000)) {
final int a=pixels[i-1];
final int b=pixels[i+1];
final long st = a<b ? (((long)a)<<32) | (b&0xffffffffL) : (((long)b)<<32) | (a&0xffffffffL);
if (!h.contains(st)) {
System.out.println(Integer.toHexString((int)(st>>32)) + " + "+Integer.toHexString((int)b)+" => "+Integer.toHexString(a+b));
h.add(st);
}
pixels[i]=a+b;
}
updatePixels();
}
emoc
30 Oct 2009, 17:25
Thanks for those in-depth explanations.
You need to login/register to comment.