1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-10-02 07:28:53 +00:00

Merge pull request #467 from FunkinCrew/retro-fade

small fade polish for week 8 convos
This commit is contained in:
Eric 2024-04-05 02:47:10 -04:00 committed by GitHub
commit fd88ebef63
2 changed files with 20 additions and 1 deletions

View file

@ -23,6 +23,7 @@ import funkin.modding.IScriptedClass.IDialogueScriptedClass;
import funkin.modding.IScriptedClass.IEventHandler;
import funkin.play.cutscene.dialogue.DialogueBox;
import funkin.util.SortUtil;
import funkin.util.EaseUtil;
/**
* A high-level handler for dialogue.
@ -179,7 +180,7 @@ class Conversation extends FlxSpriteGroup implements IDialogueScriptedClass impl
if (backdropData.fadeTime > 0.0)
{
backdrop.alpha = 0.0;
FlxTween.tween(backdrop, {alpha: 1.0}, backdropData.fadeTime, {ease: FlxEase.linear});
FlxTween.tween(backdrop, {alpha: 1.0}, backdropData.fadeTime, {ease: EaseUtil.stepped(10)});
}
else
{
@ -403,6 +404,7 @@ class Conversation extends FlxSpriteGroup implements IDialogueScriptedClass impl
type: ONESHOT, // holy shit like the game no way
startDelay: 0,
onComplete: (_) -> endOutro(),
ease: EaseUtil.stepped(8)
});
FlxTween.tween(this.music, {volume: 0.0}, outroData.fadeTime);

View file

@ -0,0 +1,17 @@
package funkin.util;
class EaseUtil
{
/**
* Returns an ease function that eases via steps.
* Useful for "retro" style fades (week 6!)
* @param steps how many steps to ease over
* @return Float->Float
*/
public static inline function stepped(steps:Int):Float->Float
{
return function(t:Float):Float {
return Math.floor(t * steps) / steps;
}
}
}