Source Text to Image Size

Moderators: Disciple, zlovatt

Post Reply
iProphet
Posts: 6
Joined: November 19th, 2017, 3:55 pm

November 19th, 2017, 4:00 pm

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?
User avatar
CodingAe
Posts: 20
Joined: August 30th, 2017, 8:35 pm
Location: Detroit, Mi
Contact:

November 19th, 2017, 11:03 pm

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.
iProphet
Posts: 6
Joined: November 19th, 2017, 3:55 pm

November 20th, 2017, 12:44 am

Thank you so much!
User avatar
CodingAe
Posts: 20
Joined: August 30th, 2017, 8:35 pm
Location: Detroit, Mi
Contact:

November 20th, 2017, 10:58 am

I'm happy that you found it useful.
Post Reply