ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Crafting an expression, need to add a slow to stop

COW Forums : Adobe After Effects

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Bill Russell
Crafting an expression, need to add a slow to stop
on Jul 15, 2012 at 11:57:03 pm

Hi,

I've been using this expression for years for a flicker free credit roll (accomplishes y axis movement across whole pixels). Then I go through a little dance of copying values and using position key frames instead to accomplish what I can probably do much easier with a script. So here goes.

On the long thin layer containing the scroll text, I use

t = Math.max(time - inPoint, 0);
i = -3; // pixel movement per frame
y = i * t / thisComp.frameDuration;
value + [0,y]


I'd like to add two input variable that designate 1) how long the scrolling will continue (say three minutes, for example) before it slows smoothly to a stop. And 2) how long the ramp slow to stop is (say two seconds, for example).

Usually on the end credit rolls I create I have the production title as the last item in the credits. As it rolls into view, the slate slows to a stop (over about a two second ramp) ending with the production title in the middle of the frame.

Any wisdom hugely appreciated! Thank you!

"THE LOST SKELETON OF CADAVRA" -

And more...


Return to posts index

Walter Soyka
Re: Crafting an expression, need to add a slow to stop
on Jul 16, 2012 at 1:03:03 am

How about using a layer marker instead?

m = thisLayer.marker.key(1).time; 

if (time < m) { t = Math.max(time - inPoint, 0); }
else { t = easeOut(time, m, m+2, m, m + 1); }

i = -3; // pixel movement per frame
y = i * t / thisComp.frameDuration;
value + [0,y]


Just take your existing credit roll expression, find the point you want to freeze, back up one second, and then add a layer marker. Replace your old expression with the new one above. When the expression sees the layer market, it acts like a brake -- it'll ease the movement to a stop over the next two seconds (these two time values are hard-coded in the "else" line above and can be seasoned to taste).

Basically, we're tweaking the t value, almost like time remapping. From the credit roll layer's in point to the time of the first layer marker, t runs at the same rate as real time. From the layer marker to two seconds after the layer marker, we ease t from the time of the layer marker to one second after the layer marker (stretching one second to two with an ease on the out). Thereafter, t is frozen at that final time.

Walter Soyka
Principal & Designer at Keen Live
Motion Graphics, Widescreen Events, Presentation Design, and Consulting
RenderBreak Blog - What I'm thinking when my workstation's thinking
Creative Cow Forum Host: Live & Stage Events


Return to posts index

Bill Russell
Re: Crafting an expression, need to add a slow to stop
on Jul 16, 2012 at 1:26:37 am

You're my hero! This is just what I'm looking for and so close.

The problem I'm having now, the position jumps at the layer marker. For instance, to test it I located the marker where position y value hits 1111. At the layer marker the position y jumps from value "1111" to "-908", then ramps to a stop from there.

Thoughts?

"THE LOST SKELETON OF CADAVRA" -

And more...


Return to posts index



Walter Soyka
Re: Crafting an expression, need to add a slow to stop
on Jul 16, 2012 at 1:52:41 am

My bad. The above expression only works if the layer's inPoint is at time 0.

The expression below corrects that bad assumption.

m = thisLayer.marker.key(1).time; 
if (time < m) { t = Math.max(time - inPoint, 0); }
else { t = easeOut(time-inPoint, m-inPoint, m+2-inPoint, m-inPoint, m + 1 -inPoint); }
i = -3; // pixel movement per frame
y = i * t / thisComp.frameDuration;
value + [0,y]


Walter Soyka
Principal & Designer at Keen Live
Motion Graphics, Widescreen Events, Presentation Design, and Consulting
RenderBreak Blog - What I'm thinking when my workstation's thinking
Creative Cow Forum Host: Live & Stage Events


Return to posts index

Bill Russell
Re: Crafting an expression, need to add a slow to stop
on Jul 16, 2012 at 3:30:22 am

Thank you for your help!!

One more question if I may -- I looked up easeOut and I'm still having trouble understanding how it does what is does. For instance, how do I lengthen the ramp down (for instance, to last four seconds instead of two) and keep the curve very even, smooth? I've played with the values and am just making a mess -- can't get a smooth and even curve except with the values you offered.

"THE LOST SKELETON OF CADAVRA" -

And more...


Return to posts index

Walter Soyka
Re: Crafting an expression, need to add a slow to stop
on Jul 16, 2012 at 4:19:13 pm

I'll have to dig back in to see if there's another approach to take.

In the meantime, you can ask on the After Effects Expressions forum [link], or you apply the Separate XYZ Position animation presets, apply the original expression to Separate XYZ's Y position, with a slight modification:

t = Math.max(time - inPoint, 0);
i = -3; // pixel movement per frame
y = i * t / thisComp.frameDuration;
value + y


Then, with Y Position selected in the timeline, Animation > Keyframe Assistant > Convert Expression to Keyframes. Delete all the keyframes after point where you want the layer to hold, as well as a couple seconds' worth prior to that point. Drag that final keyframe forward in time a couple seconds, then hop into the graph editor to smooth out the curve with the Bezier handles.

Walter Soyka
Principal & Designer at Keen Live
Motion Graphics, Widescreen Events, Presentation Design, and Consulting
RenderBreak Blog - What I'm thinking when my workstation's thinking
Creative Cow Forum Host: Live & Stage Events


Return to posts index


Bill Russell
Re: Crafting an expression, need to add a slow to stop
on Jul 16, 2012 at 4:58:16 pm

Oops, apologies, I didn't take time to notice there was a dedicated expressions forum. However, I've already used your latest solution on my current project. Revisions and corrections with clients always mean changes in duration and landing points, so this is helping make the position adjustments much easier, hugely.

I will be using this. If you have any sudden inspirations on how to custom the duration of the curve, and "S" curve the ramp, do share! I'll feel around for that as well. Meanwhile, this is fantastic.

Thank you!!

"THE LOST SKELETON OF CADAVRA" -

And more...


Return to posts index


Walter Soyka
Re: Crafting an expression, need to add a slow to stop
on Jul 16, 2012 at 8:41:55 pm

Really, the simplest way by far is to precomp your scroll with the expression. In the main comp, enable time remapping for your scroll precomp layer. This will automatically add a keyframe at the first and last frames of the layer. Add a keyframe at the point you want the scroll to stop. Add a keyframe a couple seconds before that (where the scroll will begin to slow) and add a single keyframe one frame before that (to ensure that no matter what you change thereafter, you won't accidentally break the perfect -3px/f scroll). Delete the final keyframe (one of the two AE automatically created when you enabled time remapping).

Leave the first two keyframes as linear; ease the second two keyframes and tweak the speed graph. Once you've done this a couple times, it will take you only seconds to do thereafter.

I will try to get back to the expression later, but this method should be the simplest in the mean time.

Walter Soyka
Principal & Designer at Keen Live
Motion Graphics, Widescreen Events, Presentation Design, and Consulting
RenderBreak Blog - What I'm thinking when my workstation's thinking
Creative Cow Forum Host: Live & Stage Events


Return to posts index

Bill Russell
Re: Crafting an expression, need to add a slow to stop
on Jul 16, 2012 at 11:00:32 pm

Well, there you go, look at that. Nice. I like that much better than converting to keyframes (which is similar-ish to what I've always done, and a pain to constantly revise).

Meanwhile, I have indeed already used the expression like a mofo last night and today as we ping pong back and forth on these credits. Thanks again for all of it!

"THE LOST SKELETON OF CADAVRA" -

And more...


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]