Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Wiggle specific fill color values

  • Wiggle specific fill color values

    Posted by Brett Schnacky on May 16, 2011 at 6:58 pm

    So what I’m trying to do is use a wiggle on the value property of a fill. However the values the wiggle uses need to be 5 very specific colors, and not the entire spectrum. I realize that I could control this with a colorama effect, but the results I’m getting aren’t as smooth as what could be achieved if I get this working with a fill effect.

    The wiggle should randomly display these color and ONLY these colors. No combinations of colors.

    Colors (RGB):
    242,0,23
    204,204,204
    0,55,150
    255,255,255
    0,0,0

    Thanks in advance,
    Brett

    Hugo Morais replied 7 years, 5 months ago 3 Members · 7 Replies
  • 7 Replies
  • Dan Ebberts

    May 16, 2011 at 7:28 pm

    This would be one way to do it:


    freq = 1;

    r = thisLayer.transform.rotation;
    w = Math.abs(r.wiggle(freq,100)-r);
    if (w < 20)
    [242,0,23,255]/255
    else if (w < 40)
    [204,204,204,255]/255
    else if (w < 60)
    [0,55,150,255]/255
    else if (w < 80)
    [1,1,1,1]
    else
    [0,0,0,1];

    Dan

  • Brett Schnacky

    May 16, 2011 at 7:55 pm

    That works wonderfully!

    Many thanks!
    Brett

  • Hugo Morais

    December 4, 2018 at 9:42 am

    Dan always to the rescue!

    I ended up here trying to figure out a way to wiggle specific position values.
    So instead of randomly jumping from an array of numbers, I want to transition smoothly.

    Is there a way to make it work?

  • Dan Ebberts

    December 4, 2018 at 4:57 pm

    I’m not sure what you’re after exactly. Maybe something like this:

    freq = 2;
    period = 1/freq;
    positions = [[100,100],[200,100],[100,200],[200,200]];
    seed = Math.floor(time*freq);
    seedRandom(seed,true);
    curDest = positions[Math.floor(random(positions.length))];
    seedRandom(seed-1,true);
    prevDest = positions[Math.floor(random(positions.length))];
    t = time%period;
    ease(t,0,period,prevDest,curDest)

    Dan

  • Hugo Morais

    December 4, 2018 at 10:58 pm

    Wow, this is exactly what I was looking for!
    I kinda had a go at it today following your Random Motion chapter but the code you just posted has those pauses in the motion that I was looking for.

    Does it happen because the same value “gets chosen twice”?

  • Dan Ebberts

    December 4, 2018 at 11:58 pm

    Yes, that will happen with this version. The more positions in the array, the less like it will happen though.

    Dan

  • Hugo Morais

    December 5, 2018 at 8:51 am

    Thank you Dan!

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