FORUMS TUTORIALS MAGAZINE STOCKYARD VIDEOS PODCASTS EVENTS SERVICES NEWSLETTER NEWS BLOGS
 ADOBE AFTER EFFECTS: Home Forum Basics Expressions Tutorials Podcasts AE Techniques Training Creative Cloud Debate FAQ

# How to get current frame in expressions.

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
 How to get current frame in expressions. by Cory Weiner on Apr 5, 2008 at 10:02:10 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.

 Re: How to get current frame in expressions.by Dan Ebberts on Apr 6, 2008 at 12:47:27 am

Dan

 Re: How to get current frame in expressions.by Stephen Oberauer on Jul 21, 2012 at 12:05:27 pm

you could do this (where 25 is fps):

`(time * 25) % 2 == 0`

 Re: How to get current frame in expressions.by Jan Vork on Nov 12, 2012 at 2:21:18 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