Activity › Forums › Adobe After Effects › Exprssion to scale layer to pixel size
-
Exprssion to scale layer to pixel size
Posted by Riccardo Sinti on October 6, 2015 at 4:43 pmI have hundreds layers of differing sizes.
I need an expression that will scale the layer to a specific size, say
60px by 40px.
Thanks!Riccardo Sinti replied 10 years, 7 months ago 3 Members · 4 Replies -
4 Replies
-
Walter Soyka
October 6, 2015 at 4:59 pm// set target dimensions in pixels
targetX = 60;
targetY = 40;[targetX/width*100, targetY/height*100]
Walter Soyka
Designer & Mad Scientist at Keen Live [link]
Motion Graphics, Widescreen Events, Presentation Design, and Consulting
@keenlive | RenderBreak [blog] | Profile [LinkedIn] -
Kalleheikki Kannisto
October 6, 2015 at 5:01 pmThe code for scale would be:
rect=sourceRectAtTime(time, false);
rw = rect.width;
rh = rect.height;
finalWidth=60;
finalHeight=40;
[finalWidth/rw*100, finalHeight/rh*100]You can replace the finalWidth and finalHeight settings with a slider if you want to be able to change them.
The scaling is not proportional with this expression, it will force the layers to be that size regardless of original dimensions. Layers will scale around their origin points.
You can put this expression into one layer scale property then copy and paste to all other layers.
-
Walter Soyka
October 6, 2015 at 5:11 pmKalle’s is better than mine. Mine won’t work on vector/text layers, but his will.
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