-
coloring text based on numbers from an array (list)
So I have the following expression that takes a number from a list and puts it up on the screen every six frames (30 fps). Works great. Now i need compare each number from the list to the following and change the color of the test accordingly:
0-100 – Green
101-140 – Yellow
141 – 160 – Orange
161 – Up – RedI’ve tried to use different animator descriptions and changing the hue/saturation, but to no avail.
Any ideas would be greatly appreciated.
Thanks.
// expression to take input of series of numerical values and display them five per second or every six frames
// get our source list
listText = thisComp.layer("heart").text.sourceText;// now make an array, assuming a comma delimiter
list = listText.split(",");// what's the biggest value? we'll use this as our denominator
maximum = Math.max.apply(Math, list);// which number should we look at? one per six frames
wholeSeconds = Math.floor(time-inPoint);
milliSeconds = Math.floor(((time-inPoint) - wholeSeconds) * 1000);
indexModifier = Math.floor(milliSeconds/200);
target = (wholeSeconds*5) + indexModifier;// make sure we don't try to find the value-as-a-percentage for an out-of-bounds array number, or try to divide by zero
if ((target >= 0) && (target < list.length) && (maximum != 0)) {// this will print to screen the array number or zero
speed = list[target];
} else speed= 0;