How would I adjust this so that the color change duration is random and not every single frame?
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 "Color"
if (l.effect(i)(1).name=="Color") {
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) {
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;
}