Skip to content

Instantly share code, notes, and snippets.

@eliemichel
Last active Jul 16, 2018
Embed
What would you like to do?
Fade out offset
// Fade in
{
float x0 = ch("../PARAM/start_crossfade_frame");
float x1 = ch("../PARAM/end_crossfade_frame");
float a1 = 0.01;
float a0 = a1 / (2 * (x1 - x0));
float b1 = a0 * (x1 - x0) * (x1 - x0) - a1 * x1;
return if($FF < x0, 0, if($FF < x1, a0 * ($FF - x0) * ($FF - x0), a1 * $FF + b1));
}
// Fade out
{
float x0 = ch("../PARAM/start_crossfade_frame");
float x1 = ch("../PARAM/end_crossfade_frame");
float a0 = 0.1;
float a1 = - a0 / (2 * (x1 - x0));
float b1 = - 2.0 * a1 * x1;
float c1 = ((a0 - b1) - a1 * x0) * x0;
float b2 = (a1 * x1 + b1) * x1 + c1;
return if($FF < x1, if($FF < x0, a0 * $FF, (a1 * $FF + b1) * $FF + c1), b2);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment