1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-12-01 11:13:06 +00:00
Funkin/source/animate/AnimateTimeline.hx

78 lines
1.7 KiB
Haxe
Raw Normal View History

2021-08-19 18:53:18 +00:00
package animate;
2021-09-01 19:34:20 +00:00
// import animate.FlxSymbol.Parsed;
// import animate.FlxSymbol.Timeline;
2021-08-19 18:53:18 +00:00
import flixel.FlxCamera;
import flixel.FlxSprite;
import flixel.group.FlxGroup.FlxTypedGroup;
import flixel.group.FlxGroup;
import flixel.text.FlxText;
import flixel.util.FlxColor;
import haxe.Json;
import lime.utils.Assets;
class AnimateTimeline extends FlxTypedGroup<FlxSprite>
{
2021-09-01 19:34:20 +00:00
// var coolParsed:Parsed;
2021-08-19 18:53:18 +00:00
var playhead:FlxSprite;
public var curFrame(default, set):Int;
function set_curFrame(frm:Int):Int
{
if (playhead != null)
playhead.x = 5 + (frm * 12) + (12 * 5);
return frm;
}
var hudCamShit:FlxCamera;
public function new(parsed:String)
{
super();
2021-09-01 19:34:20 +00:00
/* hudCamShit = new FlxCamera();
hudCamShit.bgColor = FlxColor.TRANSPARENT;
FlxG.cameras.add(hudCamShit, false);
2021-08-19 18:53:18 +00:00
2021-09-01 19:34:20 +00:00
playhead = new FlxSprite(0, -12).makeGraphic(2, 10, FlxColor.MAGENTA);
add(playhead);
2021-08-19 18:53:18 +00:00
2021-09-01 19:34:20 +00:00
hudCamShit.follow(playhead);
hudCamShit.setScrollBounds(0, null, -14, null);
2021-08-19 18:53:18 +00:00
2021-09-01 19:34:20 +00:00
curFrame = 0;
2021-08-19 18:53:18 +00:00
2021-09-01 19:34:20 +00:00
coolParsed = cast Json.parse(Assets.getText(parsed));
2021-08-19 18:53:18 +00:00
2021-09-01 19:34:20 +00:00
var layerNum:Int = 0;
for (layer in coolParsed.AN.TL.L)
{
var frameNum:Int = 0;
2021-08-19 18:53:18 +00:00
2021-09-01 19:34:20 +00:00
for (frame in layer.FR)
{
var coolFrame:TimelineFrame = new TimelineFrame((frame.I * 12) + 12 * 5, layerNum * 12, frame.DU, frame);
add(coolFrame);
frameNum++;
}
2021-08-19 18:53:18 +00:00
2021-09-01 19:34:20 +00:00
var layerName:FlxText = new FlxText(0, layerNum * 12, 0, layer.LN, 10);
layerName.color = FlxColor.PURPLE;
layerName.scrollFactor.x = 0;
2021-08-19 18:53:18 +00:00
2021-09-01 19:34:20 +00:00
var layerBG:FlxSprite = new FlxSprite(0, layerNum * 12).makeGraphic(12 * 4, 12);
layerBG.scrollFactor.x = 0;
2021-08-19 18:53:18 +00:00
2021-09-01 19:34:20 +00:00
add(layerBG);
add(layerName);
2021-08-19 18:53:18 +00:00
2021-09-01 19:34:20 +00:00
layerNum++;
}
2021-08-19 18:53:18 +00:00
2021-09-01 19:34:20 +00:00
this.cameras = [hudCamShit];
*/
2021-08-19 18:53:18 +00:00
}
}