I have a shape that varies in height, and an image that varies in height.

I would like the image height to be the same height as the shape at all times.

I got as far as this, but none of my math seems to be making the image the same height as the bar constantly.

kyronnb = thisComp.layer("Kyron BG").sourceRectAtTime();

syz = 100 * thisLayer.height/thisComp.height - 100; 
kper = 100 * kyronnb.height/thisComp.height;

sizeW = kper - syz;

[sizeW, sizeW]

1 Answer 1


I assume "Kyron BG" is the shape layer and thisLayer is the image layer and you're applying the expression on the scaling of the image layer. Then this should work:

kyronnb = thisComp.layer("Kyron BG").sourceRectAtTime();
scaleFactor = kyronnb.height/thisLayer.height*100;
[scaleFactor, scaleFactor]
  • Wow, thanks! So simple.
    – Picard102
    Jun 22, 2021 at 19:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.