From 83ddb13f71041f5c4b8e85e52b329c39f00ae0ac Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Sat, 4 Dec 2021 00:38:45 -0500 Subject: [PATCH] freeplay menu shit in progres animation --- source/PlayState.hx | 10 +++++----- source/freeplayStuff/SongMenuItem.hx | 21 ++++++++++++++++++++- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/source/PlayState.hx b/source/PlayState.hx index e05f62b41..8ee3faf82 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -1879,13 +1879,13 @@ class PlayState extends MusicBeatState camHUD.visible = !camHUD.visible; if (FlxG.keys.justPressed.K) { - @:privateAccess - var funnyData:Array = cast FlxG.sound.music._channel.__source.buffer.data; + // @:privateAccess + // var funnyData:Array = cast FlxG.sound.music._channel.__source.buffer.data; - funnyData.reverse(); + // funnyData.reverse(); - @:privateAccess - FlxG.sound.music._channel.__source.buffer.data = cast funnyData; + // @:privateAccess + // FlxG.sound.music._channel.__source.buffer.data = cast funnyData; } #end diff --git a/source/freeplayStuff/SongMenuItem.hx b/source/freeplayStuff/SongMenuItem.hx index 57ea782e6..4555c82c1 100644 --- a/source/freeplayStuff/SongMenuItem.hx +++ b/source/freeplayStuff/SongMenuItem.hx @@ -42,11 +42,30 @@ class SongMenuItem extends FlxSpriteGroup selected = selected; // just to kickstart the set_selected } + var frameTicker:Float = 0; + var frameTypeBeat:Int = 0; + + var xFrames:Array = [1.6, 1.8, 0.85, 0.85, 0.97, 0.97, 1]; + var xPosLerpLol:Array = [0.8, 0.4, 0.16, 0.16, 0.22, 0.22, 0.245]; // NUMBERS ARE JANK CUZ THE SCALING OR WHATEVER + override function update(elapsed:Float) { if (doLerp) { - x = CoolUtil.coolLerp(x, targetPos.x, 0.3); + frameTicker += elapsed; + + if (frameTicker >= 1 / 24 && frameTypeBeat < xFrames.length) + { + frameTicker = 0; + + scale.x = xFrames[frameTypeBeat]; + scale.y = 1 / xFrames[frameTypeBeat]; + x = FlxG.width * xPosLerpLol[Std.int(Math.min(frameTypeBeat, xPosLerpLol.length - 1))]; + + frameTypeBeat += 1; + } + + // x = CoolUtil.coolLerp(x, targetPos.x, 0.3); y = CoolUtil.coolLerp(y, targetPos.y, 0.4); }