-
Number Colors and Absolute Value
Hello. An expressions noob here needing help.
In AfterEffects, I’m trying to script a way for displayed numbers (using effects > text > numbers) to have their Fill Color be linked to their value. For example, positive numbers display in black, negative numbers display in red, and zero displays in white. I don’t want the negative sign to display when a number is less than zero — I only want it to be red. I’ve written the expression below which makes the color portion of the values work. However, when I introduce code for absolute value (Math.abs(value)) to remove the negative sign, it messes up the calculations . . . which then messes up the colors. Any ideas? Thanks!
fColor = effect("Numbers")("Fill Color");
calcValue = effect("Numbers")("Value/Offset/Random Max");if (calcValue <0)
{
fColor = [.8,0,0,1]
}
else
{
fColor
}if (calcValue >0)
{
fColor = [0,0,0,1]
}
else
{
fColor
}if (calcValue =0)
{
fColor = [1,1,1,1]
}
else
{
fColor
}