• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

sourceRectAtTime() expression to change key-framed position of solid based on text layer width

New Here ,
Dec 28, 2016 Dec 28, 2016

Copy link to clipboard

Copied

Hello,

I am making a series of fully-customizable lower-thirds, that automatically scale / change based on the width of any given text layer. I have had success with linking the width of a shape layer to the width of a text layer using the following expression:

s=thisComp.layer("FIRST NAME")

x=s.sourceRectAtTime(time-s.inPoint,true).width;

[x, value[1]]

I also have a position expression linked to the size.

content("Rectangle 1").content("Rectangle Path 1").size/2

Here is my question:

If I want to link a key-framed "end position" of a shape layer to the width of a text layer, how would I go about that? Below is a video of my current animation. A square rolls in then splits in two to reveal text. I want the right half of the square to automatically animate further away based on the width of the text layer. My goal is to make this as user-friendly as possible, so even an 'After Effects Novice' can edit and export!

The shape layer in question has key-framed animation on both the x-scale, and the x-position. The keyframes are eased and velocity adjusted as below.

keyframe velocity.JPG

I do realize that I'll also have to write an expression to scale the Alpha Matte in relation to the width of the text layer (which should be similar to my first expression at the top), but that's nothing I can't handle.

Please Help!!!

TOPICS
Expressions

Views

11.2K

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
LEGEND ,
Dec 29, 2016 Dec 29, 2016

Copy link to clipboard

Copied

Playing it simple won't work, I'm afraid. You have to put up with valueAtTime() and keyframe methods since basically you want a prototype animation to have different timing and use different values. It's complicated and will require lots of extra safeties built-in to make this "novice friendly", equaliing lots of lines of code.

Mylenium

Votes

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
New Here ,
Dec 29, 2016 Dec 29, 2016

Copy link to clipboard

Copied

Thanks for the info! Here is an alternate version that I made that does work using .sourceRectAtTime() .

It's not quite the same since it doesn't split from the middle, but it does accomplish the end goal! I'll keep researching to see if I can work it out like I originally wanted. Basically, I created a rectangle that was as large as I wanted the end extents to be, then animated the scale from 0 to 100, duplicated that shape layer, and converted it to an alpha inverted mask, then modified the position and width (in the expression). (The square rotating in is a separate layer.)

Rectangle:

s=thisComp.layer("Your Name Here")

x=s.sourceRectAtTime(time-s.inPoint,true).width+82;

[x, value[1]]

Mask:

s=thisComp.layer("Your Name Here")

x=s.sourceRectAtTime(time-s.inPoint,true).width+29;

[x, value[1]]

Votes

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
New Here ,
Jan 25, 2022 Jan 25, 2022

Copy link to clipboard

Copied

LATEST

Hi @Mylenium Where would be the best place(s) to look for comprehensive resources on this learning path?

 

I see you come up a bunch on these forums for questions related to my problems! Any help would be greatly appreciated.

 

Thanks

C.

Votes

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