HowToRecenterTextInClip.wick (2.2 KB)
Hi,
Is it possible to recenter a text in a clip after dynamically changing it via JS?
Please see the attached wick file. Visually, it merely looks like this:
It has a clip (myClip) that has a background, defining the background color, and a text (myText).
Initially, the text is well centered: OriginX and OriginY are set to 0 manually.
The text will be changed dynamically from Javascript. Then, if longer or shorter, it will get de-centered.
A sample code is provided in the Code layer.
I thought I would just need to reset originX and originY to 0 to recenter the text.
But from Javascript, .originX and .originY are undefined.
Since I have access to myClip.myText.x, I then thought a workaround could be to reposition it based on the text width:
myClip.myText.x = -myClip.myText.width/2
But .width is also undefined.
Any way to recenter the text?
Thank you.