x = thisComp.layer(“Gradient”).sampleImage(transform.position, [.5,.5]/2, true, time)[0]; 100*[x,x]
Values in the square brackets [.5,.5] control “search radius” for your expression. Smaller values, more precision, but more resource intensive. Maybe try bumping them up to higher value?
Less heavy approach would be to pre-render your layer that you use for the scale animation as ProRes. Then bring it back into AE to reduce amount of calculations software needs to do?
In the past I used similar sampleImage approach for a project and it was really hard to pull off. AE would grind to a halt on a powerful machine. This expression is really intensive. Have you tried creating animation by using a plugin