ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

# Wiggle specific fill color values

FAQ   •   VIEW ALL
 Wiggle specific fill color values on May 16, 2011 at 6:58:08 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

Brett

 Re: Wiggle specific fill color valueson May 16, 2011 at 7:28:58 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

 Re: Wiggle specific fill color valueson May 16, 2011 at 7:55:53 pm

That works wonderfully!

Many thanks!
Brett

 Re: Wiggle specific fill color valueson Dec 4, 2018 at 9:42:31 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?

 Re: Wiggle specific fill color valueson Dec 4, 2018 at 4:57:54 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

 Re: Wiggle specific fill color valueson Dec 4, 2018 at 10:58:55 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"?

 Re: Wiggle specific fill color valueson Dec 4, 2018 at 11:58:01 pm

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

Dan