Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Random change to specific color (over random time)

  • Random change to specific color (over random time)

    Posted by Craig Kristensen on September 16, 2015 at 9:45 pm

    I found this script in another post which is exactly what I’m in need of.
    The only change I have made is that I want to randomize the “easeTime” and “segDur” so that the colorchanges don’t happen at the same time.

    But this doesn’t seem to work because now I’m getting color changes every frame.

    Can this script be modified so that the color changes are random as well?

    Regards,
    Craig

    colors = [[253,184,19,255]/255,
    [237,2,129,255]/255,
    [0,171,189,255]/255,
    [92,46,145,255]/255];
    easeTime = random(0.2,0.8);
    segDur = random(1,4);

    curSeg = Math.floor(time/segDur);
    t = time%segDur;
    seedRandom(curSeg,true);
    idx1 = Math.floor(random(colors.length));
    seedRandom(curSeg-1,true);
    idx0 = Math.floor(random(colors.length));
    ease(t,0,easeTime,colors[idx0],colors[idx1])

    Dan Ebberts replied 10 years, 11 months ago 2 Members · 1 Reply
  • 1 Reply
  • Dan Ebberts

    September 16, 2015 at 11:39 pm

    The simplest would be to change this:

    easeTime = random(0.2,0.8);
    segDur = random(1,4);

    to this:

    seedRandom(index,true);
    easeTime = random(0.2,0.8);
    segDur = random(1,4);

    That should make the timing different for each layer. If what you want is a different duration for each color, that’s an entirely different expression.

    Dan

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy