Controlling color based on a random, cycling value

Moderators: Disciple, zlovatt

Post Reply
redforty
Posts: 5
Joined: March 1st, 2007, 4:32 pm

Ok, here's the effect I'm trying to achieve:

A set of numbers that fluctuates randomly, changing color depending on the number going up or down (green and red, respectively).

I started by creating a text layer with the source text pik-whipped to the X value of a null. I put a wiggle on the null with a low frequency to give the number a 'soft' fluctuation. It rises and falls just fine.

What I want to do now is change to color of the text layer green when the number is rising and red when it's falling (no grad between. It can be a binary switch).

I thought maybe I could get an expression to read the value of X (on the normal) on the last frame and compare it to the current frame, then color based on an If-then statement. But I can't figure out how to do that.

valueAtTime(time-1) didnt work. I know I'm not doing it right.

Any help would be greatly appreciated. Thanks!

-Daniel
Dan Ebberts
Posts: 320
Joined: June 26th, 2004, 10:01 am
Location: Folsom, CA
Contact:

Something like this should do the trick:

Code: Select all

red = [1,0,0,1];
green = [0,1,0,1];
if ( thisComp.layer("Null 1").transform.position.velocity[0] >0 ) green else red

Dan
Post Reply