ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Expression that auto fits placeholder to comp.

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Finn Hitchcock
Expression that auto fits placeholder to comp.
on Mar 29, 2020 at 12:25:35 pm

Hi!

Could anyone help me out with an expression that auto fits a placeholder to comp when the footage changes. It can be either width or height as it's square.

Thanks in advance!


Return to posts index

Evan Jenkins
Re: Expression that auto fits placeholder to comp.
on Mar 29, 2020 at 6:25:40 pm

Yes go to the scale property of your placeholder and add an expression.

lw = thisLayer.width;
lh = thisLayer.height;
cw = thisComp.width;
ch = thisComp.height;
x = 100;
y = 100;

aRC = cw/ch;
arL = lw/lh;

if(arL > aRC){
x = cw/lw*100;
y = x
}else {
y = ch/lh*100;
x = y
}

[x,y]


Evan Jenkins
Aspen Films Inc.
aspenfilms.ca


Return to posts index

Tomas Bumbulevičius
Re: Expression that auto fits placeholder to comp.
on Apr 4, 2020 at 9:37:12 am

Hey Finn, Evan's response above is spot on. In case you want to learn more about this with reasons behind, you can check my tutorial here:






Find out more:
Motion Graphics Design & After Effects Tutorials
On YT
On VH


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2020 CreativeCOW.net All Rights Reserved
[TOP]