Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Exprssion to scale layer to pixel size

  • 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 pm

    The 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 pm

    Kalle’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]

  • Riccardo Sinti

    October 7, 2015 at 8:48 pm

    Thank you both!

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy