1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-12-27 15:37:49 +00:00

timeline viewer in progress

This commit is contained in:
Cameron Taylor 2021-08-19 14:53:18 -04:00
parent 8b172ac99d
commit b48685519a
6 changed files with 103 additions and 1 deletions

View file

@ -6,20 +6,28 @@ import flixel.addons.display.FlxGridOverlay;
class AnimTestStage extends FlxState
{
var tl:AnimateTimeline;
var swag:FlxAnimate;
override function create()
{
var bg:FlxSprite = FlxGridOverlay.create(32, 32);
add(bg);
bg.scrollFactor.set();
var swag:FlxAnimate = new FlxAnimate(200, 200);
swag = new FlxAnimate(200, 200);
add(swag);
tl = new AnimateTimeline(Paths.file('images/tightBarsLol/Animation.json'));
add(tl);
super.create();
}
override function update(elapsed:Float)
{
tl.curFrame = swag.daFrame;
CoolUtil.mouseWheelZoom();
CoolUtil.mouseCamDrag();

View file

@ -0,0 +1,75 @@
package animate;
import animate.FlxSymbol.Parsed;
import animate.FlxSymbol.Timeline;
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>
{
var coolParsed:Parsed;
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();
hudCamShit = new FlxCamera();
hudCamShit.bgColor = null;
FlxG.cameras.add(hudCamShit, false);
playhead = new FlxSprite(0, -12).makeGraphic(2, 10, FlxColor.MAGENTA);
add(playhead);
hudCamShit.follow(playhead);
hudCamShit.setScrollBounds(0, null, -14, null);
curFrame = 0;
coolParsed = cast Json.parse(Assets.getText(parsed));
var layerNum:Int = 0;
for (layer in coolParsed.AN.TL.L)
{
var frameNum:Int = 0;
for (frame in layer.FR)
{
var coolFrame:TimelineFrame = new TimelineFrame((frame.I * 12) + 12 * 5, layerNum * 12, frame.DU);
add(coolFrame);
frameNum++;
}
var layerName:FlxText = new FlxText(0, layerNum * 12, 0, layer.LN, 10);
layerName.color = FlxColor.PURPLE;
layerName.scrollFactor.x = 0;
var layerBG:FlxSprite = new FlxSprite(0, layerNum * 12).makeGraphic(12 * 4, 12);
layerBG.scrollFactor.x = 0;
add(layerBG);
add(layerName);
layerNum++;
}
this.cameras = [hudCamShit];
}
}

View file

@ -26,6 +26,8 @@ class FlxAnimate extends FlxSymbol
{
var folder:String = 'tightBarsLol';
coolParse = cast Json.parse(Assets.getText(Paths.file('images/' + folder + '/Animation.json')));
// reverses the layers, for proper rendering!
coolParse.AN.TL.L.reverse();
super(x, y, coolParse);

View file

@ -68,6 +68,7 @@ class FlxSymbol extends FlxSprite
{
case LOOP:
var tempFrame = layer.FR[newFrameNum + firstFrame % layer.FR.length];
trace(tempFrame);
// newFrameNum += firstFrame;
// newFrameNum = newFrameNum % (tempFrame.I + tempFrame.DU);
// newFrameNum = FlxMath.wrap(newFrameNum, tempFrame.I, tempFrame.I + tempFrame.DU);

View file

@ -0,0 +1,14 @@
package animate;
import flixel.FlxSprite;
import flixel.util.FlxColor;
class TimelineFrame extends FlxSprite
{
public function new(x:Float, y:Float, length:Int = 0)
{
super(x, y);
makeGraphic((10 * length) + (2 * (length - 1)), 10, FlxColor.RED);
}
}

View file

@ -29,6 +29,8 @@ class TitleOutline extends FlxShader
uniform float xPos;
uniform float yPos;
uniform int numoutlines = 1;
vec3 rgb2hsv(vec3 c)
{
vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);