Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Wiggling Expression

  • Wiggling Expression

    Posted by Luke Hale on April 5, 2007 at 12:56 am

    Two things similar things to do with wiggle expressions, firstly i’m trying to wiggle a layers z position so i came up with the expression

    [ 100,100, [100+[wiggle(0.5,200)]] ]

    and i get the error “array piece can’t expand to more than one value”. Could someone explain what this error means, i get it quite a lot, and how i could fix the problem?
    Also, i want to wiggle the x and y scale property of a layer but so the y value is the same as the x at any time, i came up with;

    temp = wiggle(10,50);
    [temp,temp]

    and got the same error, probably doing the same thing wrong. If anyone could explain what i’m doing wrong i would be very grateful.
    Thanks very much for your time and help.
    Luke

    Luke Hale replied 19 years, 1 month ago 3 Members · 3 Replies
  • 3 Replies
  • Dan Ebberts

    April 5, 2007 at 1:45 am

    Wiggle creates an array of the same dimensions as the property it’s applied to. So for your first question, you’d want to do something like this:

    w = wiggle(0.5,200);
    [value[0],value[1],w[2]]

    Your second one would be like this:

    temp = wiggle(10,50);
    [temp[0],temp[0]]

    Dan

  • Stephanie Benvenuto

    April 5, 2007 at 5:34 pm

    You said you were often getting the error “array piece can’t expand to more than one value”. This is the problem I was having. So I’m going to show you what someone showed me. It really helped in writing future expressions.

    Your second piece of code:

    temp = wiggle(10,50);
    [temp,temp]

    the “wiggle(10,50)” is returning 2 values. A scale value for x and a scale value for y. But your array can’t have more than one value in each piece. What it needs is [1 value, 1 value]. You gave it [2 values, 2 values] or [x & y, x & y]. That’s why it couldn’t work.

    So with Dan’s solution:

    temp = wiggle(10,50);
    [temp[0],temp[0]]

    Those zeros in brackets are telling the array that for the variable “temp”, only take the x value. If you wanted it to always take the y scale value for both you could write:

    temp = wiggle(10,50);
    [temp[1],temp[1]]

    [0] is for the x value, [1] for y & [2] for z. So you could also apply this same idea to your other expression as:

    [ 100,100, [100+wiggle(0.5,200)[2]] ]

    Now the way Dan wrote it is cleaner and easier to work with. But just to illustrate that buy added the [2] to that piece of the array, you are no longer giving it 3 values for one piece of the array. The [2] tells it to use only the z value of what is returned.

    Hope this helps.

    -S

  • Luke Hale

    April 6, 2007 at 12:48 am

    Thank you very much for your help. Problem solved!
    Luke

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy