-
color sample size/possition
Greetings, I want to make an interactive background consisting of a grid of square, animated PreComps animating away as something passes over them.
To do that I’ve decided to make a matte and measure lightness under each of the squares and with the value it gives me remap its time.My comp is divided to 9×5 squers 220x220px each.
To measure their lightness I use 45 slider controllers with this expression:
sampleSize = [220,220];
target = thisComp.layer("matte");
samplePos = [0,0];
rgb = target.sampleImage(samplePos, sampleSize, true, time);
hsl = rgbToHsl(rgb);
hsl[2]*100
sampleSize = [220,220];
target = thisComp.layer("matte");
samplePos = [220,0];
rgb = target.sampleImage(samplePos, sampleSize, true, time);
hsl = rgbToHsl(rgb);
hsl[2]*100
etc.. moving the samplePos always by value of 220.
Then I link each of the square’s time remap value to corresponding slider.
It kind of works except I’m getting some kind of overlap of the measured areas.
(on the left is the result – all the cyrcles that are under the matte (on the right) should be gone, but they only animate half way)
How should I properly define the grid? And is there an easier way to achive my goal?
Thank you.