ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

# Lock Scale within an expression

FAQ   •   VIEW ALL
 Lock Scale within an expression on Feb 26, 2013 at 7:24:56 pm

I am relatively new to scripting and am looking for a means to lock both parameters of a scale expression to equal each other, so that even though there is a random value assigned, x dimension= y dimension for every value given.

I current have the following in the scale parameter:

ease(time,wiggle(.5,2.7),wiggle(.5,2.7))

Which results in separately generated values for the x,y. Is it possible to get whatever values generated by this to provide a single value which is applied to both the x and y?

Based on my math experience from 10 years ago (need refresher courses), I am assuming that this may get it:

x=ease(time,wiggle(.5,2.7),wiggle(.5,2.7));

[x,x]

Would that be correct, can't get that to work. I am assuming its syntax.

 Re: Lock Scale within an expressionon Feb 26, 2013 at 7:53:38 pm

By wiggle generates values for both X and Y, that's why you are getting the "array piece can't expand to more than one value" error...IE, in your expression when you say wiggle, it's comes up [2,7] which you are defining as X. You are then trying to make a scale paramter of that is this [2,7, 2,7].

So you need to tell AE, to just use one of the parameters, in your case, the first one. Here's how it should look:

```x = ease(time,wiggle(.5,2.7),wiggle(.5,2.7))[0]; [x,x] ```

The [0] tells AE to use the first value produced by the wiggle(AE starts with 0 as the first index number). You could use [1] to get the second or if you had a Z space [2].

Johnny Cuevas, Editor
Thinkck.com

"I have not failed 700 times. I have succeeded in proving that those 700 ways will not work. When I have eliminated the ways that will not work, I will find the way that will work."
---THOMAS EDISON on inventing the light bulb.

 Re: Lock Scale within an expressionon Feb 26, 2013 at 7:57:19 pm

since wiggle works on multidimensional properties, you'd just need to specify the index of the dimension that you want to use.

also, i don't think you need the ease() function with wiggle (it already has smooth interpolation).

try this:

s = wiggle(.5,2.7)[0]
[s,s]

-- john beat me to it
-- and i forgot a semicolon after the first line

Kevin Camp
Senior Designer
KCPQ, KMYQ & KRCW

 Re: Lock Scale within an expressionon Feb 26, 2013 at 8:08:40 pm

Thanks, Guys, i kept messing with it, but didn't get it to work until i did the following:

x=(ease(time,wiggle(.5,2),wiggle(.5,2)));

[x[0],x[0]]

I guess i was missing the "[0]"

is there a "dictionary" so to speak for expressions in AE so I can at least make sure my syntax is written in a means that AE can understand?

 Re: Lock Scale within an expressionon Feb 26, 2013 at 8:40:00 pm

[Anthony Sipsas] "is there a "dictionary" so to speak for expressions in AE so I can at least make sure my syntax is written in a means that AE can understand?"

It's JavaScript with included AE specific functions as defined here: