Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Position over time relative to width of comp

  • Position over time relative to width of comp

    Posted by David Lennox on April 22, 2013 at 12:06 pm

    Hello

    I’m trying to find an expression that will control the position of a layer over the time of the comp relative to the width of the comp.

    So move layer from x=0 to x =100% the width of the comp over the length/time of the comp.

    I looked into thisComp.width and thisComp.duration but keep hitting dead ends. Any help appreciated, thanks.

    Lukasz Pason replied 11 years, 1 month ago 4 Members · 3 Replies
  • 3 Replies
  • Mitch Mann

    April 23, 2013 at 1:54 pm

    After separating dimensions for your X & Y, here’s your X expression:

    myCompWidth = thisComp.width;
    myCompDuration = thisComp.duration;
    myCurrentTime = time;
    myPercentageIntoComp = myCurrentTime/myCompDuration;
    myResult = myCompWidth * myPercentageIntoComp;

  • Kevin Camp

    April 24, 2013 at 4:18 pm

    i often use linear() to translate between unlike values like these… in this case time to position…

    x = linear(time, 0, thisComp.duration, 0, thisComp.width);
    [x, value[1]]

    Kevin Camp
    Senior Designer
    KCPQ, KMYQ & KRCW

  • Lukasz Pason

    March 27, 2015 at 6:13 pm

    In case you need to clamp you can do this.

    start = effect("start")("Slider");
    end = effect("end")("Slider");
    cTime = linear(time, 0, thisComp.duration, 0, thisComp.width);
    x = clamp(cTime, start, end);
    x

    Motion Designer / DJ / Father
    http://www.lukaszpason.com
    http://www.krop.com/lukasz

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