ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Linking value to specific keyframes

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Jac George
Linking value to specific keyframes
on Apr 23, 2020 at 2:56:28 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]


Return to posts index

Dan Ebberts
Re: Linking value to specific keyframes
on Apr 23, 2020 at 6:43:43 pm

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

Dan



Return to posts index

Jac George
Re: Linking value to specific keyframes
on Apr 23, 2020 at 7:12:54 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


Return to posts index


Dan Ebberts
Re: Linking value to specific keyframes
on Apr 23, 2020 at 7:28:05 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



Return to posts index

Jac George
Re: Linking value to specific keyframes
on Apr 23, 2020 at 7:46:35 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


Return to posts index

Dan Ebberts
Re: Linking value to specific keyframes
on Apr 23, 2020 at 7:51:50 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



Return to posts index


Jac George
Re: Linking value to specific keyframes
on Apr 23, 2020 at 8:03:20 pm

thank you so much!
Jac


Return to posts index

Dan Ebberts
Re: Linking value to specific keyframes
on Apr 23, 2020 at 8:26:50 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



Return to posts index

Jac George
Re: Linking value to specific keyframes
on Apr 23, 2020 at 8:57:25 pm

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


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2020 CreativeCOW.net All Rights Reserved
[TOP]