ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

# Linear expression -Including Limits

VIEW ALL
 Linear expression -Including Limits on May 3, 2020 at 10:18:53 am

I've got this scene where I rotate the orange rectangle to make a complete 360 according to the duration of the comp with linear expression
But as you can see the rotation value at the end of the timeline is not exactly 360.
I know linear interpolates between the high and low values and so doesn't include the limits themselves.

SO HOW CAN I RESOLVE THIS ISSUE SO THAT I CAN GET EXACTLY 360 AT THE THE END ?

 Re: Linear expression -Including Limitson May 3, 2020 at 4:17:48 pm

Try it this way:

t = thisComp.duration - thisComp.frameDuration;
linear(time,0,t,0,360)

Say your comp duration is 10 frames. The first frame would be frame 0 and the last would be frame 9. Frame 10 would be one frame beyond the end of your comp, so you want your linear() range to end one frame before the duration of your comp. I think ☺

Dan

 Re: Linear expression -Including Limitson May 4, 2020 at 10:18:29 am

So what you mean by this is interpolating to the last-1 frame instead of last frame. Right ??

And a side question

can this effect can be achieved using time or any another way other than linear expression ?

i.e rotate a.full 360 from start to finish of timeline

Later I may add a counter slider to be mulripled with this value to make that many rotations
..

 Re: Linear expression -Including Limitson May 4, 2020 at 11:11:03 am

>So what you mean by this is interpolating to the last-1 frame instead of last frame. Right ??

No, the last frame. Try this. Create a 1-second 30 fps comp. Drag the time indicator all the way to the right and look at the time for the last frame. 00:29, right? Now hit the Page Down key. The time goes to 01:00, but you are now outside of the comp.

Dan

 Re: Linear expression -Including Limitson May 4, 2020 at 11:20:01 am

Yep. Now I get it

Can you also answer my side question ?

 Re: Linear expression -Including Limitson May 4, 2020 at 11:30:45 am

You don't have to use linear()--you can do that same calculation by hand, but you still have to deal with the time of the last frame being comp duration minus one frame.

Dan

 Re: Linear expression -Including Limitson May 4, 2020 at 5:27:20 pm

Okay. I have a proper scene where I gotta use these things but unfortunately it all messed up. So I was verifying them with this simple scene. Lemme try on that and get back.