content area
content area
content area
content area

CSS Cover Behaviour in After Effects

About

Mirrors the cover behaviour from CSS in After Effects. Applied expressions on scale and position parameters make the layer cover parents bounding box. Don't forget to parent!

Preview

IMG layer: position

-- CODE language-js -- // Target Bounding Box pBB = parent.sourceRectAtTime(time,true) pW = pBB.width; pH = pBB.height; pL = pBB.left; pT = pBB.top; [pL+pW/2,pT+pH/2];

IMG layer: scale

-- CODE language-js -- // Target Bounding Box pBB = parent.sourceRectAtTime(time,true); pW = pBB.width; pH = pBB.height; // Layer Bounding Box lBB = thisLayer.sourceRectAtTime(time,true); lW = lBB.width; lH = lBB.height; // IMG AspectRatio aR = thisLayer.width/thisLayer.height; if(pW/pH>=aR) { [pW/lW,pW/lW]*100 } else { [pH/lH,pH/lH]*100 }