-
sampleImage with multiple channels
Hello AE friends!
I am trying to make an animation that is driven the color information from another layer. I have a set of 3D triangles that I am trying to get to spin on the Y axis. I made a 3D null and linked the Y rotation of the triangle to the Y rotation of the null and applied this expression.
target = thisComp.layer(“GRAD”);
red = target.sampleImage([120, 200],[3.5, 3.5])[0];
linear (red, 0, 1, transform.yRotation, 120);This works just fine. The “GRAD” layer is a black solid and a red solid with a feathered mask that animates from right to left.
But what I would like is to be able to drive the Y rotation with this red channel so that when the layer is filled with red, it rotates to 120 degrees. Then when I animate a green solid in the “GRAD” layer it will go from what ever the current Y value is to 240 degrees.
I tried this….
target = thisComp.layer(“GRAD”);
red = target.sampleImage([80, 200],[3.5, 3.5])[0];
green = target.sampleImage([80, 200],[3.5, 3.5])[1]
linear (red, 0, 1, transform.yRotation, 120);
linear (green, 0, 1, transform.yRotation, 240);Using [0] to index the red channel in line 2 and [1] to index the green channel in line 3. This expression seems to ignore the red channel but it does function for the green channel.
Any help? This is the first time I have worked with the sampleImage expression.
I am trying to re-create the NBC which can be seen here. https://youtu.be/raWfiU8Y3v4
target = thisComp.layer("GRAD");
red = target.sampleImage([80, 200],[3.5, 3.5])[0];
green = target.sampleImage([80, 200],[3.5, 3.5])[1]
linear (red, 0, 1, transform.yRotation, 120);
linear (green, 0, 1, transform.yRotation, 240);