Trigger a composition closure using TimeRemapping
Posted: February 10th, 2019, 11:24 am
I'm trying to trigger a composition closure using a TimeRemap on the composition with 4 key frames, with the script as follows:
clockStart = parseInt(comp("main").layer(5).text.sourceText.value);
clockTime = clockStart-1*(time);
sIn = key(2).time - key(1).time;
sOut = key(4).time - key(3).time;
if (time < clockStart)
linear(time,sIn,key(2).time,key(1).value,key(2).value)
else if (time >clockStart)
{
linear(time,key(3).time,sOut,key(3).value,key(4).value);
}
So basically I want to trigger the key3, if the time is greater the clockStart (which is timer for the value in clockStart) and will go to 0 when time passes clockStart.
In the above case it does a trigger but the issue I'm having is I need to readjust key4 keyframe.time manually everytime I change the clockStart value otherwise it give's me a cut instead of a smooth fadeout.
E.g. if the clockStart is 14, the value for keyframe 4 works fine at 28
if the clockStart is 10, I need to adjust the keyframe 4 to 24 so I get a smooth fadeout.
Any ideas.
clockStart = parseInt(comp("main").layer(5).text.sourceText.value);
clockTime = clockStart-1*(time);
sIn = key(2).time - key(1).time;
sOut = key(4).time - key(3).time;
if (time < clockStart)
linear(time,sIn,key(2).time,key(1).value,key(2).value)
else if (time >clockStart)
{
linear(time,key(3).time,sOut,key(3).value,key(4).value);
}
So basically I want to trigger the key3, if the time is greater the clockStart (which is timer for the value in clockStart) and will go to 0 when time passes clockStart.
In the above case it does a trigger but the issue I'm having is I need to readjust key4 keyframe.time manually everytime I change the clockStart value otherwise it give's me a cut instead of a smooth fadeout.
E.g. if the clockStart is 14, the value for keyframe 4 works fine at 28
if the clockStart is 10, I need to adjust the keyframe 4 to 24 so I get a smooth fadeout.
Any ideas.