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

Expression controlling a keyframe

New Here ,
Apr 28, 2024 Apr 28, 2024

Copy link to clipboard

Copied

I have a graphic that i want to have an adaptive keyframe value depending on the amount of words in the textr field. i have been able to get the number of words and fix it to a variable but i am struggling to get it to link to a specific key frame.

 

Here is my current expression;

text.animator("Animator 1").selector("Range Selector 1").offset
wordsCount = thisComp.layer("Rolling Text").text.sourceText.split(/ ,| | \./).length;

key(2).value[1] = wordsCount;
TOPICS
Expressions

Views

226

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 ,
Apr 28, 2024 Apr 28, 2024

Copy link to clipboard

Copied

The key base value is read only. You can only change it or overwrite its value completely inside the expression. So it's either just wordsCount in the final statment or anything with key(2).value[1]+wordsCount. I have a hunch, though, that somehow you actually want to change the interpolation and linear() and valueAtTime() need to be involved, but it's not really clear what you are trying to do here.

 

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 ,
Apr 28, 2024 Apr 28, 2024

Copy link to clipboard

Copied

So I have an opacity animation that reveals word by word. I have charged the reveal from % to index so that there is always 1 word visible during the animation. This is because with % it wouldn't show single words until 50%. 

I want to make the project into a .mogrt file for use in premiere.  So for the animation I had 2 key frames one at the start with the index at 1 (for the first word always being visible) and a second one that would have number of words in the text field. So the end is always the max number of words that field currently has. This is instead of having a set value as the user of the .mogrt could put 1-6 words in and the set value wouldn't let the last word end on the second key frame. 

I'm hoping that it would be possible to grab the number of words from the text field and set it to the 2/final key frame so that the animation always starts on 1 and ends on the number of words in the text field. Hopefully making the final word no matter the amount to appear on the final key frame. 

 

I've tried my best to explain but if you need more I can try another 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 ,
Apr 28, 2024 Apr 28, 2024

Copy link to clipboard

Copied

Maybe like this:

t1 = key(1).time;
t2 = key(2).time;
n = text.sourceText.split(/ ,| | \./).length;
linear(time,t1,t2,1,n)

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 ,
Apr 28, 2024 Apr 28, 2024

Copy link to clipboard

Copied

LATEST

Thank you, that was the final piece of the puzzle and it worked!

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