Hey,
im using your code just added a little time-tweak. I have this Code on an Adjustment Layer because i have multiple layers that i want to change between the colors – but randomly in time. right know everything is changing together.. i hope you understand what i mean.
i think it could work about the “index”?!
— thank you —
here the code again (just added this holdTime-lines)
l=thisComp.layer("Colors");
// retrieve colors stored in the color controls
i=1;
colors=[];
try {
while(l.effect(i)) {
// an effect exists, but is it a color control ?
// We'll check if it's first parameter is called "Farbe"
if (l.effect(i)(1).name=="Farbe") {
colors.push(l.effect(i)(1).value); // store the color in a list
}
i++;
}
} catch (e) {}
// Now if the list of colors contains any elements
// we will get a random value from the list.
if (colors.length) {
holdTime = .5;
seed = Math.floor(time/holdTime);
seedRandom(seed,true);
r=Math.floor(random(colors.length)); // a random integer
colors[r]; // return the color
} else {
// the list of colors is empty, so we use the existing color value.
value;
}