ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

.sourceRectAtTime in combination with keyframes

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Frank Bemthuis
.sourceRectAtTime in combination with keyframes
on Feb 26, 2019 at 10:32:35 am

Hi great expressionists (pun intended),
When having a lower third with a box that has to react to the text + some padding, how can I use the .sourceRectAtTime on only the keyframe's I want?

Let's say I want to animate in the lower box from "nothing" (keyframe 1) to full/the length of text + padding (keyframe 2), and back from that (keyframe 3) to "nothing" (keyframe 4) again?

How can I script that?
If someone can give me the go-to expression + some explanation, I would be very thankful ☺

What I now have is just a simple .sourceRectAtTime with some padding (ofcourse, I want to keep the padding):

title = thisComp.layer("FUNCTION_txt").sourceRectAtTime();
[title.width + 26, title.height + 45]

Return to posts index

Tomas Bumbulevičius
Re: .sourceRectAtTime in combination with keyframes
on Mar 2, 2019 at 1:05:21 pm

Hey Frank,

could you clarify the following:
1. What should happen to text when you animate the box?
2. What box animation you want to apply and for which transformation property?

This will help to understand what you are trying to achieve fully.


Find out more:
After Effects Tutorials: motion design, expressions, scripting.

Return to posts index

Anders Hattne
Re: .sourceRectAtTime in combination with keyframes
on Mar 2, 2019 at 6:11:27 pm

You'd have to change this around.. but could something like this work for you?

title =thisComp.layer("txt").sourceRectAtTime();
k1 =thisComp.layer("txt").transform.scale.key(1);
k2 =thisComp.layer("txt").transform.scale.key(2);

paddingX= linear(thisComp.layer("txt").transform.scale[0], k1[0], k2[0], 0, 26);
paddingY= linear(thisComp.layer("txt").transform.scale[1], k1[1], k2[1], 0, 45);

[title.width + paddingX, title.height + paddingY]

Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2019 All Rights Reserved