Forums › Adobe After Effects Expressions › Linear expression -Including Limits
Linear expression -Including Limits
Nithish kumar
May 3, 2020 at 10:18 amI’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 ?
Dan Ebberts
May 3, 2020 at 4:17 pmTry 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
Nithish kumar
May 4, 2020 at 10:18 amSo 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
..Dan Ebberts
May 4, 2020 at 11:11 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
Nithish kumar
May 4, 2020 at 11:20 amYep. Now I get it
Can you also answer my side question ?
Dan Ebberts
May 4, 2020 at 11:30 amYou 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
Nithish kumar
May 4, 2020 at 5:27 pmOkay. 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.
Thanks, Dan…..For your patience…
And sorry I will be coming back for more fruits of your knowledge
Log in to reply.