-
Time Remap pre-comp through Control Layer?
Hi everyone,
I’ve been trying to set up a comp that contains 1. a pre-comp with an animation inside, and 2. a control-layer that has a mask animate from black to white.
The idea is that each pre-comp looks at the pixel value of the control-layer, and when this turns from black to white, the pre-comp will start.
So to clarify, the InPoint of the pre-comp effectively should get moved to the point in time where the control-layer turns from black to white underneath the pre-comp.The idea behind all this is that I could make duplicates of the pre-comp to create a grid of animation that are all the same but that would be offset in time by the animation of the mask in the control-layer.
I’ve tried a few different things but I can’t get the code to work. The problem seems to be that I’d need a way to store a value (the frame number where the control-layer turns from black to white under that pre-comp), which as far as I know is impossible with AE expressions. So I was wondering if anyone else might have a solution or a different approach.
The code I have so far (I should mention that the animation in the pre-comp runs from frame 0-15):
// This code is put the Time Remap property of the animation pre-comp
var controlLayer = thisComp.layer(“Control Layer”);
var colorValue = controlLayer.sampleImage([1,1], transform.position)
var controlValue = Math.floor(colorValue[0]);if( controlValue ) {
timeRemap + 1.0*controlValue/30;
} else {
0;
}// LINEAR APPROACH, also doesn’t work:
// offset = timeToFrames(time) * controlValue;
// var targetFrame = linear(time*controlValue, time, time+15, 0, 15);