Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Can I use timeToCurrentFormat to have an expression start at an exact time?

  • Can I use timeToCurrentFormat to have an expression start at an exact time?

    Posted by Aza Allen on July 9, 2011 at 12:36 am

    I have a large, lengthy composition and I want to use expressions in some parts. I want to fire an expression at an exact time, but can’t quite seem to find out how to do it… I’ve searched, but most posts on the subject are really specific to a person’s needs, or don’t quite match.

    The “time” input in an expression calculates in seconds from the beginning of the comp, correct? My comp (and subsequent precomps) are over an hour long, so calculating the number of seconds I’m currently at is unwieldy, especially if I want to get Frame specific.

    So, back to my question, can I use timeToCurrentFormat to somehow trigger an expression from the CTI?

    If not, is there another way? I didn’t get specific about my exact needs because I am hoping there is a general way to be able to do this that I can plug in to various circumstances…

    Thanks all!
    Aza

    Make sure to check out our website http://www.makeyourfriendsuncomfortable.com and my personal website http://www.ruesterprod.com

    Dan Ebberts replied 14 years, 10 months ago 3 Members · 5 Replies
  • 5 Replies
  • Greg Burrus

    July 9, 2011 at 10:21 pm

    I’m not an expression guru but when I have used that timeToCurrentFormat(I usally do frames) I triggered event based on If statements. So once it gets to X frame it triggers what I want to happen. This is probably a basic way to do it but that usually works for what I need.

    Another way you could trigger expression is using the expression timeline script, https://aescripts.com/expression-timeline/. I use this all the time when I have more complicated expressions or just want a nice gui, and I only want an expression to happen at between a range.

    hope this helps

    Greg

    https://mogra.g2bproductions.com/ – Blog
    https://g2bproductions.com/ – Portfolio

  • Dan Ebberts

    July 11, 2011 at 12:18 am

    I Don’t think timeToCurrentFormat() gets you anywhere. It seems like maybe what you need to do is specify your start time as hr:min:sec:frames
    and then parse that in the expression to convert it to seconds. Then use variable “t” in your expression instead of “time”. Like this example:


    tStart = "01:33:25:19"; // your start time

    tSplit = tStart.split(":");

    tSec = parseInt(tSplit[0],10)*3600;
    tSec += parseInt(tSplit[1],10)*60;
    tSec += parseInt(tSplit[2],10);
    tSec += parseInt(tSplit[3],10)*thisComp.frameDuration;

    t = time - tSec;
    if (t > 0){

    // your expression goes here using "t" instead of "time"

    }else{
    value
    }

    Dan

  • Dan Ebberts

    July 11, 2011 at 2:49 am

    Hmmm…. the more I think about it, the more I think you were on the right track. Something like this should work (assuming that your current format uses colons as separators):


    tStart = "00:00:07:12";
    if (timeToCurrentFormat() > tStart)
    100
    else
    0

    Dan

  • Aza Allen

    July 11, 2011 at 6:47 am

    Thanks Dan, I will give it a try! I don’t know how you get anything else done when you are answering our noob questions all the time 😉

    BTW – Where is “time” measured from in an expression, the beginning of the Comp, or the layer?

    Thanks again!

    Aza

    Make sure to check out our website http://www.makeyourfriendsuncomfortable.com and my personal website http://www.ruesterprod.com

  • Dan Ebberts

    July 11, 2011 at 3:05 pm

    time is comp time.

    Dan

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy