ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

color sample size/possition

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Vojtěch Palmecolor sample size/possition
by on Jan 10, 2017 at 7:15:42 pm
Last Edited By Vojtěch Palme on Jan 10, 2017 at 7:16:56 pm

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 9x5 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.


Return to posts index

Dan EbbertsRe: color sample size/possition
by on Jan 10, 2017 at 8:41:34 pm

It seems like it should be like this:

sampleSize = [110,110];
target = thisComp.layer("matte");
samplePos = [110,110];

sampleSize = [110,110];
target = thisComp.layer("matte");
samplePos = [330,110];

etc.

Dan



Return to posts index

Vojtěch PalmeRe: color sample size/possition
by on Jan 11, 2017 at 12:42:22 pm

Works like a charm. As always thank you oh grand expressions wizard Dan :)


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]