Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Suggestions for Auto-orientation (In/Out)

  • Suggestions for Auto-orientation (In/Out)

    Posted by Mira Etler on December 14, 2007 at 9:18 pm

    Hi there,

    I’m just trying to figure out a way to define a lag time with expressions while accounting for AE looking for data (before the first and after the last) around Roving Keyframes.

    My example:
    I have a source layer with roving positional keyframes that I am auto-orienting my source to.

    What I attempted was to have the expression layer (follower) do something like:

    offset = 0.2;
    tpos = time-offset;
    firstTime = 0;
    lastTime = 6;
    spos = thisComp.layer(“leader”).transform.position;
    spos.valueAtTime(tpos); //end line

    But the problem is that outside of the roved keyframes, I get no data- So I tried an [if] statement like:

    if(timelastTime){
    tpos = lastTime;
    }else{
    tpos = time-offset;
    }
    }

    spos.valueAtTime(tpos); //new end line

    Filip Vandueren replied 18 years, 5 months ago 4 Members · 6 Replies
  • 6 Replies
  • Mike Clasby

    December 16, 2007 at 1:42 am

    I don’t quite get what you’re trying to do, and I doubt that roving keyframes would make any difference… but…

    Have you seen this page by Dan for creating trails?

    https://www.motionscript.com/mastering-expressions/follow-the-leader.html

    Does this stuff help?

  • Mira Etler

    December 17, 2007 at 6:58 am

    AFAIK, Dan’s page (which I have viewed) doesn’t address this type of issue that I’m mentioning.

    If you set a specific negative offset for the current layer (holding the expression) to grab from and there is no positional data at that time-location, then AE simply gives you the position for the current layer before the expression was applied which in this case is nothing.

    I’ll try to look at Dan’s page in more detail and see if I can’t solve it that way, but the example that I posted seems to demonstrate the prob, no?

    thanks,
    f

  • Mira Etler

    December 17, 2007 at 7:04 am

    Let me also clarify something else:
    I am getting *exactly* what I want otherwise…
    Just trying to get the layer with an expression on it (the follower that’s looking at the leader layer) to auto-orient within the window time (before the offset kicks in- the layer has to go that amount of keyframes in before picking up data at the beginning of the leader’s positional motion) that there’s no

    …I’m thinking an IF statement is the only way to do it and that I simply haven’t refined my IF statement well enough yet.

    Thanks,
    f

  • Dan Ebberts

    December 17, 2007 at 3:15 pm

    If all need is to make sure tpos doesn’t go outside the range defined by firstTime and lastTime, you could do it like this:

    tpos = clamp(time-offset,firstTime,lastTime);

    Dan

  • Mira Etler

    December 18, 2007 at 9:35 pm

    Excellent.

    Thanks, Dan; exactly what I was looking for.

    f

  • Filip Vandueren

    December 19, 2007 at 1:07 am

    You can’t rely on having “auto-orient to path” enabled on the following layers, because it’s path is based on an expression, so when the leader stops moving, the follower reverts to rotation=0

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