sourceRectAtTime on text layer crashes.
- June 4, 2021
- 1 reply
- 551 views
I have been getting many crashes using this expression and would love to figure out why. The expression measures the lenght of the text and if it exceeds a certain amount, splits the text into two and adds a line break in the middle. It seems to work fine but has been causin insta-crashes on my whenever I try to change anything on the text layer - font size, add a position text animator and start scrubbing, etc. Thanks in advance for any help.
I included all the different crashes that I received in the past hour while working on this project. Using OSX 11.3.1 and AE 18.2.0
The expression is:
maxWidth = 880;
layerWidth = thisLayer.sourceRectAtTime(time,false).width;
if(layerWidth > maxWidth){
layerText = value
words = layerText.split(" ") mid = Math.round(words.length / 2)
value = words.slice(0,mid).join(" ") + "\r" + words.slice(mid).join(" ") }
else{ value }
