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

SourceRectAtTime(keyTime, false) not updating?

Contributor ,
Mar 10, 2016 Mar 10, 2016

This is a pretty basic question. I have 1 text layer to which I added 2 keyframes on the scale property. I need to record its width and height at each key index. It is point text (although eventually I will need to figure out how to do this with box/allocated text as well).

so I have

if (layer.property("Scale").isTimeVarying){

     for (var i = 1; i <= layer.property("Scale").numKeys; i++){

          alert(layer.sourceRectAtTime(layer.property("Scale").keyTime(i), false).width);

     }

}

unless I'm missing something, if I have transformed the layer's scale between keyframes, I should be getting different values in my alerts, but I don't. Am I misunderstanding something about how sourceRectAtTime works, or is this something unique to text layers, or...?

TOPICS
Scripting
1.1K
Translate
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

Advocate , Mar 10, 2016 Mar 10, 2016

The result is always expressed in the (text) layer coordinates system. It is independant of the scale and other transform parameters.

If you need to get the result expressed in comp system, you'll need to find your way.

In CC2014 and later there is this useful method :  myLayer.sourcePointToComp(position_of_some_point_in_layer_system) which gives the result immediately.

Xavier

Translate
Advocate ,
Mar 10, 2016 Mar 10, 2016

The result is always expressed in the (text) layer coordinates system. It is independant of the scale and other transform parameters.

If you need to get the result expressed in comp system, you'll need to find your way.

In CC2014 and later there is this useful method :  myLayer.sourcePointToComp(position_of_some_point_in_layer_system) which gives the result immediately.

Xavier

Translate
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
Contributor ,
Mar 10, 2016 Mar 10, 2016
LATEST

Thanks for that. I remember seeing that as a new feature when CC 2015 came out but didn't compute at the time that I could extrapolate dimensions from it.

For what it's worth, what I ended up doing (for point and paragraph text) was taking the sourceRectAtTime/boxTextSize, storing the scale value of each keyframe, and

(layer source width or height * keyframed scale value) / 100

Translate
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