ADOBE AFTER EFFECTS 56 WIGGLE EXPRESSION
From: "Spencer Fong" (swfong@no-spam)
Subject: wiggle expression
Date: Mon, 28 Jul 2003 00:30:00 -0700


I'm using the wiggle expression to randomly "shake" my position property in both the x,y direction. Two things I'm trying to do, that I just can't seem to get right.


(1) Is it possible to limit "wiggle" to just the x or y dimension (like "The Wiggler" can in the PB)?


(2) The fifth parameter is "time". If I want to start my wiggle at 3:15 (3 seconds, 15 frames) - how do I represent that in the expression argument? Can't seem to get that right.


Thanks in advance,
Spencer

















From: "Dan Ebberts" (debberts@no-spam)
Subject: Re: wiggle expression
Date: Mon, 28 Jul 2003 07:03:46 -0700

Here's an example of how I'd do it:

if (time < 3.5){ value }else{ [value[0],wiggle(7,50)[1]] }

Dan

From: "Aaron Cobb" (gromit59@no-spam)
Subject: Re: wiggle expression
Date: Mon, 28 Jul 2003 07:08:06 -0700

1) Absolutely. Just ignore one of the wiggled dimensions and pass through the original value for that dimension. For example:


[wiggle(freq = 25, amp = 10, octaves = 1, amp_mult = .5, t = time)[0],
position[1]]

will only wiggle the x position, leaving the y alone.

2) Time doesn't represent when the wiggle starts. It represents at what time the wiggle is sampled. For instance, if you want to shift the wiggle signal back in time a couple of frames, you would change "t = time" to "t = time - 2*this_comp.frame_duration"


There are many ways to start and stop a wiggled signal, but perhaps the most straightforward is to vary the amplitude. Add a Slider Control effect to your layer (or to another layer if you need to collapse transformations on your current layer). I'm going to call the slider control "Amplitude" for this example. Now replace "amp = 10" with "amp = amp = effect("Amplitude").param("Slider")".


Your expression should read:

[wiggle(freq = 25, amp = effect("Amplitude").param("Slider"), octaves = 1, amp_mult = .5, t = time)[0], position[1]]

substituting in your own values of course. Now keyframe your slider as you see fit--to turn it off and on, simply set hold keyframes to 0.0 for "off" and whatever amplitude you like for "on". With this method, of course, you can easily fade your wiggle in and out. Note you can also set up sliders for other parameters, frequency being the most useful.


Aaron