FORUMS: list search recent posts

# Trying to create an expression that uses Time remapping to change frame rate of individual comp

FAQ   •   VIEW ALL
 Trying to create an expression that uses Time remapping to change frame rate of individual comp on Jun 30, 2014 at 5:15:34 pm

I need Help creating an expression that uses Time remapping to essentially change the frame rate of a comp.

I know I could just change the frame rate, but at times I need a comp to play at 29.97fps while another comp plays at half that. Or I might have one comp on odd frames and another comp on even frames.

What I have been doing is Time Remapping my comp, creating a keyframe every other frame then turning them all to hold frames. The problem is, this takes forever if the comp is greater than 10 seconds long.

Could I use an expression to do this for me?

Thanks for the help!

 Re: Trying to create an expression that uses Time remapping to change frame rate of individual compon Jul 2, 2014 at 2:49:12 am

[Jay Brown] "What I have been doing is Time Remapping my comp, creating a keyframe every other frame then turning them all to hold frames. The problem is, this takes forever if the comp is greater than 10 seconds long. Could I use an expression to do this for me?"

Sure:

```f = timeToFrames(); // get current time in frames if (f%2 != 0) f--; // if frame is odd, decrement frame framesToTime(f); // return frames as time```

Walter Soyka
Motion Graphics, Widescreen Events, Presentation Design, and Consulting

 Re: Trying to create an expression that uses Time remapping to change frame rate of individual compon Jul 2, 2014 at 1:48:49 pm

Thanks so much, works like a charm!

I figure out that if I want only Odd frames then I just change it to this
`if (f%2 == 0) f++`

But I'm not really sure what this is doing
`(f%2)`

Could you explain to me the what the % is doing?

 Re: Trying to create an expression that uses Time remapping to change frame rate of individual compon Jul 3, 2014 at 2:13:49 pm

[Jay Brown] "Could you explain to me the what the % is doing?"

% is the symbol for the modulo operator [link], which returns the remainder after integer division.

For example, (9 % 2) is 1. 9 divided by 2 (with integer division) is 4 with a remainder of 1. (100 % 3) is 1, because 100/3 = 33 with a remainder of 1.

Even numbers are evenly divisible by 2, meaning the remainder is 0; odd numbers are not evenly divisible by 2. By checking the remainder after we divide by 2 with integer division, we can tell if a number is even or odd.

Walter Soyka