Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions How to get current frame in expressions.

  • How to get current frame in expressions.

    Posted by Cory Weiner on April 5, 2008 at 10:02 pm

    I am trying to make the opacity of a video 0 on every even frame, and 100 on every odd. I have added an expression on the opacity of the video that looks like this:

    d = thisComp.frameDuration;
    if (d%2==0){
    opacity = 0;
    }else{
    opacity = 100;
    }

    but this does not change the opacity of the video at any time.

    how would I get the current frame number, then test every frame to see if it is even or odd and adjust the opacity accordingly.

    Jan Vork replied 13 years, 6 months ago 4 Members · 3 Replies
  • 3 Replies
  • Dan Ebberts

    April 6, 2008 at 12:47 am

    See previous thread. 🙂

    Dan

  • Stephen Oberauer

    July 21, 2012 at 12:05 pm

    you could do this (where 25 is fps):

    (time * 25) % 2 == 0

  • Jan Vork

    November 12, 2012 at 2:21 pm

    For some reason, I get a rounding problem, where once in a while 2 frames get the same restult.

    This expression works better for me:

    C=((time*25)/2)-(Math.round((time*25)/2));
    if (C==0)
    {
    100
    }
    else
    {
    0
    }

    http://www.jaydude.nl

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