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

Text Track expression

Community Beginner ,
Oct 17, 2023 Oct 17, 2023

Copy link to clipboard

Copied

Screenshot 2023-10-17 at 3.06.50 p.m..png

 

Screenshot 2023-10-17 at 3.07.31 p.m..png

I'm not sure if someone has already posted this issue, but I have the following situation: I have two text layers, text 1 and text 2. Text 1 will have the number of days, and text 2 only says 'days ago.' I want to use an expression so that as the number increases, it shifts to the left and doesn't overlap. In this example, I'm changing the values from a SourceText in Essentials Graphics.

 

Screenshot 2023-10-17 at 3.07.47 p.m..png

So, I used this expression, and it creates the desired shift, but the issue is that it animates the shift. I want the shift to occur directly from the SourceText in Essentials Graphics, and I want to be able to adjust the shift because I'll make it very large.

// Get the width of the text
w = thisLayer.sourceRectAtTime().width;

// Get the value from the source text
t = parseInt(thisLayer.text.sourceText);

// Define initial and final values for the number
start = 0;
end = 1;

// Define a duration for the animation in seconds
duration = 2;

// Calculate the text offset based on time
offset = linear(time, 0, duration, start * w, end * w);

// Return the original position minus the offset
value - [offset, 0];

the video of the expression running

TOPICS
Expressions , FAQ , How to , Scripting

Views

762

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 1 Correct answer

Community Expert , Oct 17, 2023 Oct 17, 2023

Why not just make the number right-justified? 

Votes

Translate

Translate
Community Expert ,
Oct 17, 2023 Oct 17, 2023

Copy link to clipboard

Copied

Why not just make the number right-justified? 

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
Community Beginner ,
Oct 17, 2023 Oct 17, 2023

Copy link to clipboard

Copied

My goodness, It worked hahhaha! I'm so embarrassed. Thank you very much. I guess I overcomplicated something so simple.

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
Community Expert ,
Oct 18, 2023 Oct 18, 2023

Copy link to clipboard

Copied

In these situations, my extension Pins & Boxes is also very helpful.

If you want the "d ago" to move to the right, when the number grows, you could just create a pin for the right edge of the number layer and then parent the "d ago" text to it.

In this example, the small text is parented to the pin at the lower right corner of the bigger text:

pins-optimized

 

Mathias Möhl - Developer of tools like BeatEdit and Automation Blocks for Premiere Pro and After Effects

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
Community Beginner ,
Feb 18, 2024 Feb 18, 2024

Copy link to clipboard

Copied

Good. Is there a non have to pay way?

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
Community Expert ,
Feb 18, 2024 Feb 18, 2024

Copy link to clipboard

Copied

LATEST

Pins & Boxes creates expressions. In principle, you can create all expressions yourself, but it is much more work then relying on the tool.

Mathias Möhl - Developer of tools like BeatEdit and Automation Blocks for Premiere Pro and After Effects

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