ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

# Wiggle Expression too random, need a "Pulse Effect"

FAQ   •   VIEW ALL
 Wiggle Expression too random, need a "Pulse Effect" on Jul 3, 2011 at 9:43:09 pm

Hey Guys,

I need your help here, so you know when you write an expression for the wiggle (eg wiggle(2,15)) it will wiggle randomly to those values you specified right?

but here's the thing, the wiggle expression about gives unpredictable random movements, lets say I want the object (position in this case) to 'PULSE'

For instance the object is at the position 0,0
and I write the expression to wiggle the object 15 pixels ONLY on the X axis (just to make things simple) it would look something like this;

```a = wiggle(2,15); [a[0],0]```

okay, the above expression is gonna create some seriously random 'organic' movements.

But what I really want is to have this object 'PULSE' between +/-15 pixels, one keyframe it's at -15, the next keyframe it is at +15

Thanks guys, I hope you understand my question clearly and help me out, much appreciated

 Re: Wiggle Expression too random, need a "Pulse Effect"on Jul 3, 2011 at 10:34:10 pm

You could keyframe one complete cycle and then use loopOut() to make it cycle.

Dan

 Re: Wiggle Expression too random, need a "Pulse Effect"on Jul 3, 2011 at 10:53:40 pm

I am not too sure what you mean, but I would like this the solution to be purely expression based

 Re: Wiggle Expression too random, need a "Pulse Effect"on Jul 3, 2011 at 11:12:57 pm

>I would like this the solution to be purely expression based.

Well, you did mention keyframes. Did you mean frames?

This will jump between 15 and -15 on each frame:

x = (timeToFrames()%2) ? -15 : 15;
value + [x,0]

That's pretty fast though. Maybe this what you meant:

freq = 2;
amp = 15;
x = amp*Math.sin(freq*time*Math.PI*2);
value + [x,0]

Dan

 Re: Wiggle Expression too random, need a "Pulse Effect"on Jul 4, 2011 at 3:47:05 pm

thanks Dan Ebberts, that works like a charm!

 Re: Wiggle Expression too random, need a "Pulse Effect"by Kath Rinon Sep 5, 2012 at 2:54:36 pm

Hello! And want to do this Expression on the z axis, but it doesn`t work.

freq = 2;
amp = 15;
z = amp*Math.sin(freq*time*Math.PI*2);
value + [z,0]

There is a alarm message:
Expression result must have the dimension 1 not 2!

Can anybody help me?

Thank you!

 Re: Wiggle Expression too random, need a "Pulse Effect"on Sep 5, 2012 at 5:19:44 pm

Change the last line to:

value + [0,0,z]

Dan

 Re: Wiggle Expression too random, need a "Pulse Effect"by Kath Rinon Sep 5, 2012 at 8:33:18 pm

Thank you Dan for the quick answer! It works, yeah!

 Re: Wiggle Expression too random, need a "Pulse Effect"on Dec 1, 2015 at 7:33:44 am

This is so close to what I´m looking for. Probly just need a few tweaks that i can´t figure out.

I have about 20 different layers of photoshopped stars in a comp, and I want them all to be twinkling randomly using expressions. I want them to both twinkle and fade in and out randomly like real stars appear to do, not as strobe lights, which is what happens when i try the wiggle() or random() expressions. I want the twinkling and fading to slowly pulsate at random intervals and i also want the duration of each "pulse" to be randomized.

If I apply this expression to all 20 stars, they all pulse in and out at the exact same times with exact same shine and duration. The "Shine" effect is a good look, but it is a hassle to keyframe each of the 20 stars differently to make it appear convincingly random.

I would really appreciate a swift reply to this! Thank you so much for any help!

 Re: Wiggle Expression too random, need a "Pulse Effect"on Dec 1, 2015 at 8:21:14 amLast Edited By Kalle Kannisto on Dec 1, 2015 at 8:26:27 am

Sine wave is not exactly random, but if you put a different freq setting for each star, that would give the impression they are random.

Wiggle should work for this though if the time setting is slow enough. Such as: `wiggle(.5,[your brightness change here])` or even slower.

If you don't want to deal with each star separately, other approaches could be used, such as putting an animated fractal noise layer above your stars.

 Re: Wiggle Expression too random, need a "Pulse Effect"on Jan 8, 2016 at 3:54:01 pm

Hi Dan,

How do you apply this to both the x & y?

Thanks

```freq = 2; amp = 15; x = amp*Math.sin(freq*time*Math.PI*2); value + [x,0]```

 Re: Wiggle Expression too random, need a "Pulse Effect"on Jan 8, 2016 at 5:42:15 pm

Both with the same frequency and amplitude? You could just change the last line to:

value + [x,x]

Dan