Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Conditionals and wiggle on two dimensions

  • Conditionals and wiggle on two dimensions

    Posted by David Cabestany on May 11, 2015 at 7:25 pm

    Hi,

    I’m trying to use the expression below to control the scale of one layer when a person is talking, but it breaks every time it runs, the errors are:

    Array piece can’t expand to more than one value when I finish the expression with [x,x] and

    Expression result must be if dimension 2, not 1 if I change the end to x.

    The idea is to have the layer scale and shake when the person talks and still when the person is quiet.

    Can anyone help?

    s=thisComp.layer("hostess").effect("Both Channels")("Slider");

    if
    (s>=5)
    {
    x=(wiggle(2,10));
    }
    else
    {

    x=100;
    }
    [x,x]
    ;

    Dan Ebberts replied 11 years, 3 months ago 2 Members · 3 Replies
  • 3 Replies
  • Dan Ebberts

    May 11, 2015 at 8:44 pm

    wiggle() already gives you an array, so sticking it in brackets (as variable x) won’t work. Try it this way:

    s=thisComp.layer(“hostess”).effect(“Both Channels”)(“Slider”);
    (s >= 5) ? wiggle(2,10) : [100,100]

    Dan

  • David Cabestany

    May 11, 2015 at 10:55 pm

    Thanks Dan,

    I revised to this:

    s=thisComp.layer(“Audio VO”).effect(“Both Channels”)(“Slider”)
    t= linear(s,0,8,100,165);

    if
    (s>=1
    && time>=38
    && time <=62
    )
    {[t,t]
    }
    else
    [100,100];

    Depending on the layer I change the time values.

    I’m not very familiar with this other writing convention you’re using, the question mark and the colon. I think I saw it once but that’s it, I’m guessing the ? means “then” and : means “else”, but I don’t see anything that means “if”

    Is the old writing convention bad? Does it slow the program or something?

    Thanks again.
    D.

  • Dan Ebberts

    May 12, 2015 at 1:34 am

    In JavaScript, ? is the conditional operator, where the “if” is implied. It’s just a more compact notation that I like when the logic is simple.

    Dan

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