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

size and position a solid to the animated words of an expression selector based on words

Explorer ,
Apr 29, 2023 Apr 29, 2023

Copy link to clipboard

Copied

i'm trying to have Words highlight with an effect applied to a solid, which is assigned to the text layer, as they are spoken in a paragraph. i'm was planning to be using markers to trigger when each Word is said with this: https://www.youtube.com/watch?v=diaCkKp5lpY


Something kind of close was discussed here:
https://community.adobe.com/t5/after-effects-discussions/text-range-selector-position-value-expressi...

but i'm working with a weird way of highlighting text with an expression selector and i think the text box remains the same width (sourceRectAtTime()).

TOPICS
Scripting

Views

2.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

correct answers 1 Correct answer

Community Expert , May 01, 2023 May 01, 2023

This is a better version that creates a tiny, off-screen mask when there's no text layer to proces (so the mask layer doesn't show up) and corrects a logic error:

pad = 10;
c = thisComp.layer("Scripture");
m = c.marker;
n = m.nearestKey(time).index;
if (time < m.key(n).time) n--;
if (n > 0 && n < index - c.index){
  L = thisComp.layer(c.index + n);
  r = L.sourceRectAtTime(time,false);
  ul = L.toComp([r.left,r.top]);
  ur = L.toComp([r.left+r.width,r.top]);
  lr = L.toComp([r.left+r.width,r.top
...

Votes

Translate

Translate
Explorer ,
Apr 30, 2023 Apr 30, 2023

Copy link to clipboard

Copied

it works if i use your original code to manually update every text layer

L = thisComp.layer("Text " + n);

so if there isn't a way to deal with anonomous incremental layers ...i could just get a renamer plugin like this one:
https://aescripts.com/ae-global-renamer/



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 30, 2023 Apr 30, 2023

Copy link to clipboard

Copied

OK, how about this. The expression will limit itself to layers that if finds between the "Scripture" marker layer and the layer that has the expression. So you'd have marker layer, text layers, then expression layer. The expression would look like this:

pad = 10;
c = thisComp.layer("Scripture");
m = c.marker;
n = m.nearestKey(time).index;
if (time < m.key(n).time) n--;
if (n > 0 && n < index){
L = thisComp.layer(c.index + n);
r = L.sourceRectAtTime(time,false);
ul = L.toComp([r.left,r.top]);
ur = L.toComp([r.left+r.width,r.top]);
lr = L.toComp([r.left+r.width,r.top+r.height]);
ll = L.toComp([r.left,r.top+r.height]);
p = [fromComp(ul)+[-pad,-pad], fromComp(ur)+[pad,-pad], fromComp(lr)+[pad,pad], fromComp(ll)+[-pad,pad]];
createPath(p,[],[],true);
}else
value

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 ,
May 01, 2023 May 01, 2023

Copy link to clipboard

Copied

LATEST

This is a better version that creates a tiny, off-screen mask when there's no text layer to proces (so the mask layer doesn't show up) and corrects a logic error:

pad = 10;
c = thisComp.layer("Scripture");
m = c.marker;
n = m.nearestKey(time).index;
if (time < m.key(n).time) n--;
if (n > 0 && n < index - c.index){
  L = thisComp.layer(c.index + n);
  r = L.sourceRectAtTime(time,false);
  ul = L.toComp([r.left,r.top]);
  ur = L.toComp([r.left+r.width,r.top]);
  lr = L.toComp([r.left+r.width,r.top+r.height]);
  ll = L.toComp([r.left,r.top+r.height]);
  p = [fromComp(ul)+[-pad,-pad], fromComp(ur)+[pad,-pad], fromComp(lr)+[pad,pad], fromComp(ll)+[-pad,pad]];
}else{
  p = [[-10,-10],[-9,-10],[-9,-9],[-10,-9]];
}
createPath(p,[],[],true);

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