-
valueAtTime() not working in nested comp
Hi all, I know similar questions have been asked before, but the answers don’t seem to explain the problem I’m having.
I’ve got a comp (for clarity, we’ll call it “Precomp”) nested within a master comp (we’ll call it “Comp”). Within Precomp, I’ve got a DUIK Effector; in Comp, I’ve got a mouse cursor shape layer. I want the Effector in Precomp to follow the mouse cursor in the parent comp. Easy enough. But the Precomp layer within Comp starts at the 2 second mark. I’m trying to use valueAtTime() to get the time-offset anchor point of the mouse cursor, but it’s simply not giving me the time-offset value; it’s only giving me the value at the current time in the precomp. I can’t figure out what I’m doing wrong. Here’s what I have on the position property of the Effector inside of Precomp:
compMaster = comp(“Comp”);
mouseLayer = compMaster.layer(“Mouse Cursor”);
precomp = compMaster.layer(“Precomp”);
layerStart = precomp.startTime;
anchor = mouseLayer.transform.anchorPoint.valueAtTime(time + layerStart);
mouseLayer.toComp(anchor)What am I missing?
Edit: Just to say that if I make a text layer and add an expression to its Source Text to tell me the value of “layerStart + time”, it does give me the accurate current time of the master comp. Passing that correct value to valueAtTime() just seems not to have any effect.