Activity › Forums › Adobe After Effects › Set scale in pixels using expressions
-
Set scale in pixels using expressions
Posted by Jeremy Paul on August 21, 2017 at 12:49 pmYou can right click on a scale, hit Edit, and then enter scale in Pixels, inches , % of Comp, of source…. How can set the units using expressions?
They default to percentages of source (I think) which is somewhat limited.
Walter Soyka replied 9 years ago 3 Members · 4 Replies -
4 Replies
-
Jeremy Paul
August 21, 2017 at 9:11 pmNow position another layer to always be 20% taller than the text layer while text layer always being at the 66 percent of comp height regardless of the font family and size and number of letters, lines… Should I go on? ????I think pixels make things easier
-
Steve Bentley
August 22, 2017 at 2:14 amI think the problem is that scale is logarithmic or at the very least exponential. But I can see a use for pixels was well, but then it should be called width and height. Aren’t width and height parameters you can access in the expressions? (I’m not in front of the machine at the moment so I could be thinking of C4d’s scripting language).
-
Jeremy Paul
August 22, 2017 at 9:59 amYou can access them with sourceRectAtTime method. The problem is that accessing is all I managed to do. There is no setSourceRectAtTime for example. I tried setting scale as [“200px”, “100px”], but that returned an error
-
Walter Soyka
August 25, 2017 at 7:30 pm[Jeremy Paul] “They default to percentages of source (I think) which is somewhat limited.”
That’s correct. You’ll have to do the math to convert from your desired pixel size to scale percentage of original. Here’s an expression you can apply to a 2D scale property that lets you input in the scale in pixels directly into the scale property on the timeline without opening the dialog box:
[value[0]/sourceRectAtTime().width*100, value[1]/sourceRectAtTime().height*100]Walter Soyka
Designer & Mad Scientist at Keen Live [link]
Motion Graphics, Widescreen Events, Presentation Design, and Consulting
@keenlive | RenderBreak [blog] | Profile [LinkedIn]
Reply to this Discussion! Login or Sign Up