From 0a0a1c4e2fe34bb7f1b33f644f799744d238be0f Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Fri, 20 Aug 2021 11:01:37 -0400 Subject: [PATCH] more timeline shit in progress --- source/animate/AnimateTimeline.hx | 2 +- source/animate/FlxSymbol.hx | 2 +- source/animate/TimelineFrame.hx | 51 ++++++++++++++++++++++++++++++- 3 files changed, 52 insertions(+), 3 deletions(-) diff --git a/source/animate/AnimateTimeline.hx b/source/animate/AnimateTimeline.hx index e323130f0..6153a4dc0 100644 --- a/source/animate/AnimateTimeline.hx +++ b/source/animate/AnimateTimeline.hx @@ -52,7 +52,7 @@ class AnimateTimeline extends FlxTypedGroup for (frame in layer.FR) { - var coolFrame:TimelineFrame = new TimelineFrame((frame.I * 12) + 12 * 5, layerNum * 12, frame.DU); + var coolFrame:TimelineFrame = new TimelineFrame((frame.I * 12) + 12 * 5, layerNum * 12, frame.DU, frame); add(coolFrame); frameNum++; } diff --git a/source/animate/FlxSymbol.hx b/source/animate/FlxSymbol.hx index b2e27469d..a3bc2bc80 100644 --- a/source/animate/FlxSymbol.hx +++ b/source/animate/FlxSymbol.hx @@ -68,7 +68,7 @@ class FlxSymbol extends FlxSprite { case LOOP: var tempFrame = layer.FR[newFrameNum + firstFrame % layer.FR.length]; - trace(tempFrame); + // trace(tempFrame); // newFrameNum += firstFrame; // newFrameNum = newFrameNum % (tempFrame.I + tempFrame.DU); // newFrameNum = FlxMath.wrap(newFrameNum, tempFrame.I, tempFrame.I + tempFrame.DU); diff --git a/source/animate/TimelineFrame.hx b/source/animate/TimelineFrame.hx index 2aeb1fec3..629e91f62 100644 --- a/source/animate/TimelineFrame.hx +++ b/source/animate/TimelineFrame.hx @@ -1,14 +1,63 @@ package animate; +import animate.FlxSymbol.Frame; import flixel.FlxSprite; +import flixel.input.mouse.FlxMouseEventManager; import flixel.util.FlxColor; class TimelineFrame extends FlxSprite { - public function new(x:Float, y:Float, length:Int = 0) + public var data:Frame; + + public function new(x:Float, y:Float, length:Int = 0, data:Frame) { super(x, y); + this.data = data; + makeGraphic((10 * length) + (2 * (length - 1)), 10, FlxColor.RED); + + FlxMouseEventManager.add(this, null, null, function(spr:TimelineFrame) + { + alpha = 0.5; + }, function(spr:TimelineFrame) + { + alpha = 1; + }, false, true, true); + } + + override function update(elapsed:Float) + { + // if (FlxG.mouse.overlaps(this, cameras[1])) + // alpha = 0.6; + // else + // alpha = 1; + + if (FlxG.mouse.overlaps(this, cameras[0]) && FlxG.mouse.justPressed) + { + trace("\nFRAME DATA - \n\tFRAME NUM: " + data.I + "\n\tFRAME DURATION: " + data.DU); + + for (e in data.E) + { + var elementOutput:String = "\n"; + + if (Reflect.hasField(e, 'ASI')) + { + elementOutput += "ELEMENT IS ASI!"; + + elementOutput += "\n\t"; + elementOutput += "FRAME NAME: " + e.ASI.N; + } + else + { + elementOutput += "ELEMENT IS SYMBOL INSTANCE!"; + elementOutput += "\n\tSYMBOL NAME: " + e.SI.SN; + } + + trace(elementOutput); + } + } + + super.update(elapsed); } }