Inspired by David Emney’s wave expressions for Nuke (https://davemne.wordpress.com/2011/05/16/nuke-wave-expressions-to-copy-and-paste/) I’ve compiled a handful of fade-in/out expressions.
All expressions return values from zero to one, to flip simply subtract them from 1, add/subtract/multiply/divide applied to the outermost level of the expression will allow tweaking the min/max values.
I’m not sure when these might be preferable to keyframe/curve based animation. At first I planned to multiply one against another expression to fade in a camera stabilize, I found that a more “art-directable” solution is to multiply the expression against a custom knob which you can animate as per usual.
clamp((frame-fadeStart)/(fadeEnd – fadeStart)
Clamping the frame range within an sine wave can give us a classic S curve. Let me know if you have a more elegant solution – this was mostly trial and error.
(sin(clamp(((frame-startFrame)*pi)/(endFrame–startFrame) – pi/2 , -pi/2 , pi/2 ) )+1) /2
The next two are complementary halves of the sine expression.
I ended up not using these for what I originally planned so I’d be interested to hear if anyone does find a use for them.