Funkin/source/funkin/animate/AnimateTimeline.hx

76 lines
1.6 KiB
Haxe
Raw Normal View History

package funkin.animate;
2021-08-19 14:53:18 -04: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 15:34:20 -04:00
// var coolParsed:Parsed;
2021-08-19 14:53:18 -04: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 15:34:20 -04:00
/* hudCamShit = new FlxCamera();
hudCamShit.bgColor = FlxColor.TRANSPARENT;
FlxG.cameras.add(hudCamShit, false);
2021-08-19 14:53:18 -04:00
2021-09-01 15:34:20 -04:00
playhead = new FlxSprite(0, -12).makeGraphic(2, 10, FlxColor.MAGENTA);
add(playhead);
2021-08-19 14:53:18 -04:00
2021-09-01 15:34:20 -04:00
hudCamShit.follow(playhead);
hudCamShit.setScrollBounds(0, null, -14, null);
2021-08-19 14:53:18 -04:00
2021-09-01 15:34:20 -04:00
curFrame = 0;
2021-08-19 14:53:18 -04:00
2021-09-01 15:34:20 -04:00
coolParsed = cast Json.parse(Assets.getText(parsed));
2021-08-19 14:53:18 -04:00
2021-09-01 15:34:20 -04:00
var layerNum:Int = 0;
for (layer in coolParsed.AN.TL.L)
{
var frameNum:Int = 0;
2021-08-19 14:53:18 -04:00
2021-09-01 15:34:20 -04: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 14:53:18 -04:00
2021-09-01 15:34:20 -04:00
var layerName:FlxText = new FlxText(0, layerNum * 12, 0, layer.LN, 10);
layerName.color = FlxColor.PURPLE;
layerName.scrollFactor.x = 0;
2021-08-19 14:53:18 -04:00
2021-09-01 15:34:20 -04:00
var layerBG:FlxSprite = new FlxSprite(0, layerNum * 12).makeGraphic(12 * 4, 12);
layerBG.scrollFactor.x = 0;
2021-08-19 14:53:18 -04:00
2021-09-01 15:34:20 -04:00
add(layerBG);
add(layerName);
2021-08-19 14:53:18 -04:00
2021-09-01 15:34:20 -04:00
layerNum++;
}
2021-08-19 14:53:18 -04:00
2021-09-01 15:34:20 -04:00
this.cameras = [hudCamShit];
*/
2021-08-19 14:53:18 -04:00
}
}