diff --git a/flare_dart/lib/actor.dart b/flare_dart/lib/actor.dart index 8d7acfd..084817d 100644 --- a/flare_dart/lib/actor.dart +++ b/flare_dart/lib/actor.dart @@ -1,18 +1,19 @@ import 'dart:async'; -import "dart:typed_data"; import "dart:convert"; -import "actor_image.dart"; -import "actor_shape.dart"; +import "dart:typed_data"; + +import "actor_artboard.dart"; +import "actor_color.dart"; import "actor_ellipse.dart"; +import "actor_image.dart"; +import "actor_path.dart"; import "actor_polygon.dart"; import "actor_rectangle.dart"; +import "actor_shape.dart"; import "actor_star.dart"; import "actor_triangle.dart"; -import "actor_path.dart"; -import "actor_color.dart"; -import "stream_reader.dart"; import "block_types.dart"; -import "actor_artboard.dart"; +import "stream_reader.dart"; abstract class Actor { int maxTextureIndex = 0; diff --git a/flare_dart/lib/actor_artboard.dart b/flare_dart/lib/actor_artboard.dart index 779ccd2..349aa27 100644 --- a/flare_dart/lib/actor_artboard.dart +++ b/flare_dart/lib/actor_artboard.dart @@ -1,38 +1,39 @@ -import "actor_flags.dart"; -import "block_types.dart"; -import "actor_node.dart"; +import "dart:math"; +import "dart:typed_data"; + +import "actor.dart"; import "actor_bone.dart"; +import "actor_color.dart"; import "actor_component.dart"; import "actor_distance_constraint.dart"; +import "actor_drawable.dart"; +import "actor_ellipse.dart"; import "actor_event.dart"; +import "actor_flags.dart"; +import "actor_ik_constraint.dart"; +import "actor_image.dart"; +import "actor_jelly_bone.dart"; +import "actor_node.dart"; import "actor_node_solo.dart"; +import "actor_path.dart"; +import "actor_polygon.dart"; +import "actor_rectangle.dart"; import "actor_root_bone.dart"; -import "actor_jelly_bone.dart"; +import "actor_rotation_constraint.dart"; import "actor_scale_constraint.dart"; +import "actor_shape.dart"; import "actor_skin.dart"; -import "actor_path.dart"; +import "actor_star.dart"; import "actor_transform_constraint.dart"; import "actor_translation_constraint.dart"; -import "jelly_component.dart"; -import "actor_ik_constraint.dart"; -import "actor_rotation_constraint.dart"; -import "actor_image.dart"; -import "actor_drawable.dart"; -import "actor_shape.dart"; -import "actor_ellipse.dart"; -import "actor_polygon.dart"; -import "actor_rectangle.dart"; -import "actor_star.dart"; import "actor_triangle.dart"; -import "actor_color.dart"; import "animation/actor_animation.dart"; +import "block_types.dart"; import "dependency_sorter.dart"; -import "actor.dart"; -import "stream_reader.dart"; -import "math/vec2d.dart"; -import "dart:typed_data"; +import "jelly_component.dart"; import "math/aabb.dart"; -import "dart:math"; +import "math/vec2d.dart"; +import "stream_reader.dart"; class ActorArtboard { int _flags = ActorFlags.IsDrawOrderDirty; diff --git a/flare_dart/lib/actor_color.dart b/flare_dart/lib/actor_color.dart index 7b4b89b..d904d92 100644 --- a/flare_dart/lib/actor_color.dart +++ b/flare_dart/lib/actor_color.dart @@ -1,15 +1,14 @@ +import "dart:collection"; import "dart:typed_data"; -import 'math/mat2d.dart'; -import "actor_node.dart"; -import "actor_shape.dart"; import "actor_artboard.dart"; - import "actor_component.dart"; -import "dart:collection"; -import "stream_reader.dart"; -import "math/vec2d.dart"; import "actor_flags.dart"; +import "actor_node.dart"; +import "actor_shape.dart"; +import 'math/mat2d.dart'; +import "math/vec2d.dart"; +import "stream_reader.dart"; enum FillRule { EvenOdd, NonZero } enum StrokeCap { Butt, Round, Square } @@ -53,6 +52,7 @@ abstract class ActorPaint extends ActorComponent { return component; } + @override void completeResolve() { artboard.addDependency(this, parent); } @@ -103,7 +103,10 @@ abstract class ActorColor extends ActorPaint { return component; } + @override void onDirty(int dirt) {} + + @override void update(int dirt) {} } @@ -221,6 +224,7 @@ abstract class ColorFill extends ActorColor with ActorFill { return component; } + @override void completeResolve() { super.completeResolve(); @@ -244,6 +248,7 @@ abstract class ColorStroke extends ActorColor with ActorStroke { return component; } + @override void completeResolve() { super.completeResolve(); @@ -256,11 +261,12 @@ abstract class ColorStroke extends ActorColor with ActorStroke { abstract class GradientColor extends ActorPaint { Float32List _colorStops = Float32List(10); - Vec2D _start = Vec2D(); - Vec2D _end = Vec2D(); - Vec2D _renderStart = Vec2D(); - Vec2D _renderEnd = Vec2D(); - double opacity = 1.0; + final Vec2D _start = Vec2D(); + final Vec2D _end = Vec2D(); + final Vec2D _renderStart = Vec2D(); + final Vec2D _renderEnd = Vec2D(); + @override + final double opacity = 1.0; Vec2D get start => _start; Vec2D get end => _end; @@ -293,9 +299,12 @@ abstract class GradientColor extends ActorPaint { return component; } + @override void onDirty(int dirt) {} + + @override void update(int dirt) { - ActorShape shape = parent; + ActorShape shape = parent as ActorShape; Mat2D world = shape.worldTransform; Vec2D.transformMat2D(_renderStart, _start, world); Vec2D.transformMat2D(_renderEnd, _end, world); @@ -315,6 +324,7 @@ abstract class GradientFill extends GradientColor with ActorFill { return component; } + @override void completeResolve() { super.completeResolve(); @@ -338,6 +348,7 @@ abstract class GradientStroke extends GradientColor with ActorStroke { return component; } + @override void completeResolve() { super.completeResolve(); @@ -381,6 +392,7 @@ abstract class RadialGradientFill extends RadialGradientColor with ActorFill { return component; } + @override void completeResolve() { super.completeResolve(); @@ -406,6 +418,7 @@ abstract class RadialGradientStroke extends RadialGradientColor return component; } + @override void completeResolve() { super.completeResolve(); diff --git a/flare_dart/lib/actor_event.dart b/flare_dart/lib/actor_event.dart index 2c577f1..755cd20 100644 --- a/flare_dart/lib/actor_event.dart +++ b/flare_dart/lib/actor_event.dart @@ -1,5 +1,5 @@ -import "actor_component.dart"; import "actor_artboard.dart"; +import "actor_component.dart"; import "stream_reader.dart"; class ActorEvent extends ActorComponent { @@ -14,13 +14,19 @@ class ActorEvent extends ActorComponent { return component; } + @override ActorComponent makeInstance(ActorArtboard resetArtboard) { ActorEvent instanceEvent = ActorEvent(); instanceEvent.copyComponent(this, resetArtboard); return instanceEvent; } + @override void completeResolve() {} + + @override void onDirty(int dirt) {} + + @override void update(int dirt) {} } diff --git a/flare_dart/lib/animation/actor_animation.dart b/flare_dart/lib/animation/actor_animation.dart index ce15bbc..5703864 100644 --- a/flare_dart/lib/animation/actor_animation.dart +++ b/flare_dart/lib/animation/actor_animation.dart @@ -397,8 +397,8 @@ class ActorAnimation { // We distinguish between animated and triggered components as ActorEvents // are currently only used to trigger events and don't need the full - // animation cycle. This lets them optimize them out of the regular animation - // cycle. + // animation cycle. This lets them optimize them out of the regular + // animation cycle. int animatedComponentCount = 0; int triggerComponentCount = 0;