Page 1 of 1

Source Text to Image Size

Posted: November 19th, 2017, 4:00 pm
by iProphet
I want to create a Text Layer that controls Image Size, I want so that the user can type the desired number in the text layer and it would reflect on the scale property.
I want the numbers to be relative to the max size of 1920x1080 being equal to 100% and 0% being equal to 0x0, I'm having trouble getting the source text to only write numbers then the relativity of the numbers to %.

Is this possible at all?

Re: Source Text to Image Size

Posted: November 19th, 2017, 11:03 pm
by CodingAe
You sure can. This is one way you might want to go about it.

Code: Select all

var temp = thisComp.layer("text").text.sourceText; // Pick whip sourceText from the text layer you want to use
var num = Number(temp); // Number is a method that allows you to parse/convert a value to a number data type
[num, num] // Return the variable that you use to convert the sourceText in a two item array and this will return give you a relative size
I hope this helps.

Re: Source Text to Image Size

Posted: November 20th, 2017, 12:44 am
by iProphet
Thank you so much!

Re: Source Text to Image Size

Posted: November 20th, 2017, 10:58 am
by CodingAe
I'm happy that you found it useful.