Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions How do you express the word “between” in Expressions?

  • How do you express the word “between” in Expressions?

    Posted by Frank Raposo on August 24, 2009 at 5:15 pm

    I’m trying to learn expressions and am trying to write an expression that uses Ease command to control Position and move a layer through 10 seconds and have it move every 2 seconds. I can get through the first 4 seconds but how do I tell AE that if the time is between 4 and 6 I want variable “third” to be executed and if the time is between 6 and 8 I want variable fourth to be executed and so on and so forth. The numbers in the arrays are just random numbers; I’m only trying to learn not actually do anything work realated. This is what I have so far.

    var first = ease(time,0,2,[100,100],[600,100]);
    var second = ease(time,2,4,[600,100],[100,600]);
    var third = ease(time,4,6,[100,600],[20,500]);
    var fourth = ease(time,6,8,[20,500],[300,800]);
    var fifth = ease(time,8,10,[300,800],[100,100]);
    if (time<2) {var movement = first} else {var movement = second};
    movement

    quinnmcguee

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

    August 24, 2009 at 5:30 pm

    This is one way:

    if (time < 2){ ease(time,0,2,[100,100],[600,100]); }else if (time < 4){ ease(time,2,4,[600,100],[100,600]); }else if (time < 6){ ease(time,4,6,[100,600],[20,500]); }else if (time < 8){ ease(time,6,8,[20,500],[300,800]); }else{ ease(time,8,10,[300,800],[100,100]); } Dan

  • Frank Raposo

    August 25, 2009 at 1:48 pm

    Thank you so much for the help. This was a real leap forward in my understanding of Expressions. Just one more question please. Why is the end parentheses “}” coming after the semicolon? So far I’ve learned to place parentheses at the end of variables.

    quinnmcguee

  • Dan Ebberts

    August 25, 2009 at 1:54 pm

    It’s not a parentheses, it’s a curly bracket “}”. You use those to enclose groups of statements to be treated as a single block. Not really necessary in this case, because each else clause only has a single statement. I just do it out of habit.

    Dan

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