Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Expression for color control (not random)

  • Expression for color control (not random)

    Posted by Major Attila on February 10, 2017 at 7:43 pm

    Hey everyone. I got an expression for color control which is working great, the only issue with it is that is random, I’d like the expression to choose the colors from the colors list but not randomly.

    This is the expression I got:

    colors = [[225, 255, 0,255]/255,
    [0, 246, 255,255]/255,
    [0, 17, 255,255]/255,
    [255, 0, 152,255]/255,
    [152, 0, 255,255]/255,
    [0, 255, 85,255]/255,
    [255, 195, 0,255]/255];
    easeTime = .5;
    segDur = 5;

    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])

    Major Attila replied 9 years, 3 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    February 10, 2017 at 8:01 pm

    So you want the expression to go through the colors sequentially? That would be like this:


    colors = [[225, 255, 0,255]/255,
    [0, 246, 255,255]/255,
    [0, 17, 255,255]/255,
    [255, 0, 152,255]/255,
    [152, 0, 255,255]/255,
    [0, 255, 85,255]/255,
    [255, 195, 0,255]/255];
    easeTime = .5;
    segDur = 5;

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

    Dan

  • Major Attila

    February 10, 2017 at 9:02 pm

    Thank you very much, that is exactly what I wanted.

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