Skip to main content
mart-martinlofqvist
Known Participant
October 16, 2022
Answered

Paus or play at current time with expression

  • October 16, 2022
  • 1 reply
  • 262 views

Hi! 

I'm looking for a way to enable expression based playback that is either playing at ordinary speed using the time function OR pausing at the current time. 

This will be controlled by another layers opacity - bascially looking at if that layer has opacity 100% then pausing from current time else if layer has 0% then playback at normal speed.

 

Anyone has any ideas how to set this up?

This topic has been closed for replies.
Correct answer Dan Ebberts

Try this time remapping expression:

ctrl = thisComp.layer("Control").opacity;
f = timeToFrames(time);
accum = 0;
for (i = 0; i < f; i++){
  if (ctrl.valueAtTime(framesToTime(i)) == 0) accum++;
}
framesToTime(accum)

1 reply

Dan Ebberts
Community Expert
Dan EbbertsCommunity ExpertCorrect answer
Community Expert
October 16, 2022

Try this time remapping expression:

ctrl = thisComp.layer("Control").opacity;
f = timeToFrames(time);
accum = 0;
for (i = 0; i < f; i++){
  if (ctrl.valueAtTime(framesToTime(i)) == 0) accum++;
}
framesToTime(accum)
mart-martinlofqvist
Known Participant
October 16, 2022

Awesome Dan, as always. 

 

Wish I understood what you did, but it works, so thank you.