1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-11-19 21:33:06 +00:00

Add new album roll animation (again)

This commit is contained in:
EliteMasterEric 2024-03-30 00:54:07 -04:00
parent acb58a6b49
commit 823baa3326
4 changed files with 47 additions and 97 deletions

2
assets

@ -1 +1 @@
Subproject commit fe0570d4cfe20d232bad062f3140787faad1baeb
Subproject commit 36f0d29445579402cb42750c746bb07d2565fe81

View file

@ -137,7 +137,8 @@ class FlxAtlasSprite extends FlxAnimate
anim.callback = function(_, frame:Int) {
var offset = loop ? 0 : -1;
if (frame == (anim.getFrameLabel(id).duration + offset) + anim.getFrameLabel(id).index)
var frameLabel = anim.getFrameLabel(id);
if (frame == (frameLabel.duration + offset) + frameLabel.index)
{
if (loop)
{

View file

@ -1,5 +1,6 @@
package funkin.ui.freeplay;
import funkin.graphics.adobeanimate.FlxAtlasSprite;
import flixel.FlxSprite;
import flixel.group.FlxSpriteGroup;
import flixel.util.FlxSort;
@ -35,30 +36,47 @@ class AlbumRoll extends FlxSpriteGroup
return value;
}
var albumArt:FunkinSprite;
var albumTitle:FunkinSprite;
var newAlbumArt:FlxAtlasSprite;
var difficultyStars:DifficultyStars;
var _exitMovers:Null<FreeplayState.ExitMoverData>;
var albumData:Album;
final animNames:Map<String, String> = [
"volume1-active" => "ENTRANCE",
"volume2-active" => "ENTRANCE VOL2",
"volume3-active" => "ENTRANCE VOL3",
"volume1-trans" => "VOL1 TRANS",
"volume2-trans" => "VOL2 TRANS",
"volume3-trans" => "VOL3 TRANS",
"volume1-idle" => "VOL1 STILL",
"volume2-idle" => "VOL2 STILL",
"volume3-idle" => "VOL3 STILL",
];
public function new()
{
super();
albumTitle = new FunkinSprite(947, 491);
albumTitle.visible = true;
albumTitle.zIndex = 200;
add(albumTitle);
newAlbumArt = new FlxAtlasSprite(0, 0, Paths.animateAtlas("freeplay/albumRoll/freeplayAlbum"));
newAlbumArt.visible = false;
newAlbumArt.onAnimationFinish.add(onAlbumFinish);
add(newAlbumArt);
difficultyStars = new DifficultyStars(140, 39);
difficultyStars.stars.visible = false;
add(difficultyStars);
}
difficultyStars.stars.visible = true;
albumTitle.visible = false;
// albumArtist.visible = false;
function onAlbumFinish(animName:String):Void
{
// Play the idle animation for the current album.
newAlbumArt.playAnimation(animNames.get('$albumId-idle'), false, false, true);
// var albumArtist:FlxSprite = new FlxSprite(1010, 607).loadGraphic(Paths.image('freeplay/albumArtist-kawaisprite'));
// End on the last frame and don't continue until playAnimation is called again.
// newAlbumArt.anim.pause();
}
/**
@ -68,13 +86,8 @@ class AlbumRoll extends FlxSpriteGroup
{
if (albumId == null)
{
albumArt.visible = false;
albumTitle.visible = false;
if (titleTimer != null)
{
titleTimer.cancel();
titleTimer = null;
}
difficultyStars.stars.visible = false;
return;
}
albumData = AlbumRegistry.instance.fetchEntry(albumId);
@ -86,41 +99,8 @@ class AlbumRoll extends FlxSpriteGroup
return;
};
if (albumArt != null)
{
FlxTween.cancelTweensOf(albumArt);
albumArt.visible = false;
albumArt.destroy();
remove(albumArt);
}
// Paths.animateAtlas('freeplay/albumRoll'),
albumArt = FunkinSprite.create(1500, 360, albumData.getAlbumArtAssetKey());
albumArt.setGraphicSize(262, 262); // Magic number for size IG
albumArt.zIndex = 100;
// playIntro();
add(albumArt);
applyExitMovers();
if (Assets.exists(Paths.image(albumData.getAlbumTitleAssetKey())))
{
if (albumData.hasAlbumTitleAnimations())
{
albumTitle.loadSparrow(albumData.getAlbumTitleAssetKey());
FlxAnimationUtil.addAtlasAnimations(albumTitle, albumData.getAlbumTitleAnimations());
}
else
{
albumTitle.loadGraphic(Paths.image(albumData.getAlbumTitleAssetKey()));
}
}
else
{
albumTitle.visible = false;
}
refresh();
}
@ -146,27 +126,13 @@ class AlbumRoll extends FlxSpriteGroup
if (exitMovers == null) return;
exitMovers.set([albumArt],
exitMovers.set([newAlbumArt],
{
x: FlxG.width,
speed: 0.4,
wait: 0
});
exitMovers.set([albumTitle],
{
x: FlxG.width,
speed: 0.2,
wait: 0.1
});
/*
exitMovers.set([albumArtist],
{
x: FlxG.width * 1.1,
speed: 0.2,
wait: 0.2
});
*/
exitMovers.set([difficultyStars],
{
x: FlxG.width * 1.2,
@ -182,20 +148,19 @@ class AlbumRoll extends FlxSpriteGroup
*/
public function playIntro():Void
{
albumArt.visible = true;
FlxTween.tween(albumArt, {x: 950, y: 320, angle: -340}, 0.5, {ease: FlxEase.elasticOut});
newAlbumArt.visible = true;
newAlbumArt.playAnimation(animNames.get('$albumId-active'), false, false, false);
albumTitle.visible = false;
if (titleTimer != null)
{
titleTimer.cancel();
titleTimer = null;
difficultyStars.stars.visible = false;
new FlxTimer().start(0.75, function(_) {
// showTitle();
showStars();
});
}
titleTimer = new FlxTimer().start(0.75, function(_) {
showTitle();
});
public function skipIntro():Void
{
newAlbumArt.playAnimation(animNames.get('$albumId-trans'), false, false, false);
}
public function setDifficultyStars(?difficulty:Int):Void
@ -205,19 +170,11 @@ class AlbumRoll extends FlxSpriteGroup
difficultyStars.difficulty = difficulty;
}
public function showTitle():Void
{
albumTitle.visible = true;
albumTitle.animation.play('active');
albumTitle.animation.finishCallback = (_) -> albumTitle.animation.play('idle');
}
/**
* Make the album stars visible.
*/
public function showStars():Void
{
// albumArtist.visible = false;
difficultyStars.stars.visible = false;
difficultyStars.stars.visible = false; // true;
}
}

View file

@ -469,14 +469,6 @@ class FreeplayState extends MusicBeatSubState
albumRoll.playIntro();
new FlxTimer().start(0.75, function(_) {
albumRoll.showTitle();
});
new FlxTimer().start(35 / 24, function(_) {
albumRoll.showStars();
});
FlxTween.tween(grpDifficulties, {x: 90}, 0.6, {ease: FlxEase.quartOut});
var diffSelLeft:DifficultySelector = new DifficultySelector(20, grpDifficulties.y - 10, false, controls);
@ -1055,7 +1047,7 @@ class FreeplayState extends MusicBeatSubState
if (albumRoll.albumId != newAlbumId)
{
albumRoll.albumId = newAlbumId;
albumRoll.playIntro();
albumRoll.skipIntro();
}
}