Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions How to change the position of an object with easy movment with expresions

  • How to change the position of an object with easy movment with expresions

    Posted by Marcelo Cabral on September 6, 2011 at 5:47 pm

    Hi.
    I need to change the 2D layer position with easy movments. In other word I have a simple square in the scene and I need to move out of the scene but with a easy movment using marks in the layer

    I found this expression to “see” the layer mark
    but what can I add to this expression to control the object to move it out of the scene with easy movment.

    Thanks

    n = 0;
    t = 0;
    if (marker.numKeys > 0){
    n = marker.nearestKey(time).index;
    if (marker.key(n).time > time) n--;
    }
    if (n > 0) t = time - marker.key(n).time;

    Marcelo Cabral replied 14 years, 8 months ago 2 Members · 12 Replies
  • 12 Replies
  • Dan Ebberts

    September 6, 2011 at 6:22 pm

    What direction do you want it to go?

    DAn

  • Marcelo Cabral

    September 6, 2011 at 6:33 pm

    from the center to the left

  • Marcelo Cabral

    September 6, 2011 at 6:42 pm

    Hi Dan
    I need to move the object from the center to the left out of the escene.
    Thanks

  • Dan Ebberts

    September 6, 2011 at 8:14 pm

    Play around with this (tweak the rate variable):


    rate = [-5000,0];
    v = value;
    if (marker.numKeys >0){
    t = time - marker.key(1).time;
    if (t > 0)
    v = valueAtTime(t) + rate*t*t;
    }
    v

    Dan

  • Marcelo Cabral

    September 6, 2011 at 8:53 pm

    Amazin!! thanks Dan this works really good.

  • Marcelo Cabral

    September 6, 2011 at 9:27 pm

    Thanks Dan I really appreciate your help. I have just one more question. How to modify this expression to bring a layer from out to the center of the escene.

    Thanks in advance

    Marcelo

  • Marcelo Cabral

    September 6, 2011 at 9:32 pm

    Is there some way to make this expression work with two marks? the first mark to get in the layer to the escene and a sedond mark to get it out off the escene. I will appreciate your help Dan.

    Thanks

  • Dan Ebberts

    September 7, 2011 at 3:07 pm

    This should bring an offscreen layer to the center at the first marker and send it back where it came from at the second marker:


    center = [thisComp.width,thisComp.height]/2;
    dur = .1;

    v = value;
    if (marker.numKeys > 1 && time > marker.key(2).time){
    t = time - marker.key(2).time;
    v = easeOut(t,0,dur,center,value);
    }else if (marker.numKeys > 0 && time > marker.key(1).time){
    t = time - marker.key(1).time;
    v = easeIn(t,0,dur,value,center);
    }
    v

    Dan

  • Marcelo Cabral

    September 7, 2011 at 4:19 pm

    Hi Dan
    this errors appers when I aply the expression in the position property of a simple 2d solid.

    AFTER EFFECTS WARNING
    Function Array is undefined
    Expression disabled.

    Erros occurred at line 10.
    Comp: “solid test”
    Layer:1 (“Red Solid 3”)
    Property: “position”

  • Marcelo Cabral

    September 7, 2011 at 4:34 pm

    Hi Dan
    I fix the problem but I need to make a deceleration (like a EASY EASE when it come to the center. How can I make it?

    Thank for your time Dan

    Best regards

Page 1 of 2

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