Discussion:
Multiple Expressions -- how to?
(too old to reply)
N***@adobeforums.com
2009-01-24 22:37:08 UTC
Permalink
I have both keyframes and a wiggle expression on the position property of a layer.

Can I stack expressions like wiggle(n1,n2) and loop_out("cycle",0) on the same property?
R***@adobeforums.com
2009-01-25 02:30:32 UTC
Permalink
Nope, but you can add a point control to the ayer, apply wiggle to the point control, then add the following expression to the position property:

p = loopOut ("cycle", 2);
effect("Point Control")("Point") + p

If your layer is 3D then add in a 3D null and add the wiggle expression to that.

Hope this helps.
A***@adobeforums.com
2009-01-25 16:04:17 UTC
Permalink
A little background for you, Navarro: You'll notice that wiggle() and loopOut() don't take any properties as parameters. That is because they are both member functions of the property class, meaning each must be called as a child object of a particular property (e.g. transform.position.loopOut()). When you call loopOut() without appending it to a layer, you are implicitly appending it to the layer "this", which is the object-oriented-programming-speak for "the object I'm currently operating inside". The expressions interpreter automatically adds the "this." for you.

Hopefully this will help you understand why you can't use code such as "loopOut().wiggle()" or "wiggle().loopOut()". The reason is that loopOut() and wiggle() don't return properties, they return values in the whatever form their parent property dictates (single numerical values for most properties, arrays for multi-dimensional values, etc.). Neither function is a member of the return value of the other function. This is why using the two in conjunction requires that each be applied to a different property.

That said, it wouldn't be terribly hard to do the looping yourself. Here's an expression that loops the transform and its wiggle:

newTime = time;





if(numKeys > 0 && time > key(numKeys).time){





loopDuration = key(numKeys).time - key(1).time;





newTime = time % loopDuration;





}





wiggle(10, 50, octaves = 1, amp_mult = .5, t = newTime)
N***@adobeforums.com
2009-01-27 15:46:49 UTC
Permalink
Thanks for the help guys! Previously, I was just parenting my layer to a null and wiggling it while looping keyframes on the child layer.
Continue reading on narkive:
Loading...