Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Forums Adobe After Effects Expressions Linking value to specific keyframes

  • Linking value to specific keyframes

  • Jac George

    April 23, 2020 at 2:56 am

    Hi there,
    I’m trying to animate a text layer in after effects to produce a mogrt template. I have added a position text animator to move the text y value over time. I have 4 keyframes. I want keyframes 1 and 4 to have the value of [0, temp] and keyframes 2 and 3 to have the value of [0,0].
    At the moment the expression I’m using is working but all keyframes have value [0, temp] is it possible to instruct particular keyframes (in this case keyframes 2 and 3) to have the value of [0,0]?
    I have another text layer that will be the reverse animation where keyframes 1 and 4 will be value [0,0] and keyframes 2 and 3 will be value [0, temp].

    Any help on this is hugely appreciated, I hope I’ve explained it so it makes sense ???? I’m not a coder I just figure it out a bit as I develop Mogrts in AE.
    thanks. Here is the expression I have so far on the text position animator:

    temp = thisComp.layer("Reveal Text Box").content("Rectangle Path 1").size[1];
    [0, temp]

  • Dan Ebberts

    April 23, 2020 at 6:43 pm

    It depends. What’s happening between the keyframes? Is there any easing going on?

    Dan

  • Jac George

    April 23, 2020 at 7:12 pm

    Hi Dan,
    Thanks. At the moment there’s no easing on any keyframes, I left it out as I thought it would complicate further, but ideally the animation would ease into keyframe 2 and ease out of keyframe 3. Keyframes 1 and 4 don’t need easing as they are opacity of 0 at the start and end frames in the comp.
    thanks

  • Dan Ebberts

    April 23, 2020 at 7:28 pm

    I guess something like this could work:


    temp = thisComp.layer("Reveal Text Box").content("Rectangle Path 1").size[1];
    if (time < key(1).time)
    [0, temp]
    else if (time < key(2).time)
    easeOut(time,key(1).time,key(2).time,[0,temp],[0,0])
    else
    easeIn(time,key(3).time,key(4).time,[00],[0,temp]);

    Dan

  • Jac George

    April 23, 2020 at 7:46 pm

    OMG thanks it works perfectly.
    can a variation of that work for my second text layer which does the reverse of that? not sure if it makes a difference that the ease is applied to the keyframes with [0, temp] as opposed to [0,0]?
    Keyframe 1 will be [0,0]
    ease into keyframe 2 [0, temp]
    ease out of keyframe 3 [0, temp]
    Keyframe 4 will be [0,0]

    thanks

  • Dan Ebberts

    April 23, 2020 at 7:51 pm

    That would be like this:


    temp = thisComp.layer("Reveal Text Box").content("Rectangle 1").content("Rectangle Path 1").size[1]
    if (time < key(1).time)
    [0, 0]
    else if (time < key(2).time)
    easeOut(time,key(1).time,key(2).time,[0,0],[0,temp])
    else
    easeIn(time,key(3).time,key(4).time,[0,temp],[0,0]);

    Also, the previous version has a typo in it. The last line should have been like this:

    easeIn(time,key(3).time,key(4).time,[0,0],[0,temp]);

    Dan

  • Jac George

    April 23, 2020 at 8:03 pm

    thank you so much!
    Jac

  • Dan Ebberts

    April 23, 2020 at 8:26 pm

    I rushing through it, I made the code more complicated than necessary. This should work for the first version:


    temp = thisComp.layer("Reveal Text Box").content("Rectangle Path 1").size[1];
    if (time < key(2).time)
    easeOut(time,key(1).time,key(2).time,[0,temp],[0,0])
    else
    easeIn(time,key(3).time,key(4).time,[0,0],[0,temp]);

    and the second:


    temp = thisComp.layer("Reveal Text Box").content("Rectangle Path 1").size[1];
    if (time < key(2).time)
    easeOut(time,key(1).time,key(2).time,[0,0],[0,temp])
    else
    easeIn(time,key(3).time,key(4).time,[0,temp],[0,0]);

    Dan

  • Jac George

    April 23, 2020 at 8:57 pm

    thank you so much for your help, I wasn’t even sure if it would be possible to instruct individual keyframes like that! 😉

Viewing 1 - 9 of 9 posts

Log in to reply.

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