mirror of
https://github.com/FunkinCrew/Funkin.git
synced 2024-11-23 08:07:54 -05:00
Merge pull request #468 from FunkinCrew/feature/new-album-art-3
Add new album roll animation (again)
This commit is contained in:
commit
3464ce336f
4 changed files with 47 additions and 97 deletions
2
assets
2
assets
|
@ -1 +1 @@
|
||||||
Subproject commit 5027bc656c9df5ec208ab256f9494bd7da425111
|
Subproject commit 36f0d29445579402cb42750c746bb07d2565fe81
|
|
@ -137,7 +137,8 @@ class FlxAtlasSprite extends FlxAnimate
|
||||||
anim.callback = function(_, frame:Int) {
|
anim.callback = function(_, frame:Int) {
|
||||||
var offset = loop ? 0 : -1;
|
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)
|
if (loop)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package funkin.ui.freeplay;
|
package funkin.ui.freeplay;
|
||||||
|
|
||||||
|
import funkin.graphics.adobeanimate.FlxAtlasSprite;
|
||||||
import flixel.FlxSprite;
|
import flixel.FlxSprite;
|
||||||
import flixel.group.FlxSpriteGroup;
|
import flixel.group.FlxSpriteGroup;
|
||||||
import flixel.util.FlxSort;
|
import flixel.util.FlxSort;
|
||||||
|
@ -35,30 +36,47 @@ class AlbumRoll extends FlxSpriteGroup
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
var albumArt:FunkinSprite;
|
var newAlbumArt:FlxAtlasSprite;
|
||||||
var albumTitle:FunkinSprite;
|
|
||||||
var difficultyStars:DifficultyStars;
|
var difficultyStars:DifficultyStars;
|
||||||
|
|
||||||
var _exitMovers:Null<FreeplayState.ExitMoverData>;
|
var _exitMovers:Null<FreeplayState.ExitMoverData>;
|
||||||
|
|
||||||
var albumData:Album;
|
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()
|
public function new()
|
||||||
{
|
{
|
||||||
super();
|
super();
|
||||||
|
|
||||||
albumTitle = new FunkinSprite(947, 491);
|
newAlbumArt = new FlxAtlasSprite(0, 0, Paths.animateAtlas("freeplay/albumRoll/freeplayAlbum"));
|
||||||
albumTitle.visible = true;
|
newAlbumArt.visible = false;
|
||||||
albumTitle.zIndex = 200;
|
newAlbumArt.onAnimationFinish.add(onAlbumFinish);
|
||||||
add(albumTitle);
|
|
||||||
|
add(newAlbumArt);
|
||||||
|
|
||||||
difficultyStars = new DifficultyStars(140, 39);
|
difficultyStars = new DifficultyStars(140, 39);
|
||||||
|
difficultyStars.stars.visible = false;
|
||||||
|
add(difficultyStars);
|
||||||
|
}
|
||||||
|
|
||||||
difficultyStars.stars.visible = true;
|
function onAlbumFinish(animName:String):Void
|
||||||
albumTitle.visible = false;
|
{
|
||||||
// albumArtist.visible = false;
|
// 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)
|
if (albumId == null)
|
||||||
{
|
{
|
||||||
albumArt.visible = false;
|
difficultyStars.stars.visible = false;
|
||||||
albumTitle.visible = false;
|
return;
|
||||||
if (titleTimer != null)
|
|
||||||
{
|
|
||||||
titleTimer.cancel();
|
|
||||||
titleTimer = null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
albumData = AlbumRegistry.instance.fetchEntry(albumId);
|
albumData = AlbumRegistry.instance.fetchEntry(albumId);
|
||||||
|
@ -86,41 +99,8 @@ class AlbumRoll extends FlxSpriteGroup
|
||||||
return;
|
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();
|
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();
|
refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -146,27 +126,13 @@ class AlbumRoll extends FlxSpriteGroup
|
||||||
|
|
||||||
if (exitMovers == null) return;
|
if (exitMovers == null) return;
|
||||||
|
|
||||||
exitMovers.set([albumArt],
|
exitMovers.set([newAlbumArt],
|
||||||
{
|
{
|
||||||
x: FlxG.width,
|
x: FlxG.width,
|
||||||
speed: 0.4,
|
speed: 0.4,
|
||||||
wait: 0
|
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],
|
exitMovers.set([difficultyStars],
|
||||||
{
|
{
|
||||||
x: FlxG.width * 1.2,
|
x: FlxG.width * 1.2,
|
||||||
|
@ -182,22 +148,21 @@ class AlbumRoll extends FlxSpriteGroup
|
||||||
*/
|
*/
|
||||||
public function playIntro():Void
|
public function playIntro():Void
|
||||||
{
|
{
|
||||||
albumArt.visible = true;
|
newAlbumArt.visible = true;
|
||||||
FlxTween.tween(albumArt, {x: 950, y: 320, angle: -340}, 0.5, {ease: FlxEase.elasticOut});
|
newAlbumArt.playAnimation(animNames.get('$albumId-active'), false, false, false);
|
||||||
|
|
||||||
albumTitle.visible = false;
|
difficultyStars.stars.visible = false;
|
||||||
|
new FlxTimer().start(0.75, function(_) {
|
||||||
if (titleTimer != null)
|
// showTitle();
|
||||||
{
|
showStars();
|
||||||
titleTimer.cancel();
|
|
||||||
titleTimer = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
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
|
public function setDifficultyStars(?difficulty:Int):Void
|
||||||
{
|
{
|
||||||
if (difficulty == null) return;
|
if (difficulty == null) return;
|
||||||
|
@ -205,19 +170,11 @@ class AlbumRoll extends FlxSpriteGroup
|
||||||
difficultyStars.difficulty = difficulty;
|
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.
|
* Make the album stars visible.
|
||||||
*/
|
*/
|
||||||
public function showStars():Void
|
public function showStars():Void
|
||||||
{
|
{
|
||||||
// albumArtist.visible = false;
|
difficultyStars.stars.visible = false; // true;
|
||||||
difficultyStars.stars.visible = false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -469,14 +469,6 @@ class FreeplayState extends MusicBeatSubState
|
||||||
|
|
||||||
albumRoll.playIntro();
|
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});
|
FlxTween.tween(grpDifficulties, {x: 90}, 0.6, {ease: FlxEase.quartOut});
|
||||||
|
|
||||||
var diffSelLeft:DifficultySelector = new DifficultySelector(20, grpDifficulties.y - 10, false, controls);
|
var diffSelLeft:DifficultySelector = new DifficultySelector(20, grpDifficulties.y - 10, false, controls);
|
||||||
|
@ -1055,7 +1047,7 @@ class FreeplayState extends MusicBeatSubState
|
||||||
if (albumRoll.albumId != newAlbumId)
|
if (albumRoll.albumId != newAlbumId)
|
||||||
{
|
{
|
||||||
albumRoll.albumId = newAlbumId;
|
albumRoll.albumId = newAlbumId;
|
||||||
albumRoll.playIntro();
|
albumRoll.skipIntro();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue