Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Animate position the length of composition

  • Animate position the length of composition

    Posted by David Dodge on October 26, 2012 at 6:54 pm

    hello there,

    very new to expressions and I’ve been trying to figure this one out for a while now.

    ok, so I have a 1200×32 comp and I want to animate an image from one side of the screen to the other.

    Obviously I can easily do this with position keyframes, but its a templated comp and i want to be able to change the comp size and not have to adjust the keyframes to extend the entire length of the comp every time, so I’m thinking if i can write an expression that is based off the length of the comp i won’t need to rekeyframe every time.

    1. is this possible
    2. can you point me in the right direction/help me out if it is.

    I’d really like to understand how this works if you’re able to help me, thanks a lot.

    David Dodge replied 13 years, 10 months ago 2 Members · 3 Replies
  • 3 Replies
  • Dan Ebberts

    October 26, 2012 at 8:14 pm

    It’s hard to say if this is exactly what you want, but it might get you started. It will move a layer from the left side of the comp to the right side over the duration of the comp:

    p1 = [width/2,value[1]];
    p2 = [thisComp.width-width/2,value[1]];
    ease(time,0,thisComp.duration,p1,p2)

    Dan

  • David Dodge

    October 26, 2012 at 8:38 pm

    Dan,

    Very awesome, that helps so much, I wasn’t even close.

    I basically need this image I have to start off screen on the right and move across off screen to the left.

    I tried, messing with the script you provided and i got the timing like I need it but I still can’t seem to have it move off screen, it seems to only be moving a couple of pixels over, any idea on that?

    Thanks a ton, been trying to figure this out all day

  • David Dodge

    October 26, 2012 at 8:42 pm

    Actually nevermind, you set me down the exact path I needed to be your help is immensely appreciated.

    I went ahead and included the expression for anyone that is interested.

    You are awesome though Dan!

    p1 = [thisComp.width+100,value[1]];
    p2 = [thisComp.width-thisComp.width-100,value[1]];
    linear(time,0,1.40,p1,p2)

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