-
Looping part of a precomp, then playing the rest
I have a composition that contains a precomped animation (38 frame duration) that I want to loop from the start to 12 frames until I am 26 frames from the end of the layer, then I want to play the rest.
I have my precomp in layer 1, time remapped with two keyframes (0 and 11). I have the following expression applied to the timeRemap property:
i = this;if (i.effect("Ladder")("Checkbox") == 1) {
duration = timeToFrames (i.outPoint - i.inPoint);
layerIn = timeToFrames(i.startTime + thisComp.displayStartTime);
layerOut = layerIn + duration;
currentTime = timeToFrames(time + thisComp.displayStartTime);
trigger = timeToFrames(i.source.duration + i.source.displayStartTime - i.sourceTime(i.timeRemap.key(2).time))
remainingFrames = layerOut - currentTime;
elapsedTime = currentTime - layerIn;
if (remainingFrames > trigger) {
remapVal = elapsedTime % (timeToFrames(i.sourceTime(i.timeRemap.key(2).time)) - timeToFrames(i.sourceTime(i.timeRemap.key(1).time)))
}
else {
remapVal = timeToFrames(i.sourceTime(i.timeRemap.key(2).time)) + (trigger - remainingFrames)
}
}framesToTime(remapVal)
Two goofy things right off – I am setting the variable i to this, and am switching back and forth from frames to time, because I copied and pasted the code from a text layer to see what was happening. When I apply the expression to the text layer’s text property and make i = to the precomp layer, it works. When I apply to the precomp layer, once it hits the trigger it defaults to the duration of the precomp source layer, basically a blank screen.
There’s probably a better way to do this, but the loopOut always starts from the 1st keyframe, and I want to start from the 2nd keyframe and play to the end. Any help would be appreciated.
Robert Womack
Creative Bridgekeep
http://www.CurrentMarketing.com
“Louisville’s Leading Interactive Marketing Agency”