Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Linear expression linked to keyframes in another comp

  • Linear expression linked to keyframes in another comp

    Posted by David Cabestany on November 13, 2023 at 6:53 pm

    I need to link a linear expression to the 3rd and 4th keyframes of a property on a different comp. the layer where the linear will be applied is nested in the comp that has the layer with the keyframes.

    I have successfully done this in the past, but this now it’s not working, returning an error that says that ctrl.valueAtTime is not a function. ctrl is the name of a variable that contains the layer with the keyframes, as you can see below:

    c=comp("expertAssist_After");
    ctrl=c.layer("NULL CONTROL").transform.position[1];
    l=c.layer(thisComp.name);
    x=ctrl.valueAtTime(time+l.startTime);
    k3=c.layer("NULL CONTROL").transform.position.key(3).value[1];
    k4=c.layer("NULL CONTROL").transform.position.key(4).value[1];
    linear(x,k3,k4,0,100)

    This is an old expression and I don’t know if it’s broken because of the javascript engine vs legacy ExtendScript, it does not work on neither.

    Any help is greatly appreciated.

    David Cabestany replied 6 months, 1 week ago 2 Members · 6 Replies
  • 6 Replies
  • Dan Ebberts

    November 13, 2023 at 6:58 pm

    I haven’t tested it, but try it this way:

    c=comp("expertAssist_After");
    ctrl=c.layer("NULL CONTROL").transform.position;
    l=c.layer(thisComp.name);
    x=ctrl.valueAtTime(time+l.startTime)[1];
    k3=ctrl.key(3).value[1];
    k4=ctrl.key(4).value[1];
    linear(x,k3,k4,0,100)
  • David Cabestany

    November 13, 2023 at 7:20 pm

    Hey Dan, thanks for your help.

    The expression error went away but it still does not work, it just not showing an error anymore. The value is stuck at 0%.

    Thanks,

  • Dan Ebberts

    November 13, 2023 at 8:10 pm

    It seems to work for me, but I have no idea if my setup is anything like yours…

  • David Cabestany

    November 13, 2023 at 8:33 pm

    I dont have anything out of the ordinary, I’m running 2023.6.0 and I’m using JavaScript for the expressions engine.

    If it’s a possibility, I’d be happy (and very grateful) to share a project for you to look at.

  • Dan Ebberts

    November 13, 2023 at 8:42 pm

    Sure.

  • David Cabestany

    November 13, 2023 at 9:00 pm

    Awesome, thank you so much. I sent it to you a minute ago by email.

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