mirror of
https://github.com/FunkinCrew/Funkin.git
synced 2024-11-22 23:57:50 -05:00
Merge pull request #467 from FunkinCrew/retro-fade
small fade polish for week 8 convos
This commit is contained in:
commit
fd88ebef63
2 changed files with 20 additions and 1 deletions
|
@ -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);
|
||||
|
|
17
source/funkin/util/EaseUtil.hx
Normal file
17
source/funkin/util/EaseUtil.hx
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue