Expressions/Scripts/Presets

Moderators: Disciple, zlovatt

 
iProphet
Topic Author
Posts: 6
Joined: Sun Nov 19, 2017 3:55 pm

Source Text to Image Size

Sun Nov 19, 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: 19
Joined: Wed Aug 30, 2017 8:35 pm
Location: Detroit, Mi
Contact:

Re: Source Text to Image Size

Sun Nov 19, 2017 11:03 pm

You sure can. This is one way you might want to go about it.


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
Topic Author
Posts: 6
Joined: Sun Nov 19, 2017 3:55 pm

Re: Source Text to Image Size

Mon Nov 20, 2017 12:44 am

Thank you so much!
 
User avatar
CodingAe
Posts: 19
Joined: Wed Aug 30, 2017 8:35 pm
Location: Detroit, Mi
Contact:

Re: Source Text to Image Size

Mon Nov 20, 2017 10:58 am

I'm happy that you found it useful.

Who is online

Users browsing this forum: No registered users and 3 guests