So, expressions in After Effects allow you to tie the values of one object's animation to another, such as a percent meter bar correlating to a hidden number value from 1 to 100 (see image attached, Adjustment Layer 1).

What I'm trying to accomplish is somehow tie the level of pixelation of the image (using Mosaic, more than likely) to a changing value.

Anyone know the proper math formula to write this out? First, how do I add an expression to a Mosaic effect's horizontal and vertical blocks values?

To be clear, 0 is 0% image compression, and 100 is 100% compression. I've worked out the slider and its changing values, just not the pixellation of the image.

Adjustment Layer 1 affects other layers tied to it with an Expression

1 Answer 1


OK, I've figured it out. First, alt+click on the stopwatch icon next to the layer's value you want to add an expression – in my case, the level of Mosaic horiztonal blocks and level of vertical blocks. I added an additional adjustment layer, and change the values to go from 100 to 0 with new keyframes, instead of 0 to 100. The higher the number of blocks, the less pixellated the image appears.

Next, the expression is manipulated as follows:

Math.round(thisComp.layer("Adjustment Layer 2").effect("Slider Control")("Slider"))*5

What's happening here is the math is rounded to an integer (no decimals values), and correlates to Adjustment Layer 2's slider control values. Since 100 blocks is still very pixellated, I multiplied the value by 5 to appear more in focus. I hope this helps someone out there! :)

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.