Skip to main content
Inspiring
April 29, 2024
Question

Calculation of the angle of the text and its transparency, under the influence of the animator

  • April 29, 2024
  • 3 replies
  • 1865 views

Hi, I want to calculate the angle of a text layer and its transparency when an animator acts on it. I would like to do this dynamically, using a script or expressions.


The bounding box calculation is not suitable because the animator does not change the angle of the layer. Its points are not movable.

I understand that there is no direct way, but perhaps someone has ideas on this matter?

 

 

This topic has been closed for replies.

3 replies

Mylenium
Legend
April 30, 2024

I think you misunderstand the problem. The data is not exposed anywhere and one would need to re-calculate it for every letter, word or whatever including the influences and cumulative values of each animator. This has nothing to do with the bounding box nor do the values necessarily linearly add up. You may be able to figure things out for a single animator, but as soon as you add a second one e.g. to add soem randomness to a fixed value, things get infinitely more complicated.

 

Mylenium

HarchenkoAuthor
Inspiring
April 30, 2024

We have opposite opinions because it seems to me that you are complicating the task. Anyway, thanks for sharing your thoughts.

Mylenium
Legend
April 30, 2024

That's probably a hopeless case. In order to know how each animator affects a letter or word you would need to figure in the fall-offs and associated settings, potential other factors and of course for the rendered glyphs themselves you would need to account for baseline shift, em box size, spacing etc. to figure out where a pixel of the text or for that matter even a line is and derive any further info from it to calculate an angle. Rinse and repeat for any other property you need to calculate the effective value of. I can see no easy way to do it. You would have to re-create everything inside of the expressions and this could end up with a hundred lines of extra code and things being very slow.

 

Mylenium

HarchenkoAuthor
Inspiring
April 30, 2024

I don't need to know how each animator affects, I need to get the angle of the layer taking into account these effects.

If there are many animators working on a layer, I don't need a lot of code to calculate its size in pixels, because there is a Bounding Box.

I'm guessing there is some kind of mathematical solution to do this.

After effects itself calculates the angle of the animators, I marked the points for this on the screenshot, but there is no API way to get their data

 



Community Expert
April 29, 2024

A text animator will not rotate the entire line. You need to animate the Layer/Transform/Rotation property to rotate an entire word or line. This expression ties the Transform/Rotation property to the Transform/Opacity property, and you'll start seeing the layer when it rotates from -30º to horizontal:

 

r = transform.rotation;
linear(r, -30, 0, 0, 100);

 

If you want to tie the Layer/Animator/Rotation property to the layer Transorm/Opacity property to the text defined in the Advanced section of the Range Selector/Range options, add Opacity to the Layer/Animator and apply this expression to Layer/Animator 1/Opacity:

 

t = text.animator("Animator 1").selector("Range Selector 1").start
linear(t, 0, 100, 0, 100)

 

 

HarchenkoAuthor
Inspiring
April 29, 2024

Hi, I appreciate your response. But it has nothing to do with my question

HarchenkoAuthor
Inspiring
April 29, 2024

Those expressions will calculate the angle and make a move. If you want the angle from a layer's Animator's rotation property and also reveal the opacity value, add a text layer and add this expression to the source text. 

 

ref = thisComp.layer(index +1);
r = ref.rotation;
Arot = -ref.text.animator("Animator 1").selector("Range Selector 1").start *.01 * ref.text.animator("Animator 1").property.rotation;
tA = Arot.toFixed(2);
OPas = ref.opacity;
"Text Layter Properties" + "\r" +
"Rotation: " + r + "º" + "\r" +
"Animator Rotation: " + tA + "º" + "\r" +
"Opacity: " + OPas + "%";

 

You get this:

You could also base the calculations on time and corner points of the text layer by using sourceRectAtTime(), setting different time values, and calculating the positions of the top-left corner vs the height and width over time.

 

It would help if you told us what you were trying to do.

 

 


Sorry, but you don't understand what I need: when the animator acts on a layer, it does not change the rotation of the layer.

I need to get the tilt angle of a text layer when a text animator acts on it.

The layer properties are not used there. Animator is an Expression Selector that does not return any values,
even if it’s not him, but the other 5 animators, and I want to get an inclination from the influence of the animators.

The animation is moving, the tilt is always changing, I don't need a static value.  Layer properties are not used.