sourceRectAtTime and text animation unsync

Engaged ,
Nov 20, 2019 Nov 20, 2019

Copy link to clipboard

Copied

I have a setup where a Rectangle Shape size animates according to a text Animator. The text animates in by animating a Range Selector applied to the Scale property (which is set to 0).

 

This all works well, until I try to move the text layer in time: when the text layer starts later in time, the Shape Layer, still takes the sourceRectAtTime().width as if the text layer was still starting at 00:00:00, resulting in a non sync, and therefore a useless animation.

 

Another strange behavior: when dragging the 'End' value of the Range Selector manually, the Shape follows along, no matter what moment in time. But as soon as it is driven by keyframes or expressions, the unsyncness happens.

 

Does somebody know how to force sourceRectAtTime() to always sample the size of a text layer at the current Composition time?

 

Update: I found that when only the inPoint of the text layer is dragged/trimmed, the expression gets confused. Moving the layer, and then adjust the outPoint to make the duration shorter, keeps the expression working correctly. How can we work around this, to be more flexible?

TOPICS
Expressions

Views

1.2K

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 2 Correct answers

Adobe Community Professional , Nov 20, 2019 Nov 20, 2019

I was actually a little surprised to dig into this myself, but maybe a better way to think of this function is "sourceRectAt *MY* Time."

There's one little addition you could do here that will get you the functionality you're after (and a hat tip to Paul Conigliaro for pointing this out to me):
sourceTime()

 

Give this (or whatever variant is appropriate for your use case) a shot, and you should be in business.

var layer = thisComp.layer("some words");
var rect = layer.sourceRectAtTime(layer.source

...

Likes

Translate

Translate
Engaged , Nov 21, 2019 Nov 21, 2019

Last night,  Adobe reached out to me with the same anwer as given by Kyle Hamrick.

The secret is that there is a sourceTime for a Text Layer. I wasn’t aware that AE treats text as footage with it's own time.

 

var targetLayer = thisComp.layer("Target Text Layer");

var targetRect = targetLayer.sourceRectAtTime( targetLayer.sourceTime() );

 

[ targetRect.width, targetRect.height ]; // Outputs dimensions for rectangle

Likes

Translate

Translate
Adobe Community Professional ,
Nov 20, 2019 Nov 20, 2019

Copy link to clipboard

Copied

Nothing stops you from filling in an explicit time statement in the parenthesis, including any statements that may account for shifting in- and out-points or keyframes, e.g. (time-inPoint).

 

Mylenium

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Nov 20, 2019 Nov 20, 2019

Copy link to clipboard

Copied

Yeah, that was my workaround, but for some reason it did not work in all situations:

When a Text Layer is trimmed on the left side, the inPoint trick doesn't work anymore.

Thanks anyway!

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Nov 20, 2019 Nov 20, 2019

Copy link to clipboard

Copied

I was actually a little surprised to dig into this myself, but maybe a better way to think of this function is "sourceRectAt *MY* Time."

There's one little addition you could do here that will get you the functionality you're after (and a hat tip to Paul Conigliaro for pointing this out to me):
sourceTime()

 

Give this (or whatever variant is appropriate for your use case) a shot, and you should be in business.

var layer = thisComp.layer("some words");
var rect = layer.sourceRectAtTime(layer.sourceTime());
var x = rect.width;
var y = rect.height;

[x,y]

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Nov 21, 2019 Nov 21, 2019

Copy link to clipboard

Copied

Thanks - that's it! Did not find this solution anywhere.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jul 15, 2022 Jul 15, 2022

Copy link to clipboard

Copied

LATEST

I've come from the future to thank you for this insight. I had no idea text layers were considered footage with sources. The sourceTime(time) function seems similar in basic use to toWorld(position), and saved me when using markers for mask and text animators.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Nov 21, 2019 Nov 21, 2019

Copy link to clipboard

Copied

Last night,  Adobe reached out to me with the same anwer as given by Kyle Hamrick.

The secret is that there is a sourceTime for a Text Layer. I wasn’t aware that AE treats text as footage with it's own time.

 

var targetLayer = thisComp.layer("Target Text Layer");

var targetRect = targetLayer.sourceRectAtTime( targetLayer.sourceTime() );

 

[ targetRect.width, targetRect.height ]; // Outputs dimensions for rectangle

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines