mirror of
https://github.com/rive-app/rive-flutter.git
synced 2025-06-28 10:46:09 +08:00
Ran generator for constraints.
This commit is contained in:
@ -1,10 +1,10 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:rive_example/custom_controller.dart';
|
import 'package:rive_example/custom_controller.dart';
|
||||||
import 'package:rive_example/play_one_shot_animation.dart';
|
|
||||||
import 'package:rive_example/play_pause_animation.dart';
|
|
||||||
import 'package:rive_example/example_state_machine.dart';
|
import 'package:rive_example/example_state_machine.dart';
|
||||||
import 'package:rive_example/liquid_download.dart';
|
import 'package:rive_example/liquid_download.dart';
|
||||||
import 'package:rive_example/little_machine.dart';
|
import 'package:rive_example/little_machine.dart';
|
||||||
|
import 'package:rive_example/play_one_shot_animation.dart';
|
||||||
|
import 'package:rive_example/play_pause_animation.dart';
|
||||||
import 'package:rive_example/simple_animation.dart';
|
import 'package:rive_example/simple_animation.dart';
|
||||||
import 'package:rive_example/simple_state_machine.dart';
|
import 'package:rive_example/simple_state_machine.dart';
|
||||||
import 'package:rive_example/state_machine_skills.dart';
|
import 'package:rive_example/state_machine_skills.dart';
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
library rive;
|
library rive;
|
||||||
|
|
||||||
export 'package:rive/src/controllers/simple_controller.dart';
|
|
||||||
export 'package:rive/src/controllers/one_shot_controller.dart';
|
export 'package:rive/src/controllers/one_shot_controller.dart';
|
||||||
|
export 'package:rive/src/controllers/simple_controller.dart';
|
||||||
|
export 'package:rive/src/controllers/state_machine_controller.dart';
|
||||||
export 'package:rive/src/extensions.dart';
|
export 'package:rive/src/extensions.dart';
|
||||||
export 'package:rive/src/extensions.dart';
|
export 'package:rive/src/extensions.dart';
|
||||||
export 'package:rive/src/rive.dart';
|
export 'package:rive/src/rive.dart';
|
||||||
@ -21,5 +22,4 @@ export 'package:rive/src/rive_core/shapes/paint/stroke.dart';
|
|||||||
export 'package:rive/src/rive_core/shapes/shape.dart';
|
export 'package:rive/src/rive_core/shapes/shape.dart';
|
||||||
export 'package:rive/src/rive_file.dart';
|
export 'package:rive/src/rive_file.dart';
|
||||||
export 'package:rive/src/runtime_artboard.dart';
|
export 'package:rive/src/runtime_artboard.dart';
|
||||||
export 'package:rive/src/controllers/state_machine_controller.dart';
|
|
||||||
export 'package:rive/src/widgets/rive_animation.dart';
|
export 'package:rive/src/widgets/rive_animation.dart';
|
||||||
|
@ -2,22 +2,23 @@ import 'dart:collection';
|
|||||||
|
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:rive/src/rive_core/runtime/exceptions/rive_format_error_exception.dart';
|
import 'package:rive/src/rive_core/runtime/exceptions/rive_format_error_exception.dart';
|
||||||
|
|
||||||
export 'package:rive/src/animation_list.dart';
|
export 'package:rive/src/animation_list.dart';
|
||||||
export 'package:rive/src/state_machine_components.dart';
|
|
||||||
export 'package:rive/src/blend_animations.dart';
|
export 'package:rive/src/blend_animations.dart';
|
||||||
export 'package:rive/src/state_transition_conditions.dart';
|
|
||||||
export 'package:rive/src/state_transitions.dart';
|
|
||||||
export 'package:rive/src/container_children.dart';
|
export 'package:rive/src/container_children.dart';
|
||||||
export 'package:rive/src/runtime_artboard.dart';
|
|
||||||
export 'package:rive/src/generated/rive_core_context.dart';
|
|
||||||
export 'package:rive/src/core/importers/artboard_importer.dart';
|
export 'package:rive/src/core/importers/artboard_importer.dart';
|
||||||
export 'package:rive/src/core/importers/linear_animation_importer.dart';
|
|
||||||
export 'package:rive/src/core/importers/keyed_object_importer.dart';
|
export 'package:rive/src/core/importers/keyed_object_importer.dart';
|
||||||
export 'package:rive/src/core/importers/keyed_property_importer.dart';
|
export 'package:rive/src/core/importers/keyed_property_importer.dart';
|
||||||
|
export 'package:rive/src/core/importers/layer_state_importer.dart';
|
||||||
|
export 'package:rive/src/core/importers/linear_animation_importer.dart';
|
||||||
export 'package:rive/src/core/importers/state_machine_importer.dart';
|
export 'package:rive/src/core/importers/state_machine_importer.dart';
|
||||||
export 'package:rive/src/core/importers/state_machine_layer_importer.dart';
|
export 'package:rive/src/core/importers/state_machine_layer_importer.dart';
|
||||||
export 'package:rive/src/core/importers/layer_state_importer.dart';
|
|
||||||
export 'package:rive/src/core/importers/state_transition_importer.dart';
|
export 'package:rive/src/core/importers/state_transition_importer.dart';
|
||||||
|
export 'package:rive/src/generated/rive_core_context.dart';
|
||||||
|
export 'package:rive/src/runtime_artboard.dart';
|
||||||
|
export 'package:rive/src/state_machine_components.dart';
|
||||||
|
export 'package:rive/src/state_transition_conditions.dart';
|
||||||
|
export 'package:rive/src/state_transitions.dart';
|
||||||
|
|
||||||
typedef PropertyChangeCallback = void Function(dynamic from, dynamic to);
|
typedef PropertyChangeCallback = void Function(dynamic from, dynamic to);
|
||||||
typedef BatchAddCallback = void Function();
|
typedef BatchAddCallback = void Function();
|
||||||
|
44
lib/src/generated/constraints/constraint_base.dart
Normal file
44
lib/src/generated/constraints/constraint_base.dart
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
/// Core automatically generated
|
||||||
|
/// lib/src/generated/constraints/constraint_base.dart.
|
||||||
|
/// Do not modify manually.
|
||||||
|
|
||||||
|
import 'package:rive/src/generated/component_base.dart';
|
||||||
|
import 'package:rive/src/rive_core/component.dart';
|
||||||
|
|
||||||
|
abstract class ConstraintBase extends Component {
|
||||||
|
static const int typeKey = 79;
|
||||||
|
@override
|
||||||
|
int get coreType => ConstraintBase.typeKey;
|
||||||
|
@override
|
||||||
|
Set<int> get coreTypes => {ConstraintBase.typeKey, ComponentBase.typeKey};
|
||||||
|
|
||||||
|
/// --------------------------------------------------------------------------
|
||||||
|
/// Strength field with key 172.
|
||||||
|
static const double strengthInitialValue = 1.0;
|
||||||
|
double _strength = strengthInitialValue;
|
||||||
|
static const int strengthPropertyKey = 172;
|
||||||
|
|
||||||
|
/// Strength of the constraint. 0 means off. 1 means fully constraining.
|
||||||
|
double get strength => _strength;
|
||||||
|
|
||||||
|
/// Change the [_strength] field value.
|
||||||
|
/// [strengthChanged] will be invoked only if the field's value has changed.
|
||||||
|
set strength(double value) {
|
||||||
|
if (_strength == value) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
double from = _strength;
|
||||||
|
_strength = value;
|
||||||
|
if (hasValidated) {
|
||||||
|
strengthChanged(from, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void strengthChanged(double from, double to);
|
||||||
|
|
||||||
|
@override
|
||||||
|
void copy(ConstraintBase source) {
|
||||||
|
super.copy(source);
|
||||||
|
_strength = source._strength;
|
||||||
|
}
|
||||||
|
}
|
80
lib/src/generated/constraints/ik_constraint_base.dart
Normal file
80
lib/src/generated/constraints/ik_constraint_base.dart
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
/// Core automatically generated
|
||||||
|
/// lib/src/generated/constraints/ik_constraint_base.dart.
|
||||||
|
/// Do not modify manually.
|
||||||
|
|
||||||
|
import 'package:rive/src/generated/component_base.dart';
|
||||||
|
import 'package:rive/src/generated/constraints/constraint_base.dart';
|
||||||
|
import 'package:rive/src/generated/constraints/targeted_constraint_base.dart';
|
||||||
|
import 'package:rive/src/rive_core/constraints/targeted_constraint.dart';
|
||||||
|
|
||||||
|
abstract class IKConstraintBase extends TargetedConstraint {
|
||||||
|
static const int typeKey = 81;
|
||||||
|
@override
|
||||||
|
int get coreType => IKConstraintBase.typeKey;
|
||||||
|
@override
|
||||||
|
Set<int> get coreTypes => {
|
||||||
|
IKConstraintBase.typeKey,
|
||||||
|
TargetedConstraintBase.typeKey,
|
||||||
|
ConstraintBase.typeKey,
|
||||||
|
ComponentBase.typeKey
|
||||||
|
};
|
||||||
|
|
||||||
|
/// --------------------------------------------------------------------------
|
||||||
|
/// InvertDirection field with key 174.
|
||||||
|
static const bool invertDirectionInitialValue = false;
|
||||||
|
bool _invertDirection = invertDirectionInitialValue;
|
||||||
|
static const int invertDirectionPropertyKey = 174;
|
||||||
|
|
||||||
|
/// True when the direction taken towards the target should be inverted from
|
||||||
|
/// the default.
|
||||||
|
bool get invertDirection => _invertDirection;
|
||||||
|
|
||||||
|
/// Change the [_invertDirection] field value.
|
||||||
|
/// [invertDirectionChanged] will be invoked only if the field's value has
|
||||||
|
/// changed.
|
||||||
|
set invertDirection(bool value) {
|
||||||
|
if (_invertDirection == value) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
bool from = _invertDirection;
|
||||||
|
_invertDirection = value;
|
||||||
|
if (hasValidated) {
|
||||||
|
invertDirectionChanged(from, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void invertDirectionChanged(bool from, bool to);
|
||||||
|
|
||||||
|
/// --------------------------------------------------------------------------
|
||||||
|
/// ParentBoneCount field with key 175.
|
||||||
|
static const int parentBoneCountInitialValue = 0;
|
||||||
|
int _parentBoneCount = parentBoneCountInitialValue;
|
||||||
|
static const int parentBoneCountPropertyKey = 175;
|
||||||
|
|
||||||
|
/// The number of bones above this one that are influenced by this IK
|
||||||
|
/// constraint.
|
||||||
|
int get parentBoneCount => _parentBoneCount;
|
||||||
|
|
||||||
|
/// Change the [_parentBoneCount] field value.
|
||||||
|
/// [parentBoneCountChanged] will be invoked only if the field's value has
|
||||||
|
/// changed.
|
||||||
|
set parentBoneCount(int value) {
|
||||||
|
if (_parentBoneCount == value) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int from = _parentBoneCount;
|
||||||
|
_parentBoneCount = value;
|
||||||
|
if (hasValidated) {
|
||||||
|
parentBoneCountChanged(from, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void parentBoneCountChanged(int from, int to);
|
||||||
|
|
||||||
|
@override
|
||||||
|
void copy(IKConstraintBase source) {
|
||||||
|
super.copy(source);
|
||||||
|
_invertDirection = source._invertDirection;
|
||||||
|
_parentBoneCount = source._parentBoneCount;
|
||||||
|
}
|
||||||
|
}
|
50
lib/src/generated/constraints/targeted_constraint_base.dart
Normal file
50
lib/src/generated/constraints/targeted_constraint_base.dart
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
/// Core automatically generated
|
||||||
|
/// lib/src/generated/constraints/targeted_constraint_base.dart.
|
||||||
|
/// Do not modify manually.
|
||||||
|
|
||||||
|
import 'package:rive/src/generated/component_base.dart';
|
||||||
|
import 'package:rive/src/generated/constraints/constraint_base.dart';
|
||||||
|
import 'package:rive/src/rive_core/constraints/constraint.dart';
|
||||||
|
|
||||||
|
abstract class TargetedConstraintBase extends Constraint {
|
||||||
|
static const int typeKey = 80;
|
||||||
|
@override
|
||||||
|
int get coreType => TargetedConstraintBase.typeKey;
|
||||||
|
@override
|
||||||
|
Set<int> get coreTypes => {
|
||||||
|
TargetedConstraintBase.typeKey,
|
||||||
|
ConstraintBase.typeKey,
|
||||||
|
ComponentBase.typeKey
|
||||||
|
};
|
||||||
|
|
||||||
|
/// --------------------------------------------------------------------------
|
||||||
|
/// TargetId field with key 173.
|
||||||
|
static const int targetIdInitialValue = -1;
|
||||||
|
int _targetId = targetIdInitialValue;
|
||||||
|
static const int targetIdPropertyKey = 173;
|
||||||
|
|
||||||
|
/// Identifier used to track the TransformComponent used as the target for the
|
||||||
|
/// constraint.
|
||||||
|
int get targetId => _targetId;
|
||||||
|
|
||||||
|
/// Change the [_targetId] field value.
|
||||||
|
/// [targetIdChanged] will be invoked only if the field's value has changed.
|
||||||
|
set targetId(int value) {
|
||||||
|
if (_targetId == value) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int from = _targetId;
|
||||||
|
_targetId = value;
|
||||||
|
if (hasValidated) {
|
||||||
|
targetIdChanged(from, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void targetIdChanged(int from, int to);
|
||||||
|
|
||||||
|
@override
|
||||||
|
void copy(TargetedConstraintBase source) {
|
||||||
|
super.copy(source);
|
||||||
|
_targetId = source._targetId;
|
||||||
|
}
|
||||||
|
}
|
@ -45,6 +45,9 @@ import 'package:rive/src/generated/bones/skin_base.dart';
|
|||||||
import 'package:rive/src/generated/bones/tendon_base.dart';
|
import 'package:rive/src/generated/bones/tendon_base.dart';
|
||||||
import 'package:rive/src/generated/bones/weight_base.dart';
|
import 'package:rive/src/generated/bones/weight_base.dart';
|
||||||
import 'package:rive/src/generated/component_base.dart';
|
import 'package:rive/src/generated/component_base.dart';
|
||||||
|
import 'package:rive/src/generated/constraints/constraint_base.dart';
|
||||||
|
import 'package:rive/src/generated/constraints/ik_constraint_base.dart';
|
||||||
|
import 'package:rive/src/generated/constraints/targeted_constraint_base.dart';
|
||||||
import 'package:rive/src/generated/draw_rules_base.dart';
|
import 'package:rive/src/generated/draw_rules_base.dart';
|
||||||
import 'package:rive/src/generated/draw_target_base.dart';
|
import 'package:rive/src/generated/draw_target_base.dart';
|
||||||
import 'package:rive/src/generated/drawable_base.dart';
|
import 'package:rive/src/generated/drawable_base.dart';
|
||||||
@ -107,6 +110,7 @@ import 'package:rive/src/rive_core/bones/root_bone.dart';
|
|||||||
import 'package:rive/src/rive_core/bones/skin.dart';
|
import 'package:rive/src/rive_core/bones/skin.dart';
|
||||||
import 'package:rive/src/rive_core/bones/tendon.dart';
|
import 'package:rive/src/rive_core/bones/tendon.dart';
|
||||||
import 'package:rive/src/rive_core/bones/weight.dart';
|
import 'package:rive/src/rive_core/bones/weight.dart';
|
||||||
|
import 'package:rive/src/rive_core/constraints/ik_constraint.dart';
|
||||||
import 'package:rive/src/rive_core/draw_rules.dart';
|
import 'package:rive/src/rive_core/draw_rules.dart';
|
||||||
import 'package:rive/src/rive_core/draw_target.dart';
|
import 'package:rive/src/rive_core/draw_target.dart';
|
||||||
import 'package:rive/src/rive_core/node.dart';
|
import 'package:rive/src/rive_core/node.dart';
|
||||||
@ -136,6 +140,8 @@ class RiveCoreContext {
|
|||||||
switch (typeKey) {
|
switch (typeKey) {
|
||||||
case DrawTargetBase.typeKey:
|
case DrawTargetBase.typeKey:
|
||||||
return DrawTarget();
|
return DrawTarget();
|
||||||
|
case IKConstraintBase.typeKey:
|
||||||
|
return IKConstraint();
|
||||||
case AnimationStateBase.typeKey:
|
case AnimationStateBase.typeKey:
|
||||||
return AnimationState();
|
return AnimationState();
|
||||||
case KeyedObjectBase.typeKey:
|
case KeyedObjectBase.typeKey:
|
||||||
@ -273,6 +279,26 @@ class RiveCoreContext {
|
|||||||
object.placementValue = value;
|
object.placementValue = value;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case ConstraintBase.strengthPropertyKey:
|
||||||
|
if (object is ConstraintBase && value is double) {
|
||||||
|
object.strength = value;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case TargetedConstraintBase.targetIdPropertyKey:
|
||||||
|
if (object is TargetedConstraintBase && value is int) {
|
||||||
|
object.targetId = value;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case IKConstraintBase.invertDirectionPropertyKey:
|
||||||
|
if (object is IKConstraintBase && value is bool) {
|
||||||
|
object.invertDirection = value;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case IKConstraintBase.parentBoneCountPropertyKey:
|
||||||
|
if (object is IKConstraintBase && value is int) {
|
||||||
|
object.parentBoneCount = value;
|
||||||
|
}
|
||||||
|
break;
|
||||||
case AnimationStateBase.animationIdPropertyKey:
|
case AnimationStateBase.animationIdPropertyKey:
|
||||||
if (object is AnimationStateBase && value is int) {
|
if (object is AnimationStateBase && value is int) {
|
||||||
object.animationId = value;
|
object.animationId = value;
|
||||||
@ -879,8 +905,8 @@ class RiveCoreContext {
|
|||||||
static CoreFieldType stringType = CoreStringType();
|
static CoreFieldType stringType = CoreStringType();
|
||||||
static CoreFieldType uintType = CoreUintType();
|
static CoreFieldType uintType = CoreUintType();
|
||||||
static CoreFieldType doubleType = CoreDoubleType();
|
static CoreFieldType doubleType = CoreDoubleType();
|
||||||
static CoreFieldType colorType = CoreColorType();
|
|
||||||
static CoreFieldType boolType = CoreBoolType();
|
static CoreFieldType boolType = CoreBoolType();
|
||||||
|
static CoreFieldType colorType = CoreColorType();
|
||||||
static CoreFieldType? coreType(int propertyKey) {
|
static CoreFieldType? coreType(int propertyKey) {
|
||||||
switch (propertyKey) {
|
switch (propertyKey) {
|
||||||
case ComponentBase.namePropertyKey:
|
case ComponentBase.namePropertyKey:
|
||||||
@ -890,6 +916,8 @@ class RiveCoreContext {
|
|||||||
case ComponentBase.parentIdPropertyKey:
|
case ComponentBase.parentIdPropertyKey:
|
||||||
case DrawTargetBase.drawableIdPropertyKey:
|
case DrawTargetBase.drawableIdPropertyKey:
|
||||||
case DrawTargetBase.placementValuePropertyKey:
|
case DrawTargetBase.placementValuePropertyKey:
|
||||||
|
case TargetedConstraintBase.targetIdPropertyKey:
|
||||||
|
case IKConstraintBase.parentBoneCountPropertyKey:
|
||||||
case AnimationStateBase.animationIdPropertyKey:
|
case AnimationStateBase.animationIdPropertyKey:
|
||||||
case KeyedObjectBase.objectIdPropertyKey:
|
case KeyedObjectBase.objectIdPropertyKey:
|
||||||
case BlendAnimationBase.animationIdPropertyKey:
|
case BlendAnimationBase.animationIdPropertyKey:
|
||||||
@ -931,6 +959,7 @@ class RiveCoreContext {
|
|||||||
case DrawRulesBase.drawTargetIdPropertyKey:
|
case DrawRulesBase.drawTargetIdPropertyKey:
|
||||||
case TendonBase.boneIdPropertyKey:
|
case TendonBase.boneIdPropertyKey:
|
||||||
return uintType;
|
return uintType;
|
||||||
|
case ConstraintBase.strengthPropertyKey:
|
||||||
case StateMachineNumberBase.valuePropertyKey:
|
case StateMachineNumberBase.valuePropertyKey:
|
||||||
case TransitionNumberConditionBase.valuePropertyKey:
|
case TransitionNumberConditionBase.valuePropertyKey:
|
||||||
case CubicInterpolatorBase.x1PropertyKey:
|
case CubicInterpolatorBase.x1PropertyKey:
|
||||||
@ -1000,10 +1029,7 @@ class RiveCoreContext {
|
|||||||
case TendonBase.txPropertyKey:
|
case TendonBase.txPropertyKey:
|
||||||
case TendonBase.tyPropertyKey:
|
case TendonBase.tyPropertyKey:
|
||||||
return doubleType;
|
return doubleType;
|
||||||
case KeyFrameColorBase.valuePropertyKey:
|
case IKConstraintBase.invertDirectionPropertyKey:
|
||||||
case SolidColorBase.colorValuePropertyKey:
|
|
||||||
case GradientStopBase.colorValuePropertyKey:
|
|
||||||
return colorType;
|
|
||||||
case LinearAnimationBase.enableWorkAreaPropertyKey:
|
case LinearAnimationBase.enableWorkAreaPropertyKey:
|
||||||
case StateMachineBoolBase.valuePropertyKey:
|
case StateMachineBoolBase.valuePropertyKey:
|
||||||
case ShapePaintBase.isVisiblePropertyKey:
|
case ShapePaintBase.isVisiblePropertyKey:
|
||||||
@ -1012,6 +1038,10 @@ class RiveCoreContext {
|
|||||||
case RectangleBase.linkCornerRadiusPropertyKey:
|
case RectangleBase.linkCornerRadiusPropertyKey:
|
||||||
case ClippingShapeBase.isVisiblePropertyKey:
|
case ClippingShapeBase.isVisiblePropertyKey:
|
||||||
return boolType;
|
return boolType;
|
||||||
|
case KeyFrameColorBase.valuePropertyKey:
|
||||||
|
case SolidColorBase.colorValuePropertyKey:
|
||||||
|
case GradientStopBase.colorValuePropertyKey:
|
||||||
|
return colorType;
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -1037,6 +1067,10 @@ class RiveCoreContext {
|
|||||||
return (object as DrawTargetBase).drawableId;
|
return (object as DrawTargetBase).drawableId;
|
||||||
case DrawTargetBase.placementValuePropertyKey:
|
case DrawTargetBase.placementValuePropertyKey:
|
||||||
return (object as DrawTargetBase).placementValue;
|
return (object as DrawTargetBase).placementValue;
|
||||||
|
case TargetedConstraintBase.targetIdPropertyKey:
|
||||||
|
return (object as TargetedConstraintBase).targetId;
|
||||||
|
case IKConstraintBase.parentBoneCountPropertyKey:
|
||||||
|
return (object as IKConstraintBase).parentBoneCount;
|
||||||
case AnimationStateBase.animationIdPropertyKey:
|
case AnimationStateBase.animationIdPropertyKey:
|
||||||
return (object as AnimationStateBase).animationId;
|
return (object as AnimationStateBase).animationId;
|
||||||
case KeyedObjectBase.objectIdPropertyKey:
|
case KeyedObjectBase.objectIdPropertyKey:
|
||||||
@ -1123,6 +1157,8 @@ class RiveCoreContext {
|
|||||||
|
|
||||||
static double getDouble(Core object, int propertyKey) {
|
static double getDouble(Core object, int propertyKey) {
|
||||||
switch (propertyKey) {
|
switch (propertyKey) {
|
||||||
|
case ConstraintBase.strengthPropertyKey:
|
||||||
|
return (object as ConstraintBase).strength;
|
||||||
case StateMachineNumberBase.valuePropertyKey:
|
case StateMachineNumberBase.valuePropertyKey:
|
||||||
return (object as StateMachineNumberBase).value;
|
return (object as StateMachineNumberBase).value;
|
||||||
case TransitionNumberConditionBase.valuePropertyKey:
|
case TransitionNumberConditionBase.valuePropertyKey:
|
||||||
@ -1263,20 +1299,10 @@ class RiveCoreContext {
|
|||||||
return 0.0;
|
return 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int getColor(Core object, int propertyKey) {
|
|
||||||
switch (propertyKey) {
|
|
||||||
case KeyFrameColorBase.valuePropertyKey:
|
|
||||||
return (object as KeyFrameColorBase).value;
|
|
||||||
case SolidColorBase.colorValuePropertyKey:
|
|
||||||
return (object as SolidColorBase).colorValue;
|
|
||||||
case GradientStopBase.colorValuePropertyKey:
|
|
||||||
return (object as GradientStopBase).colorValue;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool getBool(Core object, int propertyKey) {
|
static bool getBool(Core object, int propertyKey) {
|
||||||
switch (propertyKey) {
|
switch (propertyKey) {
|
||||||
|
case IKConstraintBase.invertDirectionPropertyKey:
|
||||||
|
return (object as IKConstraintBase).invertDirection;
|
||||||
case LinearAnimationBase.enableWorkAreaPropertyKey:
|
case LinearAnimationBase.enableWorkAreaPropertyKey:
|
||||||
return (object as LinearAnimationBase).enableWorkArea;
|
return (object as LinearAnimationBase).enableWorkArea;
|
||||||
case StateMachineBoolBase.valuePropertyKey:
|
case StateMachineBoolBase.valuePropertyKey:
|
||||||
@ -1295,6 +1321,18 @@ class RiveCoreContext {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int getColor(Core object, int propertyKey) {
|
||||||
|
switch (propertyKey) {
|
||||||
|
case KeyFrameColorBase.valuePropertyKey:
|
||||||
|
return (object as KeyFrameColorBase).value;
|
||||||
|
case SolidColorBase.colorValuePropertyKey:
|
||||||
|
return (object as SolidColorBase).colorValue;
|
||||||
|
case GradientStopBase.colorValuePropertyKey:
|
||||||
|
return (object as GradientStopBase).colorValue;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static void setString(Core object, int propertyKey, String value) {
|
static void setString(Core object, int propertyKey, String value) {
|
||||||
switch (propertyKey) {
|
switch (propertyKey) {
|
||||||
case ComponentBase.namePropertyKey:
|
case ComponentBase.namePropertyKey:
|
||||||
@ -1332,6 +1370,16 @@ class RiveCoreContext {
|
|||||||
object.placementValue = value;
|
object.placementValue = value;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case TargetedConstraintBase.targetIdPropertyKey:
|
||||||
|
if (object is TargetedConstraintBase) {
|
||||||
|
object.targetId = value;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case IKConstraintBase.parentBoneCountPropertyKey:
|
||||||
|
if (object is IKConstraintBase) {
|
||||||
|
object.parentBoneCount = value;
|
||||||
|
}
|
||||||
|
break;
|
||||||
case AnimationStateBase.animationIdPropertyKey:
|
case AnimationStateBase.animationIdPropertyKey:
|
||||||
if (object is AnimationStateBase) {
|
if (object is AnimationStateBase) {
|
||||||
object.animationId = value;
|
object.animationId = value;
|
||||||
@ -1537,6 +1585,11 @@ class RiveCoreContext {
|
|||||||
|
|
||||||
static void setDouble(Core object, int propertyKey, double value) {
|
static void setDouble(Core object, int propertyKey, double value) {
|
||||||
switch (propertyKey) {
|
switch (propertyKey) {
|
||||||
|
case ConstraintBase.strengthPropertyKey:
|
||||||
|
if (object is ConstraintBase) {
|
||||||
|
object.strength = value;
|
||||||
|
}
|
||||||
|
break;
|
||||||
case StateMachineNumberBase.valuePropertyKey:
|
case StateMachineNumberBase.valuePropertyKey:
|
||||||
if (object is StateMachineNumberBase) {
|
if (object is StateMachineNumberBase) {
|
||||||
object.value = value;
|
object.value = value;
|
||||||
@ -1880,28 +1933,13 @@ class RiveCoreContext {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void setColor(Core object, int propertyKey, int value) {
|
|
||||||
switch (propertyKey) {
|
|
||||||
case KeyFrameColorBase.valuePropertyKey:
|
|
||||||
if (object is KeyFrameColorBase) {
|
|
||||||
object.value = value;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case SolidColorBase.colorValuePropertyKey:
|
|
||||||
if (object is SolidColorBase) {
|
|
||||||
object.colorValue = value;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case GradientStopBase.colorValuePropertyKey:
|
|
||||||
if (object is GradientStopBase) {
|
|
||||||
object.colorValue = value;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void setBool(Core object, int propertyKey, bool value) {
|
static void setBool(Core object, int propertyKey, bool value) {
|
||||||
switch (propertyKey) {
|
switch (propertyKey) {
|
||||||
|
case IKConstraintBase.invertDirectionPropertyKey:
|
||||||
|
if (object is IKConstraintBase) {
|
||||||
|
object.invertDirection = value;
|
||||||
|
}
|
||||||
|
break;
|
||||||
case LinearAnimationBase.enableWorkAreaPropertyKey:
|
case LinearAnimationBase.enableWorkAreaPropertyKey:
|
||||||
if (object is LinearAnimationBase) {
|
if (object is LinearAnimationBase) {
|
||||||
object.enableWorkArea = value;
|
object.enableWorkArea = value;
|
||||||
@ -1939,4 +1977,24 @@ class RiveCoreContext {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void setColor(Core object, int propertyKey, int value) {
|
||||||
|
switch (propertyKey) {
|
||||||
|
case KeyFrameColorBase.valuePropertyKey:
|
||||||
|
if (object is KeyFrameColorBase) {
|
||||||
|
object.value = value;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SolidColorBase.colorValuePropertyKey:
|
||||||
|
if (object is SolidColorBase) {
|
||||||
|
object.colorValue = value;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case GradientStopBase.colorValuePropertyKey:
|
||||||
|
if (object is GradientStopBase) {
|
||||||
|
object.colorValue = value;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -93,7 +93,11 @@ class RiveRenderObject extends RiveRenderBox {
|
|||||||
markNeedsLayout();
|
markNeedsLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
void dispose() => _artboard.redraw.removeListener(scheduleRepaint);
|
@override
|
||||||
|
void dispose() {
|
||||||
|
super.dispose();
|
||||||
|
_artboard.redraw.removeListener(scheduleRepaint);
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
AABB get aabb {
|
AABB get aabb {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import 'package:rive/src/core/core.dart';
|
import 'package:rive/src/core/core.dart';
|
||||||
|
import 'package:rive/src/generated/animation/animation_base.dart';
|
||||||
import 'package:rive/src/rive_core/artboard.dart';
|
import 'package:rive/src/rive_core/artboard.dart';
|
||||||
|
|
||||||
import 'package:rive/src/generated/animation/animation_base.dart';
|
|
||||||
export 'package:rive/src/generated/animation/animation_base.dart';
|
export 'package:rive/src/generated/animation/animation_base.dart';
|
||||||
|
|
||||||
class Animation extends AnimationBase<RuntimeArtboard> {
|
class Animation extends AnimationBase<RuntimeArtboard> {
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
import 'package:rive/src/core/core.dart';
|
import 'package:rive/src/core/core.dart';
|
||||||
|
import 'package:rive/src/generated/animation/animation_state_base.dart';
|
||||||
import 'package:rive/src/rive_core/animation/animation_state_instance.dart';
|
import 'package:rive/src/rive_core/animation/animation_state_instance.dart';
|
||||||
import 'package:rive/src/rive_core/animation/linear_animation.dart';
|
import 'package:rive/src/rive_core/animation/linear_animation.dart';
|
||||||
import 'package:rive/src/rive_core/animation/state_instance.dart';
|
import 'package:rive/src/rive_core/animation/state_instance.dart';
|
||||||
import 'package:rive/src/rive_core/artboard.dart';
|
import 'package:rive/src/rive_core/artboard.dart';
|
||||||
import 'package:rive/src/generated/animation/animation_state_base.dart';
|
|
||||||
export 'package:rive/src/generated/animation/animation_state_base.dart';
|
export 'package:rive/src/generated/animation/animation_state_base.dart';
|
||||||
|
|
||||||
class AnimationState extends AnimationStateBase {
|
class AnimationState extends AnimationStateBase {
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import 'package:rive/src/rive_core/animation/state_instance.dart';
|
|
||||||
import 'package:rive/src/generated/animation/any_state_base.dart';
|
import 'package:rive/src/generated/animation/any_state_base.dart';
|
||||||
|
import 'package:rive/src/rive_core/animation/state_instance.dart';
|
||||||
|
|
||||||
export 'package:rive/src/generated/animation/any_state_base.dart';
|
export 'package:rive/src/generated/animation/any_state_base.dart';
|
||||||
|
|
||||||
class AnyState extends AnyStateBase {
|
class AnyState extends AnyStateBase {
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
import 'package:rive/src/core/core.dart';
|
import 'package:rive/src/core/core.dart';
|
||||||
|
import 'package:rive/src/generated/animation/blend_animation_base.dart';
|
||||||
|
import 'package:rive/src/generated/artboard_base.dart';
|
||||||
import 'package:rive/src/rive_core/animation/layer_state.dart';
|
import 'package:rive/src/rive_core/animation/layer_state.dart';
|
||||||
import 'package:rive/src/rive_core/animation/linear_animation.dart';
|
import 'package:rive/src/rive_core/animation/linear_animation.dart';
|
||||||
import 'package:rive/src/rive_core/artboard.dart';
|
import 'package:rive/src/rive_core/artboard.dart';
|
||||||
import 'package:rive/src/generated/animation/blend_animation_base.dart';
|
|
||||||
import 'package:rive/src/generated/artboard_base.dart';
|
|
||||||
export 'package:rive/src/generated/animation/blend_animation_base.dart';
|
export 'package:rive/src/generated/animation/blend_animation_base.dart';
|
||||||
|
|
||||||
abstract class BlendAnimation extends BlendAnimationBase {
|
abstract class BlendAnimation extends BlendAnimationBase {
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
import 'package:rive/src/core/core.dart';
|
import 'package:rive/src/core/core.dart';
|
||||||
|
import 'package:rive/src/generated/animation/blend_animation_direct_base.dart';
|
||||||
import 'package:rive/src/rive_core/animation/state_machine.dart';
|
import 'package:rive/src/rive_core/animation/state_machine.dart';
|
||||||
import 'package:rive/src/rive_core/animation/state_machine_number.dart';
|
import 'package:rive/src/rive_core/animation/state_machine_number.dart';
|
||||||
import 'package:rive/src/generated/animation/blend_animation_direct_base.dart';
|
|
||||||
export 'package:rive/src/generated/animation/blend_animation_direct_base.dart';
|
export 'package:rive/src/generated/animation/blend_animation_direct_base.dart';
|
||||||
|
|
||||||
class BlendAnimationDirect extends BlendAnimationDirectBase {
|
class BlendAnimationDirect extends BlendAnimationDirectBase {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import 'package:rive/src/core/core.dart';
|
import 'package:rive/src/core/core.dart';
|
||||||
import 'package:rive/src/rive_core/animation/blend_animation.dart';
|
|
||||||
import 'package:rive/src/generated/animation/blend_state_base.dart';
|
import 'package:rive/src/generated/animation/blend_state_base.dart';
|
||||||
|
import 'package:rive/src/rive_core/animation/blend_animation.dart';
|
||||||
|
|
||||||
export 'package:rive/src/generated/animation/blend_state_base.dart';
|
export 'package:rive/src/generated/animation/blend_state_base.dart';
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
import 'package:rive/src/core/core.dart';
|
import 'package:rive/src/core/core.dart';
|
||||||
|
import 'package:rive/src/generated/animation/blend_state_1d_base.dart';
|
||||||
import 'package:rive/src/rive_core/animation/blend_state_1d_instance.dart';
|
import 'package:rive/src/rive_core/animation/blend_state_1d_instance.dart';
|
||||||
import 'package:rive/src/rive_core/animation/state_instance.dart';
|
import 'package:rive/src/rive_core/animation/state_instance.dart';
|
||||||
import 'package:rive/src/rive_core/animation/state_machine.dart';
|
import 'package:rive/src/rive_core/animation/state_machine.dart';
|
||||||
import 'package:rive/src/rive_core/animation/state_machine_number.dart';
|
import 'package:rive/src/rive_core/animation/state_machine_number.dart';
|
||||||
import 'package:rive/src/generated/animation/blend_state_1d_base.dart';
|
|
||||||
export 'package:rive/src/generated/animation/blend_state_1d_base.dart';
|
export 'package:rive/src/generated/animation/blend_state_1d_base.dart';
|
||||||
|
|
||||||
class BlendState1D extends BlendState1DBase {
|
class BlendState1D extends BlendState1DBase {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
|
import 'package:rive/src/generated/animation/blend_state_direct_base.dart';
|
||||||
import 'package:rive/src/rive_core/animation/blend_state_direct_instance.dart';
|
import 'package:rive/src/rive_core/animation/blend_state_direct_instance.dart';
|
||||||
import 'package:rive/src/rive_core/animation/state_instance.dart';
|
import 'package:rive/src/rive_core/animation/state_instance.dart';
|
||||||
import 'package:rive/src/generated/animation/blend_state_direct_base.dart';
|
|
||||||
|
|
||||||
export 'package:rive/src/generated/animation/blend_state_direct_base.dart';
|
export 'package:rive/src/generated/animation/blend_state_direct_base.dart';
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import 'dart:collection';
|
import 'dart:collection';
|
||||||
|
|
||||||
import 'package:rive/src/core/core.dart';
|
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
|
import 'package:rive/src/core/core.dart';
|
||||||
import 'package:rive/src/rive_core/animation/blend_animation.dart';
|
import 'package:rive/src/rive_core/animation/blend_animation.dart';
|
||||||
import 'package:rive/src/rive_core/animation/blend_state.dart';
|
import 'package:rive/src/rive_core/animation/blend_state.dart';
|
||||||
import 'package:rive/src/rive_core/animation/linear_animation_instance.dart';
|
import 'package:rive/src/rive_core/animation/linear_animation_instance.dart';
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
|
import 'package:rive/src/generated/animation/blend_state_transition_base.dart';
|
||||||
import 'package:rive/src/rive_core/animation/blend_animation.dart';
|
import 'package:rive/src/rive_core/animation/blend_animation.dart';
|
||||||
import 'package:rive/src/rive_core/animation/blend_state_instance.dart';
|
import 'package:rive/src/rive_core/animation/blend_state_instance.dart';
|
||||||
import 'package:rive/src/rive_core/animation/layer_state.dart';
|
import 'package:rive/src/rive_core/animation/layer_state.dart';
|
||||||
import 'package:rive/src/rive_core/animation/linear_animation.dart';
|
import 'package:rive/src/rive_core/animation/linear_animation.dart';
|
||||||
import 'package:rive/src/rive_core/animation/linear_animation_instance.dart';
|
import 'package:rive/src/rive_core/animation/linear_animation_instance.dart';
|
||||||
import 'package:rive/src/rive_core/animation/state_instance.dart';
|
import 'package:rive/src/rive_core/animation/state_instance.dart';
|
||||||
import 'package:rive/src/generated/animation/blend_state_transition_base.dart';
|
|
||||||
export 'package:rive/src/generated/animation/blend_state_transition_base.dart';
|
export 'package:rive/src/generated/animation/blend_state_transition_base.dart';
|
||||||
|
|
||||||
class BlendStateTransition extends BlendStateTransitionBase {
|
class BlendStateTransition extends BlendStateTransitionBase {
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import 'dart:typed_data';
|
import 'dart:typed_data';
|
||||||
|
|
||||||
import 'package:rive/src/core/core.dart';
|
import 'package:rive/src/core/core.dart';
|
||||||
|
import 'package:rive/src/generated/animation/cubic_interpolator_base.dart';
|
||||||
import 'package:rive/src/rive_core/animation/interpolator.dart';
|
import 'package:rive/src/rive_core/animation/interpolator.dart';
|
||||||
import 'package:rive/src/rive_core/artboard.dart';
|
import 'package:rive/src/rive_core/artboard.dart';
|
||||||
import 'package:rive/src/generated/animation/cubic_interpolator_base.dart';
|
|
||||||
|
|
||||||
const int newtonIterations = 4;
|
const int newtonIterations = 4;
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import 'package:rive/src/rive_core/animation/state_instance.dart';
|
|
||||||
import 'package:rive/src/generated/animation/entry_state_base.dart';
|
import 'package:rive/src/generated/animation/entry_state_base.dart';
|
||||||
|
import 'package:rive/src/rive_core/animation/state_instance.dart';
|
||||||
|
|
||||||
export 'package:rive/src/generated/animation/entry_state_base.dart';
|
export 'package:rive/src/generated/animation/entry_state_base.dart';
|
||||||
|
|
||||||
class EntryState extends EntryStateBase {
|
class EntryState extends EntryStateBase {
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import 'package:rive/src/rive_core/animation/state_instance.dart';
|
|
||||||
import 'package:rive/src/generated/animation/exit_state_base.dart';
|
import 'package:rive/src/generated/animation/exit_state_base.dart';
|
||||||
|
import 'package:rive/src/rive_core/animation/state_instance.dart';
|
||||||
|
|
||||||
export 'package:rive/src/generated/animation/exit_state_base.dart';
|
export 'package:rive/src/generated/animation/exit_state_base.dart';
|
||||||
|
|
||||||
class ExitState extends ExitStateBase {
|
class ExitState extends ExitStateBase {
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
import 'dart:collection';
|
import 'dart:collection';
|
||||||
|
|
||||||
import 'package:rive/src/core/core.dart';
|
import 'package:rive/src/core/core.dart';
|
||||||
|
import 'package:rive/src/generated/animation/keyed_object_base.dart';
|
||||||
import 'package:rive/src/rive_core/animation/keyed_property.dart';
|
import 'package:rive/src/rive_core/animation/keyed_property.dart';
|
||||||
import 'package:rive/src/rive_core/component.dart';
|
import 'package:rive/src/rive_core/component.dart';
|
||||||
|
|
||||||
import 'package:rive/src/generated/animation/keyed_object_base.dart';
|
|
||||||
import 'linear_animation.dart';
|
import 'linear_animation.dart';
|
||||||
|
|
||||||
export 'package:rive/src/generated/animation/keyed_object_base.dart';
|
export 'package:rive/src/generated/animation/keyed_object_base.dart';
|
||||||
|
|
||||||
class KeyedObject extends KeyedObjectBase<RuntimeArtboard> {
|
class KeyedObject extends KeyedObjectBase<RuntimeArtboard> {
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import 'package:rive/src/core/core.dart';
|
import 'package:rive/src/core/core.dart';
|
||||||
|
import 'package:rive/src/generated/animation/keyed_property_base.dart';
|
||||||
import 'package:rive/src/rive_core/animation/keyed_object.dart';
|
import 'package:rive/src/rive_core/animation/keyed_object.dart';
|
||||||
import 'package:rive/src/rive_core/animation/keyframe.dart';
|
import 'package:rive/src/rive_core/animation/keyframe.dart';
|
||||||
|
|
||||||
import 'package:rive/src/generated/animation/keyed_property_base.dart';
|
|
||||||
export 'package:rive/src/generated/animation/keyed_property_base.dart';
|
export 'package:rive/src/generated/animation/keyed_property_base.dart';
|
||||||
|
|
||||||
abstract class KeyFrameInterface {
|
abstract class KeyFrameInterface {
|
||||||
|
@ -1,11 +1,10 @@
|
|||||||
import 'package:rive/src/core/core.dart';
|
import 'package:rive/src/core/core.dart';
|
||||||
|
import 'package:rive/src/generated/animation/keyframe_base.dart';
|
||||||
import 'package:rive/src/rive_core/animation/interpolator.dart';
|
import 'package:rive/src/rive_core/animation/interpolator.dart';
|
||||||
import 'package:rive/src/rive_core/animation/keyed_property.dart';
|
import 'package:rive/src/rive_core/animation/keyed_property.dart';
|
||||||
import 'package:rive/src/rive_core/animation/keyframe_interpolation.dart';
|
import 'package:rive/src/rive_core/animation/keyframe_interpolation.dart';
|
||||||
import 'package:rive/src/rive_core/animation/linear_animation.dart';
|
import 'package:rive/src/rive_core/animation/linear_animation.dart';
|
||||||
|
|
||||||
import 'package:rive/src/generated/animation/keyframe_base.dart';
|
|
||||||
|
|
||||||
export 'package:rive/src/generated/animation/keyframe_base.dart';
|
export 'package:rive/src/generated/animation/keyframe_base.dart';
|
||||||
|
|
||||||
abstract class KeyFrame extends KeyFrameBase<RuntimeArtboard>
|
abstract class KeyFrame extends KeyFrameBase<RuntimeArtboard>
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
import 'package:rive/src/core/core.dart';
|
import 'package:rive/src/core/core.dart';
|
||||||
|
import 'package:rive/src/generated/animation/layer_state_base.dart';
|
||||||
import 'package:rive/src/rive_core/animation/state_instance.dart';
|
import 'package:rive/src/rive_core/animation/state_instance.dart';
|
||||||
import 'package:rive/src/rive_core/animation/state_machine_layer.dart';
|
import 'package:rive/src/rive_core/animation/state_machine_layer.dart';
|
||||||
import 'package:rive/src/rive_core/animation/state_transition.dart';
|
import 'package:rive/src/rive_core/animation/state_transition.dart';
|
||||||
import 'package:rive/src/generated/animation/layer_state_base.dart';
|
|
||||||
export 'package:rive/src/generated/animation/layer_state_base.dart';
|
export 'package:rive/src/generated/animation/layer_state_base.dart';
|
||||||
|
|
||||||
abstract class LayerState extends LayerStateBase {
|
abstract class LayerState extends LayerStateBase {
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
import 'dart:collection';
|
import 'dart:collection';
|
||||||
|
|
||||||
import 'package:rive/src/core/core.dart';
|
import 'package:rive/src/core/core.dart';
|
||||||
|
import 'package:rive/src/generated/animation/linear_animation_base.dart';
|
||||||
import 'package:rive/src/rive_core/animation/keyed_object.dart';
|
import 'package:rive/src/rive_core/animation/keyed_object.dart';
|
||||||
import 'package:rive/src/rive_core/animation/loop.dart';
|
import 'package:rive/src/rive_core/animation/loop.dart';
|
||||||
import 'package:rive/src/rive_core/artboard.dart';
|
import 'package:rive/src/rive_core/artboard.dart';
|
||||||
import 'package:rive/src/generated/animation/linear_animation_base.dart';
|
|
||||||
export 'package:rive/src/generated/animation/linear_animation_base.dart';
|
export 'package:rive/src/generated/animation/linear_animation_base.dart';
|
||||||
|
|
||||||
class LinearAnimation extends LinearAnimationBase {
|
class LinearAnimation extends LinearAnimationBase {
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
import 'package:rive/src/core/core.dart';
|
import 'package:rive/src/core/core.dart';
|
||||||
|
import 'package:rive/src/generated/animation/state_machine_base.dart';
|
||||||
import 'package:rive/src/rive_core/animation/state_machine_input.dart';
|
import 'package:rive/src/rive_core/animation/state_machine_input.dart';
|
||||||
import 'package:rive/src/rive_core/animation/state_machine_layer.dart';
|
import 'package:rive/src/rive_core/animation/state_machine_layer.dart';
|
||||||
import 'package:rive/src/rive_core/artboard.dart';
|
import 'package:rive/src/rive_core/artboard.dart';
|
||||||
import 'package:rive/src/generated/animation/state_machine_base.dart';
|
|
||||||
export 'package:rive/src/generated/animation/state_machine_base.dart';
|
export 'package:rive/src/generated/animation/state_machine_base.dart';
|
||||||
|
|
||||||
class StateMachine extends StateMachineBase {
|
class StateMachine extends StateMachineBase {
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
import 'dart:collection';
|
import 'dart:collection';
|
||||||
|
|
||||||
import 'package:rive/src/core/core.dart';
|
import 'package:rive/src/core/core.dart';
|
||||||
import 'package:rive/src/rive_core/animation/state_machine.dart';
|
|
||||||
import 'package:rive/src/generated/animation/state_machine_component_base.dart';
|
import 'package:rive/src/generated/animation/state_machine_component_base.dart';
|
||||||
|
import 'package:rive/src/rive_core/animation/state_machine.dart';
|
||||||
|
|
||||||
export 'package:rive/src/generated/animation/state_machine_component_base.dart';
|
export 'package:rive/src/generated/animation/state_machine_component_base.dart';
|
||||||
|
|
||||||
/// Implemented by state machine inputs and layers.
|
/// Implemented by state machine inputs and layers.
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
import 'dart:collection';
|
import 'dart:collection';
|
||||||
|
|
||||||
|
import 'package:rive/src/generated/animation/state_machine_input_base.dart';
|
||||||
import 'package:rive/src/rive_core/animation/state_machine.dart';
|
import 'package:rive/src/rive_core/animation/state_machine.dart';
|
||||||
import 'package:rive/src/rive_core/animation/state_machine_component.dart';
|
import 'package:rive/src/rive_core/animation/state_machine_component.dart';
|
||||||
import 'package:rive/src/generated/animation/state_machine_input_base.dart';
|
|
||||||
export 'package:rive/src/generated/animation/state_machine_input_base.dart';
|
export 'package:rive/src/generated/animation/state_machine_input_base.dart';
|
||||||
|
|
||||||
abstract class StateMachineInput extends StateMachineInputBase {
|
abstract class StateMachineInput extends StateMachineInputBase {
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
import 'dart:collection';
|
import 'dart:collection';
|
||||||
|
|
||||||
|
import 'package:rive/src/generated/animation/any_state_base.dart';
|
||||||
|
import 'package:rive/src/generated/animation/state_machine_layer_base.dart';
|
||||||
import 'package:rive/src/rive_core/animation/any_state.dart';
|
import 'package:rive/src/rive_core/animation/any_state.dart';
|
||||||
import 'package:rive/src/rive_core/animation/entry_state.dart';
|
import 'package:rive/src/rive_core/animation/entry_state.dart';
|
||||||
import 'package:rive/src/rive_core/animation/exit_state.dart';
|
import 'package:rive/src/rive_core/animation/exit_state.dart';
|
||||||
import 'package:rive/src/rive_core/animation/layer_state.dart';
|
import 'package:rive/src/rive_core/animation/layer_state.dart';
|
||||||
import 'package:rive/src/rive_core/animation/state_machine.dart';
|
import 'package:rive/src/rive_core/animation/state_machine.dart';
|
||||||
import 'package:rive/src/rive_core/animation/state_machine_component.dart';
|
import 'package:rive/src/rive_core/animation/state_machine_component.dart';
|
||||||
import 'package:rive/src/generated/animation/any_state_base.dart';
|
|
||||||
import 'package:rive/src/generated/animation/state_machine_layer_base.dart';
|
|
||||||
export 'package:rive/src/generated/animation/state_machine_layer_base.dart';
|
export 'package:rive/src/generated/animation/state_machine_layer_base.dart';
|
||||||
|
|
||||||
class StateMachineLayer extends StateMachineLayerBase {
|
class StateMachineLayer extends StateMachineLayerBase {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import 'dart:collection';
|
import 'dart:collection';
|
||||||
|
|
||||||
import 'package:rive/src/core/core.dart';
|
import 'package:rive/src/core/core.dart';
|
||||||
|
import 'package:rive/src/generated/animation/state_transition_base.dart';
|
||||||
import 'package:rive/src/rive_core/animation/animation_state.dart';
|
import 'package:rive/src/rive_core/animation/animation_state.dart';
|
||||||
import 'package:rive/src/rive_core/animation/animation_state_instance.dart';
|
import 'package:rive/src/rive_core/animation/animation_state_instance.dart';
|
||||||
import 'package:rive/src/rive_core/animation/layer_state.dart';
|
import 'package:rive/src/rive_core/animation/layer_state.dart';
|
||||||
@ -10,8 +11,8 @@ import 'package:rive/src/rive_core/animation/loop.dart';
|
|||||||
import 'package:rive/src/rive_core/animation/state_instance.dart';
|
import 'package:rive/src/rive_core/animation/state_instance.dart';
|
||||||
import 'package:rive/src/rive_core/animation/transition_condition.dart';
|
import 'package:rive/src/rive_core/animation/transition_condition.dart';
|
||||||
import 'package:rive/src/rive_core/animation/transition_trigger_condition.dart';
|
import 'package:rive/src/rive_core/animation/transition_trigger_condition.dart';
|
||||||
import 'package:rive/src/generated/animation/state_transition_base.dart';
|
|
||||||
import 'package:rive/src/rive_core/state_transition_flags.dart';
|
import 'package:rive/src/rive_core/state_transition_flags.dart';
|
||||||
|
|
||||||
export 'package:rive/src/generated/animation/state_transition_base.dart';
|
export 'package:rive/src/generated/animation/state_transition_base.dart';
|
||||||
|
|
||||||
enum AllowTransition { no, waitingForExit, yes }
|
enum AllowTransition { no, waitingForExit, yes }
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
import 'dart:collection';
|
import 'dart:collection';
|
||||||
|
|
||||||
|
import 'package:rive/src/generated/animation/transition_bool_condition_base.dart';
|
||||||
import 'package:rive/src/rive_core/animation/state_machine_bool.dart';
|
import 'package:rive/src/rive_core/animation/state_machine_bool.dart';
|
||||||
import 'package:rive/src/rive_core/animation/transition_condition.dart';
|
import 'package:rive/src/rive_core/animation/transition_condition.dart';
|
||||||
import 'package:rive/src/generated/animation/transition_bool_condition_base.dart';
|
|
||||||
export 'package:rive/src/generated/animation/transition_bool_condition_base.dart';
|
export 'package:rive/src/generated/animation/transition_bool_condition_base.dart';
|
||||||
|
|
||||||
class TransitionBoolCondition extends TransitionBoolConditionBase {
|
class TransitionBoolCondition extends TransitionBoolConditionBase {
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
import 'dart:collection';
|
import 'dart:collection';
|
||||||
|
|
||||||
import 'package:rive/src/core/core.dart';
|
import 'package:rive/src/core/core.dart';
|
||||||
|
import 'package:rive/src/generated/animation/transition_condition_base.dart';
|
||||||
import 'package:rive/src/rive_core/animation/state_machine_input.dart';
|
import 'package:rive/src/rive_core/animation/state_machine_input.dart';
|
||||||
import 'package:rive/src/rive_core/animation/state_transition.dart';
|
import 'package:rive/src/rive_core/animation/state_transition.dart';
|
||||||
import 'package:rive/src/generated/animation/transition_condition_base.dart';
|
|
||||||
export 'package:rive/src/generated/animation/transition_condition_base.dart';
|
export 'package:rive/src/generated/animation/transition_condition_base.dart';
|
||||||
|
|
||||||
enum TransitionConditionOp {
|
enum TransitionConditionOp {
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
import 'dart:collection';
|
import 'dart:collection';
|
||||||
|
|
||||||
|
import 'package:rive/src/generated/animation/transition_number_condition_base.dart';
|
||||||
import 'package:rive/src/rive_core/animation/state_machine_number.dart';
|
import 'package:rive/src/rive_core/animation/state_machine_number.dart';
|
||||||
import 'package:rive/src/rive_core/animation/transition_condition.dart';
|
import 'package:rive/src/rive_core/animation/transition_condition.dart';
|
||||||
import 'package:rive/src/generated/animation/transition_number_condition_base.dart';
|
|
||||||
export 'package:rive/src/generated/animation/transition_number_condition_base.dart';
|
export 'package:rive/src/generated/animation/transition_number_condition_base.dart';
|
||||||
|
|
||||||
class TransitionNumberCondition extends TransitionNumberConditionBase {
|
class TransitionNumberCondition extends TransitionNumberConditionBase {
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
import 'dart:collection';
|
import 'dart:collection';
|
||||||
|
|
||||||
import 'package:rive/src/rive_core/animation/state_machine_trigger.dart';
|
|
||||||
import 'package:rive/src/generated/animation/transition_trigger_condition_base.dart';
|
import 'package:rive/src/generated/animation/transition_trigger_condition_base.dart';
|
||||||
|
import 'package:rive/src/rive_core/animation/state_machine_trigger.dart';
|
||||||
|
|
||||||
export 'package:rive/src/generated/animation/transition_trigger_condition_base.dart';
|
export 'package:rive/src/generated/animation/transition_trigger_condition_base.dart';
|
||||||
|
|
||||||
class TransitionTriggerCondition extends TransitionTriggerConditionBase {
|
class TransitionTriggerCondition extends TransitionTriggerConditionBase {
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import 'package:rive/src/rive_core/animation/transition_condition.dart';
|
|
||||||
import 'package:rive/src/generated/animation/transition_value_condition_base.dart';
|
import 'package:rive/src/generated/animation/transition_value_condition_base.dart';
|
||||||
|
import 'package:rive/src/rive_core/animation/transition_condition.dart';
|
||||||
|
|
||||||
export 'package:rive/src/generated/animation/transition_value_condition_base.dart';
|
export 'package:rive/src/generated/animation/transition_value_condition_base.dart';
|
||||||
|
|
||||||
abstract class TransitionValueCondition extends TransitionValueConditionBase {
|
abstract class TransitionValueCondition extends TransitionValueConditionBase {
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
import 'dart:ui';
|
import 'dart:ui';
|
||||||
|
|
||||||
import 'package:rive/src/core/core.dart';
|
import 'package:rive/src/core/core.dart';
|
||||||
|
import 'package:rive/src/generated/artboard_base.dart';
|
||||||
|
import 'package:rive/src/rive_core/animation/animation.dart';
|
||||||
import 'package:rive/src/rive_core/animation/linear_animation.dart';
|
import 'package:rive/src/rive_core/animation/linear_animation.dart';
|
||||||
import 'package:rive/src/rive_core/animation/state_machine.dart';
|
import 'package:rive/src/rive_core/animation/state_machine.dart';
|
||||||
import 'package:rive/src/rive_core/animation/animation.dart';
|
|
||||||
import 'package:rive/src/rive_core/component.dart';
|
import 'package:rive/src/rive_core/component.dart';
|
||||||
import 'package:rive/src/rive_core/component_dirt.dart';
|
import 'package:rive/src/rive_core/component_dirt.dart';
|
||||||
import 'package:rive/src/rive_core/draw_rules.dart';
|
import 'package:rive/src/rive_core/draw_rules.dart';
|
||||||
@ -16,8 +17,6 @@ import 'package:rive/src/rive_core/shapes/paint/shape_paint_mutator.dart';
|
|||||||
import 'package:rive/src/rive_core/shapes/shape_paint_container.dart';
|
import 'package:rive/src/rive_core/shapes/shape_paint_container.dart';
|
||||||
import 'package:rive/src/utilities/dependency_sorter.dart';
|
import 'package:rive/src/utilities/dependency_sorter.dart';
|
||||||
|
|
||||||
import 'package:rive/src/generated/artboard_base.dart';
|
|
||||||
|
|
||||||
export 'package:rive/src/generated/artboard_base.dart';
|
export 'package:rive/src/generated/artboard_base.dart';
|
||||||
|
|
||||||
class Artboard extends ArtboardBase with ShapePaintContainer {
|
class Artboard extends ArtboardBase with ShapePaintContainer {
|
||||||
@ -448,4 +447,21 @@ class Artboard extends ArtboardBase with ShapePaintContainer {
|
|||||||
throw UnsupportedError(
|
throw UnsupportedError(
|
||||||
'Instancing the artboard in the editor isn\'t supported');
|
'Instancing the artboard in the editor isn\'t supported');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// void rebuildDependencies() {
|
||||||
|
// for (final component in _components) {
|
||||||
|
// component.dependents.clear();
|
||||||
|
// }
|
||||||
|
// for (final component in _components) {
|
||||||
|
// component.buildDependencies();
|
||||||
|
// }
|
||||||
|
// for (final component in _components) {
|
||||||
|
// component.dependentIds = component.dependents
|
||||||
|
// // Make sure non-core (won't resolve on server) items aren't
|
||||||
|
// // included
|
||||||
|
// .where((other) => other.isActive)
|
||||||
|
// .map((other) => other.id)
|
||||||
|
// .toList(growable: false);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
import 'package:rive/src/generated/bones/bone_base.dart';
|
import 'package:rive/src/generated/bones/bone_base.dart';
|
||||||
|
import 'package:rive/src/rive_core/math/mat2d.dart';
|
||||||
|
import 'package:rive/src/rive_core/math/vec2d.dart';
|
||||||
|
|
||||||
export 'package:rive/src/generated/bones/bone_base.dart';
|
export 'package:rive/src/generated/bones/bone_base.dart';
|
||||||
|
|
||||||
typedef bool BoneCallback(Bone bone);
|
typedef bool BoneCallback(Bone bone);
|
||||||
@ -59,4 +62,12 @@ class Bone extends BoneBase {
|
|||||||
// here to make sure we evalute this check only for non-root bones.
|
// here to make sure we evalute this check only for non-root bones.
|
||||||
return super.validate() && (coreType != BoneBase.typeKey || parent is Bone);
|
return super.validate() && (coreType != BoneBase.typeKey || parent is Bone);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Vec2D get tipWorldTranslation => getTipWorldTranslation(worldTransform);
|
||||||
|
|
||||||
|
Vec2D getTipWorldTranslation(Mat2D worldTransform) {
|
||||||
|
var tip = Vec2D();
|
||||||
|
Vec2D.transformMat2D(tip, Vec2D.fromValues(length, 0), worldTransform);
|
||||||
|
return tip;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import 'package:rive/src/rive_core/math/vec2d.dart';
|
|
||||||
import 'package:rive/src/generated/bones/cubic_weight_base.dart';
|
import 'package:rive/src/generated/bones/cubic_weight_base.dart';
|
||||||
|
import 'package:rive/src/rive_core/math/vec2d.dart';
|
||||||
|
|
||||||
export 'package:rive/src/generated/bones/cubic_weight_base.dart';
|
export 'package:rive/src/generated/bones/cubic_weight_base.dart';
|
||||||
|
|
||||||
class CubicWeight extends CubicWeightBase {
|
class CubicWeight extends CubicWeightBase {
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
import 'dart:typed_data';
|
import 'dart:typed_data';
|
||||||
|
|
||||||
|
import 'package:rive/src/generated/bones/skin_base.dart';
|
||||||
import 'package:rive/src/rive_core/bones/skinnable.dart';
|
import 'package:rive/src/rive_core/bones/skinnable.dart';
|
||||||
import 'package:rive/src/rive_core/bones/tendon.dart';
|
import 'package:rive/src/rive_core/bones/tendon.dart';
|
||||||
import 'package:rive/src/rive_core/component.dart';
|
import 'package:rive/src/rive_core/component.dart';
|
||||||
import 'package:rive/src/rive_core/math/mat2d.dart';
|
import 'package:rive/src/rive_core/math/mat2d.dart';
|
||||||
import 'package:rive/src/rive_core/shapes/path_vertex.dart';
|
import 'package:rive/src/rive_core/shapes/path_vertex.dart';
|
||||||
|
|
||||||
import 'package:rive/src/generated/bones/skin_base.dart';
|
|
||||||
export 'package:rive/src/generated/bones/skin_base.dart';
|
export 'package:rive/src/generated/bones/skin_base.dart';
|
||||||
|
|
||||||
/// Represents a skin deformation of either a Path or an Image Mesh connected to
|
/// Represents a skin deformation of either a Path or an Image Mesh connected to
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
|
import 'package:rive/src/generated/bones/tendon_base.dart';
|
||||||
import 'package:rive/src/rive_core/bones/skeletal_component.dart';
|
import 'package:rive/src/rive_core/bones/skeletal_component.dart';
|
||||||
import 'package:rive/src/rive_core/math/mat2d.dart';
|
import 'package:rive/src/rive_core/math/mat2d.dart';
|
||||||
import 'package:rive/src/generated/bones/tendon_base.dart';
|
|
||||||
export 'package:rive/src/generated/bones/tendon_base.dart';
|
export 'package:rive/src/generated/bones/tendon_base.dart';
|
||||||
|
|
||||||
class Tendon extends TendonBase {
|
class Tendon extends TendonBase {
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
import 'dart:typed_data';
|
import 'dart:typed_data';
|
||||||
|
|
||||||
|
import 'package:rive/src/generated/bones/weight_base.dart';
|
||||||
import 'package:rive/src/rive_core/math/mat2d.dart';
|
import 'package:rive/src/rive_core/math/mat2d.dart';
|
||||||
import 'package:rive/src/rive_core/math/vec2d.dart';
|
import 'package:rive/src/rive_core/math/vec2d.dart';
|
||||||
import 'package:rive/src/generated/bones/weight_base.dart';
|
|
||||||
export 'package:rive/src/generated/bones/weight_base.dart';
|
export 'package:rive/src/generated/bones/weight_base.dart';
|
||||||
|
|
||||||
class Weight extends WeightBase {
|
class Weight extends WeightBase {
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
import 'package:rive/src/core/core.dart';
|
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
|
import 'package:rive/src/core/core.dart';
|
||||||
|
import 'package:rive/src/generated/component_base.dart';
|
||||||
import 'package:rive/src/rive_core/artboard.dart';
|
import 'package:rive/src/rive_core/artboard.dart';
|
||||||
import 'package:rive/src/rive_core/container_component.dart';
|
import 'package:rive/src/rive_core/container_component.dart';
|
||||||
|
|
||||||
import 'package:rive/src/generated/component_base.dart';
|
|
||||||
import 'package:rive/src/utilities/dependency_sorter.dart';
|
import 'package:rive/src/utilities/dependency_sorter.dart';
|
||||||
import 'package:rive/src/utilities/tops.dart';
|
import 'package:rive/src/utilities/tops.dart';
|
||||||
|
|
||||||
export 'package:rive/src/generated/component_base.dart';
|
export 'package:rive/src/generated/component_base.dart';
|
||||||
|
|
||||||
abstract class Component extends ComponentBase<RuntimeArtboard>
|
abstract class Component extends ComponentBase<RuntimeArtboard>
|
||||||
@ -140,7 +140,11 @@ abstract class Component extends ComponentBase<RuntimeArtboard>
|
|||||||
@override
|
@override
|
||||||
Set<Component> get dependents => _dependents;
|
Set<Component> get dependents => _dependents;
|
||||||
|
|
||||||
bool addDependent(Component dependent) {
|
/// Mark [dependent] as a component which must update after this. Provide
|
||||||
|
/// [via] as the Component registering the dependency when it is not
|
||||||
|
/// [dependent] itself. At edit time this allows the editor to rebuild both
|
||||||
|
/// [dependent] and [via] when [dependent] has its dependencies cleared.
|
||||||
|
bool addDependent(Component dependent, {Component? via}) {
|
||||||
assert(artboard == dependent.artboard,
|
assert(artboard == dependent.artboard,
|
||||||
'Components must be in the same artboard.');
|
'Components must be in the same artboard.');
|
||||||
|
|
||||||
@ -164,16 +168,15 @@ abstract class Component extends ComponentBase<RuntimeArtboard>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@mustCallSuper
|
void clearDependencies() {
|
||||||
void buildDependencies() {
|
|
||||||
for (final parentDep in _dependsOn) {
|
for (final parentDep in _dependsOn) {
|
||||||
parentDep._dependents.remove(this);
|
parentDep._dependents.remove(this);
|
||||||
}
|
}
|
||||||
_dependsOn.clear();
|
_dependsOn.clear();
|
||||||
// by default a component depends on nothing (likely it will depend on the
|
|
||||||
// parent but we leave that for specific implementations to supply).
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void buildDependencies() {}
|
||||||
|
|
||||||
/// Something we depend on has been removed. It's important to clear out any
|
/// Something we depend on has been removed. It's important to clear out any
|
||||||
/// stored references to that dependency so it can be garbage collected (if
|
/// stored references to that dependency so it can be garbage collected (if
|
||||||
/// necessary).
|
/// necessary).
|
||||||
|
26
lib/src/rive_core/constraints/constraint.dart
Normal file
26
lib/src/rive_core/constraints/constraint.dart
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
import 'package:rive/src/generated/constraints/constraint_base.dart';
|
||||||
|
import 'package:rive/src/rive_core/transform_component.dart';
|
||||||
|
export 'package:rive/src/generated/constraints/constraint_base.dart';
|
||||||
|
|
||||||
|
/// A specialized [Component] which can be parented to any [TransformComponent]
|
||||||
|
/// providing rules for how to constrain its transform space.
|
||||||
|
abstract class Constraint extends ConstraintBase {
|
||||||
|
/// Returns the [TransformComponent] which this [Constraint] is applied to.
|
||||||
|
// TransformComponent? get constrainedComponent =>
|
||||||
|
// parent is TransformComponent ? parent as TransformComponent : null;
|
||||||
|
TransformComponent get constrainedComponent => parent as TransformComponent;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void strengthChanged(double from, double to) =>
|
||||||
|
constrainedComponent.markTransformDirty();
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool validate() => super.validate() && parent is TransformComponent;
|
||||||
|
|
||||||
|
void constrain(TransformComponent component);
|
||||||
|
|
||||||
|
@override
|
||||||
|
void update(int dirt) {}
|
||||||
|
|
||||||
|
void markConstraintDirty() => constrainedComponent.markTransformDirty();
|
||||||
|
}
|
275
lib/src/rive_core/constraints/ik_constraint.dart
Normal file
275
lib/src/rive_core/constraints/ik_constraint.dart
Normal file
@ -0,0 +1,275 @@
|
|||||||
|
import 'dart:math';
|
||||||
|
|
||||||
|
import 'package:rive/src/generated/constraints/ik_constraint_base.dart';
|
||||||
|
import 'package:rive/src/rive_core/artboard.dart';
|
||||||
|
import 'package:rive/src/rive_core/bones/bone.dart';
|
||||||
|
import 'package:rive/src/rive_core/math/mat2d.dart';
|
||||||
|
import 'package:rive/src/rive_core/math/transform_components.dart';
|
||||||
|
import 'package:rive/src/rive_core/math/vec2d.dart';
|
||||||
|
import 'package:rive/src/rive_core/transform_component.dart';
|
||||||
|
|
||||||
|
export 'package:rive/src/generated/constraints/ik_constraint_base.dart';
|
||||||
|
|
||||||
|
/// A constraint which rotates its constrained bone and the parentBoneCount
|
||||||
|
/// bones above it in order to move the tip of the constrained bone towards the
|
||||||
|
/// target.
|
||||||
|
class IKConstraint extends IKConstraintBase {
|
||||||
|
@override
|
||||||
|
void invertDirectionChanged(bool from, bool to) => markConstraintDirty();
|
||||||
|
|
||||||
|
@override
|
||||||
|
void parentBoneCountChanged(int from, int to) {}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void markConstraintDirty() {
|
||||||
|
super.markConstraintDirty();
|
||||||
|
|
||||||
|
// We automatically propagate dirt to the parent constrained bone, but we
|
||||||
|
// also need to make sure the other bones we influence above it rebuild
|
||||||
|
// their transforms.
|
||||||
|
for (int i = 0; i < _fkChain.length - 1; i++) {
|
||||||
|
_fkChain[i].bone.markTransformDirty();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The list of bones in FK order.
|
||||||
|
final List<_BoneChainLink> _fkChain = [];
|
||||||
|
@override
|
||||||
|
void buildDependencies() {
|
||||||
|
super.buildDependencies();
|
||||||
|
|
||||||
|
parent!.addDependent(this);
|
||||||
|
|
||||||
|
// Rebuild the FK chain when we update dependencies.
|
||||||
|
_fkChain.clear();
|
||||||
|
var boneCount = parentBoneCount;
|
||||||
|
var bone = parent as Bone;
|
||||||
|
var bones = <Bone>[bone];
|
||||||
|
// Get the reverse FK chain of bones (from tip up).
|
||||||
|
while (bone.parent is Bone && boneCount > 0) {
|
||||||
|
boneCount--;
|
||||||
|
bone = bone.parent as Bone;
|
||||||
|
bones.add(bone);
|
||||||
|
}
|
||||||
|
// Now put them in FK order (top to bottom).
|
||||||
|
for (final bone in bones.reversed) {
|
||||||
|
_fkChain.add(_BoneChainLink(
|
||||||
|
index: _fkChain.length,
|
||||||
|
bone: bone,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Make sure all of the first level children of each bone depend on the
|
||||||
|
// tip (constrainedComponent).
|
||||||
|
var tip = parent as Bone;
|
||||||
|
for (final bone in bones.skip(1)) {
|
||||||
|
for (final child in bone.children) {
|
||||||
|
if (child is TransformComponent && !bones.contains(child)) {
|
||||||
|
tip.addDependent(child, via: this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool validate() => super.validate() && parent is Bone;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void constrain(TransformComponent component) {
|
||||||
|
if (target == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var worldTargetTranslation = target!.worldTranslation;
|
||||||
|
// Decompose the chain.
|
||||||
|
for (final item in _fkChain) {
|
||||||
|
var bone = item.bone;
|
||||||
|
Mat2D parentWorld = _parentWorld(bone);
|
||||||
|
|
||||||
|
Mat2D.invert(item.parentWorldInverse, parentWorld);
|
||||||
|
|
||||||
|
var boneTransform = bone.transform;
|
||||||
|
Mat2D.multiply(
|
||||||
|
boneTransform, item.parentWorldInverse, bone.worldTransform);
|
||||||
|
Mat2D.decompose(boneTransform, item.transformComponents);
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (_fkChain.length) {
|
||||||
|
case 1:
|
||||||
|
solve1(_fkChain.first, worldTargetTranslation);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
solve2(_fkChain[0], _fkChain[1], worldTargetTranslation);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
var last = _fkChain.length - 1;
|
||||||
|
var tip = _fkChain[last];
|
||||||
|
for (int i = 0; i < last; i++) {
|
||||||
|
var item = _fkChain[i];
|
||||||
|
solve2(item, tip, worldTargetTranslation);
|
||||||
|
for (int j = item.index + 1, end = _fkChain.length - 1;
|
||||||
|
j < end;
|
||||||
|
j++) {
|
||||||
|
var fk = _fkChain[j];
|
||||||
|
Mat2D.invert(fk.parentWorldInverse, _parentWorld(fk.bone));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// At the end, mix the FK angle with the IK angle by strength
|
||||||
|
if (strength != 1.0) {
|
||||||
|
for (final fk in _fkChain) {
|
||||||
|
var fromAngle = fk.transformComponents.rotation % (pi * 2);
|
||||||
|
var toAngle = fk.angle % (pi * 2);
|
||||||
|
var diff = toAngle - fromAngle;
|
||||||
|
if (diff > pi) {
|
||||||
|
diff -= pi * 2;
|
||||||
|
} else if (diff < -pi) {
|
||||||
|
diff += pi * 2;
|
||||||
|
}
|
||||||
|
var angle = fromAngle + diff * strength;
|
||||||
|
_constrainRotation(fk, angle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void solve1(_BoneChainLink fk1, Vec2D worldTargetTranslation) {
|
||||||
|
Mat2D iworld = fk1.parentWorldInverse;
|
||||||
|
var pA = fk1.bone.worldTranslation;
|
||||||
|
var pBT = Vec2D.clone(worldTargetTranslation);
|
||||||
|
|
||||||
|
// To target in worldspace
|
||||||
|
var toTarget = Vec2D.subtract(Vec2D(), pBT, pA);
|
||||||
|
|
||||||
|
// Note this is directional, hence not transformMat2d
|
||||||
|
Vec2D toTargetLocal = Vec2D.transformMat2(Vec2D(), toTarget, iworld);
|
||||||
|
var r = atan2(toTargetLocal[1], toTargetLocal[0]);
|
||||||
|
|
||||||
|
_constrainRotation(fk1, r);
|
||||||
|
fk1.angle = r;
|
||||||
|
}
|
||||||
|
|
||||||
|
void solve2(
|
||||||
|
_BoneChainLink fk1, _BoneChainLink fk2, Vec2D worldTargetTranslation) {
|
||||||
|
Bone b1 = fk1.bone;
|
||||||
|
Bone b2 = fk2.bone;
|
||||||
|
var firstChild = _fkChain[fk1.index + 1];
|
||||||
|
|
||||||
|
var iworld = fk1.parentWorldInverse;
|
||||||
|
|
||||||
|
var pA = b1.worldTranslation;
|
||||||
|
var pC = firstChild.bone.worldTranslation;
|
||||||
|
var pB = b2.tipWorldTranslation;
|
||||||
|
var pBT = Vec2D.clone(worldTargetTranslation);
|
||||||
|
|
||||||
|
Vec2D.transformMat2D(pA, pA, iworld);
|
||||||
|
Vec2D.transformMat2D(pC, pC, iworld);
|
||||||
|
Vec2D.transformMat2D(pB, pB, iworld);
|
||||||
|
Vec2D.transformMat2D(pBT, pBT, iworld);
|
||||||
|
|
||||||
|
// http://mathworld.wolfram.com/LawofCosines.html
|
||||||
|
|
||||||
|
var av = Vec2D.subtract(Vec2D(), pB, pC);
|
||||||
|
var a = Vec2D.length(av);
|
||||||
|
|
||||||
|
var bv = Vec2D.subtract(Vec2D(), pC, pA);
|
||||||
|
var b = Vec2D.length(bv);
|
||||||
|
|
||||||
|
var cv = Vec2D.subtract(Vec2D(), pBT, pA);
|
||||||
|
var c = Vec2D.length(cv);
|
||||||
|
|
||||||
|
var A = acos(max(-1, min(1, (-a * a + b * b + c * c) / (2 * b * c))));
|
||||||
|
var C = acos(max(-1, min(1, (a * a + b * b - c * c) / (2 * a * b))));
|
||||||
|
|
||||||
|
double r1, r2;
|
||||||
|
if (b2.parent != b1) {
|
||||||
|
var secondChild = _fkChain[fk1.index + 2];
|
||||||
|
|
||||||
|
var secondChildWorldInverse = secondChild.parentWorldInverse;
|
||||||
|
|
||||||
|
pC = firstChild.bone.worldTranslation;
|
||||||
|
pB = b2.tipWorldTranslation;
|
||||||
|
|
||||||
|
var avec = Vec2D.subtract(Vec2D(), pB, pC);
|
||||||
|
|
||||||
|
var avLocal = Vec2D.transformMat2(Vec2D(), avec, secondChildWorldInverse);
|
||||||
|
var angleCorrection = -atan2(avLocal[1], avLocal[0]);
|
||||||
|
|
||||||
|
if (invertDirection) {
|
||||||
|
r1 = atan2(cv[1], cv[0]) - A;
|
||||||
|
r2 = -C + pi + angleCorrection;
|
||||||
|
} else {
|
||||||
|
r1 = A + atan2(cv[1], cv[0]);
|
||||||
|
r2 = C - pi + angleCorrection;
|
||||||
|
}
|
||||||
|
} else if (invertDirection) {
|
||||||
|
r1 = atan2(cv[1], cv[0]) - A;
|
||||||
|
r2 = -C + pi;
|
||||||
|
} else {
|
||||||
|
r1 = A + atan2(cv[1], cv[0]);
|
||||||
|
r2 = C - pi;
|
||||||
|
}
|
||||||
|
_constrainRotation(fk1, r1);
|
||||||
|
_constrainRotation(firstChild, r2);
|
||||||
|
if (firstChild != fk2) {
|
||||||
|
var bone = fk2.bone;
|
||||||
|
Mat2D.multiply(bone.worldTransform, _parentWorld(bone), bone.transform);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Simple storage, need this for interpolation.
|
||||||
|
fk1.angle = r1;
|
||||||
|
firstChild.angle = r2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class _BoneChainLink {
|
||||||
|
final int index;
|
||||||
|
final Bone bone;
|
||||||
|
double angle = 0;
|
||||||
|
TransformComponents transformComponents = TransformComponents();
|
||||||
|
Mat2D parentWorldInverse = Mat2D();
|
||||||
|
|
||||||
|
_BoneChainLink({
|
||||||
|
required this.index,
|
||||||
|
required this.bone,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
void _constrainRotation(_BoneChainLink link, double rotation) {
|
||||||
|
var bone = link.bone;
|
||||||
|
Mat2D parentWorld = _parentWorld(bone);
|
||||||
|
var boneTransform = bone.transform;
|
||||||
|
if (rotation == 0) {
|
||||||
|
Mat2D.setIdentity(boneTransform);
|
||||||
|
} else {
|
||||||
|
Mat2D.fromRotation(boneTransform, rotation);
|
||||||
|
}
|
||||||
|
var c = link.transformComponents;
|
||||||
|
boneTransform[4] = c.x;
|
||||||
|
boneTransform[5] = c.y;
|
||||||
|
var scaleX = c.scaleX;
|
||||||
|
var scaleY = c.scaleY;
|
||||||
|
boneTransform[0] *= scaleX;
|
||||||
|
boneTransform[1] *= scaleX;
|
||||||
|
boneTransform[2] *= scaleY;
|
||||||
|
boneTransform[3] *= scaleY;
|
||||||
|
|
||||||
|
var skew = c.skew;
|
||||||
|
if (skew != 0) {
|
||||||
|
boneTransform[2] = boneTransform[0] * skew + boneTransform[2];
|
||||||
|
boneTransform[3] = boneTransform[1] * skew + boneTransform[3];
|
||||||
|
}
|
||||||
|
Mat2D.multiply(bone.worldTransform, parentWorld, boneTransform);
|
||||||
|
}
|
||||||
|
|
||||||
|
Mat2D _parentWorld(TransformComponent component) {
|
||||||
|
var parent = component.parent;
|
||||||
|
if (parent is Artboard) {
|
||||||
|
return parent.worldTransform;
|
||||||
|
} else {
|
||||||
|
return (parent as TransformComponent).worldTransform;
|
||||||
|
}
|
||||||
|
}
|
36
lib/src/rive_core/constraints/targeted_constraint.dart
Normal file
36
lib/src/rive_core/constraints/targeted_constraint.dart
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
import 'package:rive/src/generated/constraints/targeted_constraint_base.dart';
|
||||||
|
import 'package:rive/src/rive_core/transform_component.dart';
|
||||||
|
export 'package:rive/src/generated/constraints/targeted_constraint_base.dart';
|
||||||
|
|
||||||
|
/// A [Constraint] which uses an external target to help influence the computed
|
||||||
|
/// transform.
|
||||||
|
abstract class TargetedConstraint extends TargetedConstraintBase {
|
||||||
|
TransformComponent? _target;
|
||||||
|
TransformComponent? get target => _target;
|
||||||
|
set target(TransformComponent? value) {
|
||||||
|
if (_target == value) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_target = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void targetIdChanged(int from, int to) {
|
||||||
|
target = context.resolve(to);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void buildDependencies() {
|
||||||
|
super.buildDependencies();
|
||||||
|
// Targeted constraints must have their constrainedComponent update after
|
||||||
|
// the target.
|
||||||
|
_target?.addDependent(constrainedComponent, via: this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onAddedDirty() {
|
||||||
|
super.onAddedDirty();
|
||||||
|
target = context.resolve(targetId);
|
||||||
|
}
|
||||||
|
}
|
@ -1,9 +1,9 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:rive/src/core/core.dart';
|
import 'package:rive/src/core/core.dart';
|
||||||
|
import 'package:rive/src/generated/container_component_base.dart';
|
||||||
import 'package:rive/src/rive_core/component.dart';
|
import 'package:rive/src/rive_core/component.dart';
|
||||||
import 'package:rive/src/rive_core/draw_rules.dart';
|
import 'package:rive/src/rive_core/draw_rules.dart';
|
||||||
import 'package:rive/src/rive_core/drawable.dart';
|
import 'package:rive/src/rive_core/drawable.dart';
|
||||||
import 'package:rive/src/generated/container_component_base.dart';
|
|
||||||
|
|
||||||
typedef bool DescentCallback(Component component);
|
typedef bool DescentCallback(Component component);
|
||||||
|
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
import 'package:rive/src/core/core.dart';
|
import 'package:rive/src/core/core.dart';
|
||||||
|
import 'package:rive/src/generated/draw_rules_base.dart';
|
||||||
import 'package:rive/src/rive_core/component.dart';
|
import 'package:rive/src/rive_core/component.dart';
|
||||||
import 'package:rive/src/rive_core/draw_target.dart';
|
import 'package:rive/src/rive_core/draw_target.dart';
|
||||||
import 'package:rive/src/generated/draw_rules_base.dart';
|
|
||||||
export 'package:rive/src/generated/draw_rules_base.dart';
|
export 'package:rive/src/generated/draw_rules_base.dart';
|
||||||
|
|
||||||
class DrawRules extends DrawRulesBase {
|
class DrawRules extends DrawRulesBase {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import 'package:rive/src/core/core.dart';
|
import 'package:rive/src/core/core.dart';
|
||||||
import 'package:rive/src/rive_core/drawable.dart';
|
|
||||||
import 'package:rive/src/generated/draw_target_base.dart';
|
import 'package:rive/src/generated/draw_target_base.dart';
|
||||||
|
import 'package:rive/src/rive_core/drawable.dart';
|
||||||
|
|
||||||
export 'package:rive/src/generated/draw_target_base.dart';
|
export 'package:rive/src/generated/draw_target_base.dart';
|
||||||
|
|
||||||
enum DrawTargetPlacement { before, after }
|
enum DrawTargetPlacement { before, after }
|
||||||
|
@ -1,12 +1,13 @@
|
|||||||
import 'dart:ui';
|
import 'dart:ui';
|
||||||
|
|
||||||
|
import 'package:rive/src/generated/drawable_base.dart';
|
||||||
import 'package:rive/src/rive_core/component_dirt.dart';
|
import 'package:rive/src/rive_core/component_dirt.dart';
|
||||||
import 'package:rive/src/rive_core/component_flags.dart';
|
import 'package:rive/src/rive_core/component_flags.dart';
|
||||||
import 'package:rive/src/rive_core/container_component.dart';
|
import 'package:rive/src/rive_core/container_component.dart';
|
||||||
import 'package:rive/src/rive_core/draw_rules.dart';
|
import 'package:rive/src/rive_core/draw_rules.dart';
|
||||||
import 'package:rive/src/rive_core/shapes/clipping_shape.dart';
|
import 'package:rive/src/rive_core/shapes/clipping_shape.dart';
|
||||||
import 'package:rive/src/generated/drawable_base.dart';
|
|
||||||
import 'package:rive/src/rive_core/transform_component.dart';
|
import 'package:rive/src/rive_core/transform_component.dart';
|
||||||
|
|
||||||
export 'package:rive/src/generated/drawable_base.dart';
|
export 'package:rive/src/generated/drawable_base.dart';
|
||||||
|
|
||||||
abstract class Drawable extends DrawableBase {
|
abstract class Drawable extends DrawableBase {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
|
import 'package:rive/src/generated/node_base.dart';
|
||||||
import 'package:rive/src/rive_core/math/aabb.dart';
|
import 'package:rive/src/rive_core/math/aabb.dart';
|
||||||
import 'package:rive/src/rive_core/math/vec2d.dart';
|
import 'package:rive/src/rive_core/math/vec2d.dart';
|
||||||
import 'package:rive/src/generated/node_base.dart';
|
|
||||||
export 'package:rive/src/generated/node_base.dart';
|
export 'package:rive/src/generated/node_base.dart';
|
||||||
|
|
||||||
class _UnknownNode extends Node {}
|
class _UnknownNode extends Node {}
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
import 'dart:ui';
|
import 'dart:ui';
|
||||||
|
|
||||||
|
import 'package:rive/src/generated/shapes/clipping_shape_base.dart';
|
||||||
import 'package:rive/src/rive_core/component_dirt.dart';
|
import 'package:rive/src/rive_core/component_dirt.dart';
|
||||||
import 'package:rive/src/rive_core/node.dart';
|
import 'package:rive/src/rive_core/node.dart';
|
||||||
import 'package:rive/src/rive_core/shapes/shape.dart';
|
import 'package:rive/src/rive_core/shapes/shape.dart';
|
||||||
import 'package:rive/src/generated/shapes/clipping_shape_base.dart';
|
|
||||||
export 'package:rive/src/generated/shapes/clipping_shape_base.dart';
|
export 'package:rive/src/generated/shapes/clipping_shape_base.dart';
|
||||||
|
|
||||||
class ClippingShape extends ClippingShapeBase {
|
class ClippingShape extends ClippingShapeBase {
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
import 'dart:math';
|
import 'dart:math';
|
||||||
|
|
||||||
import 'package:rive/src/core/core.dart';
|
import 'package:rive/src/core/core.dart';
|
||||||
|
import 'package:rive/src/generated/shapes/cubic_asymmetric_vertex_base.dart';
|
||||||
import 'package:rive/src/rive_core/component_dirt.dart';
|
import 'package:rive/src/rive_core/component_dirt.dart';
|
||||||
import 'package:rive/src/rive_core/math/vec2d.dart';
|
import 'package:rive/src/rive_core/math/vec2d.dart';
|
||||||
import 'package:rive/src/generated/shapes/cubic_asymmetric_vertex_base.dart';
|
|
||||||
export 'package:rive/src/generated/shapes/cubic_asymmetric_vertex_base.dart';
|
export 'package:rive/src/generated/shapes/cubic_asymmetric_vertex_base.dart';
|
||||||
|
|
||||||
class CubicAsymmetricVertex extends CubicAsymmetricVertexBase {
|
class CubicAsymmetricVertex extends CubicAsymmetricVertexBase {
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
import 'dart:math';
|
import 'dart:math';
|
||||||
|
|
||||||
import 'package:rive/src/core/core.dart';
|
import 'package:rive/src/core/core.dart';
|
||||||
|
import 'package:rive/src/generated/shapes/cubic_detached_vertex_base.dart';
|
||||||
import 'package:rive/src/rive_core/component_dirt.dart';
|
import 'package:rive/src/rive_core/component_dirt.dart';
|
||||||
import 'package:rive/src/rive_core/math/vec2d.dart';
|
import 'package:rive/src/rive_core/math/vec2d.dart';
|
||||||
import 'package:rive/src/generated/shapes/cubic_detached_vertex_base.dart';
|
|
||||||
export 'package:rive/src/generated/shapes/cubic_detached_vertex_base.dart';
|
export 'package:rive/src/generated/shapes/cubic_detached_vertex_base.dart';
|
||||||
|
|
||||||
class CubicDetachedVertex extends CubicDetachedVertexBase {
|
class CubicDetachedVertex extends CubicDetachedVertexBase {
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
import 'dart:math';
|
import 'dart:math';
|
||||||
|
|
||||||
import 'package:rive/src/core/core.dart';
|
import 'package:rive/src/core/core.dart';
|
||||||
|
import 'package:rive/src/generated/shapes/cubic_mirrored_vertex_base.dart';
|
||||||
import 'package:rive/src/rive_core/component_dirt.dart';
|
import 'package:rive/src/rive_core/component_dirt.dart';
|
||||||
import 'package:rive/src/rive_core/math/vec2d.dart';
|
import 'package:rive/src/rive_core/math/vec2d.dart';
|
||||||
import 'package:rive/src/generated/shapes/cubic_mirrored_vertex_base.dart';
|
|
||||||
export 'package:rive/src/generated/shapes/cubic_mirrored_vertex_base.dart';
|
export 'package:rive/src/generated/shapes/cubic_mirrored_vertex_base.dart';
|
||||||
|
|
||||||
class CubicMirroredVertex extends CubicMirroredVertexBase {
|
class CubicMirroredVertex extends CubicMirroredVertexBase {
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
import 'dart:typed_data';
|
import 'dart:typed_data';
|
||||||
|
|
||||||
|
import 'package:rive/src/generated/shapes/cubic_vertex_base.dart';
|
||||||
import 'package:rive/src/rive_core/bones/weight.dart';
|
import 'package:rive/src/rive_core/bones/weight.dart';
|
||||||
import 'package:rive/src/rive_core/math/mat2d.dart';
|
import 'package:rive/src/rive_core/math/mat2d.dart';
|
||||||
import 'package:rive/src/rive_core/math/vec2d.dart';
|
import 'package:rive/src/rive_core/math/vec2d.dart';
|
||||||
import 'package:rive/src/generated/shapes/cubic_vertex_base.dart';
|
|
||||||
export 'package:rive/src/generated/shapes/cubic_vertex_base.dart';
|
export 'package:rive/src/generated/shapes/cubic_vertex_base.dart';
|
||||||
|
|
||||||
abstract class CubicVertex extends CubicVertexBase {
|
abstract class CubicVertex extends CubicVertexBase {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
|
import 'package:rive/src/generated/shapes/ellipse_base.dart';
|
||||||
import 'package:rive/src/rive_core/math/circle_constant.dart';
|
import 'package:rive/src/rive_core/math/circle_constant.dart';
|
||||||
import 'package:rive/src/rive_core/shapes/cubic_detached_vertex.dart';
|
import 'package:rive/src/rive_core/shapes/cubic_detached_vertex.dart';
|
||||||
import 'package:rive/src/rive_core/shapes/path_vertex.dart';
|
import 'package:rive/src/rive_core/shapes/path_vertex.dart';
|
||||||
import 'package:rive/src/generated/shapes/ellipse_base.dart';
|
|
||||||
|
|
||||||
export 'package:rive/src/generated/shapes/ellipse_base.dart';
|
export 'package:rive/src/generated/shapes/ellipse_base.dart';
|
||||||
|
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
import 'dart:ui';
|
import 'dart:ui';
|
||||||
|
|
||||||
|
import 'package:rive/src/generated/shapes/paint/fill_base.dart';
|
||||||
import 'package:rive/src/rive_core/component_dirt.dart';
|
import 'package:rive/src/rive_core/component_dirt.dart';
|
||||||
import 'package:rive/src/rive_core/shapes/shape_paint_container.dart';
|
import 'package:rive/src/rive_core/shapes/shape_paint_container.dart';
|
||||||
import 'package:rive/src/generated/shapes/paint/fill_base.dart';
|
|
||||||
export 'package:rive/src/generated/shapes/paint/fill_base.dart';
|
export 'package:rive/src/generated/shapes/paint/fill_base.dart';
|
||||||
|
|
||||||
/// A fill Shape painter.
|
/// A fill Shape painter.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import 'dart:ui' as ui;
|
import 'dart:ui' as ui;
|
||||||
|
|
||||||
import 'package:rive/src/rive_core/container_component.dart';
|
|
||||||
import 'package:rive/src/generated/shapes/paint/gradient_stop_base.dart';
|
import 'package:rive/src/generated/shapes/paint/gradient_stop_base.dart';
|
||||||
|
import 'package:rive/src/rive_core/container_component.dart';
|
||||||
import 'package:rive/src/rive_core/shapes/paint/linear_gradient.dart';
|
import 'package:rive/src/rive_core/shapes/paint/linear_gradient.dart';
|
||||||
|
|
||||||
export 'package:rive/src/generated/shapes/paint/gradient_stop_base.dart';
|
export 'package:rive/src/generated/shapes/paint/gradient_stop_base.dart';
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
import 'dart:ui' as ui;
|
import 'dart:ui' as ui;
|
||||||
|
|
||||||
import 'package:meta/meta.dart';
|
import 'package:meta/meta.dart';
|
||||||
|
import 'package:rive/src/generated/shapes/paint/linear_gradient_base.dart';
|
||||||
import 'package:rive/src/rive_core/component.dart';
|
import 'package:rive/src/rive_core/component.dart';
|
||||||
import 'package:rive/src/rive_core/component_dirt.dart';
|
import 'package:rive/src/rive_core/component_dirt.dart';
|
||||||
import 'package:rive/src/rive_core/math/vec2d.dart';
|
import 'package:rive/src/rive_core/math/vec2d.dart';
|
||||||
import 'package:rive/src/rive_core/shapes/paint/gradient_stop.dart';
|
import 'package:rive/src/rive_core/shapes/paint/gradient_stop.dart';
|
||||||
import 'package:rive/src/rive_core/shapes/paint/shape_paint_mutator.dart';
|
import 'package:rive/src/rive_core/shapes/paint/shape_paint_mutator.dart';
|
||||||
import 'package:rive/src/rive_core/shapes/shape.dart';
|
import 'package:rive/src/rive_core/shapes/shape.dart';
|
||||||
import 'package:rive/src/generated/shapes/paint/linear_gradient_base.dart';
|
|
||||||
export 'package:rive/src/generated/shapes/paint/linear_gradient_base.dart';
|
export 'package:rive/src/generated/shapes/paint/linear_gradient_base.dart';
|
||||||
|
|
||||||
/// A core linear gradient. Can be added as a child to a [Shape]'s [Fill] or
|
/// A core linear gradient. Can be added as a child to a [Shape]'s [Fill] or
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
import 'dart:ui';
|
import 'dart:ui';
|
||||||
|
|
||||||
import 'package:meta/meta.dart';
|
import 'package:meta/meta.dart';
|
||||||
|
import 'package:rive/src/generated/shapes/paint/shape_paint_base.dart';
|
||||||
import 'package:rive/src/rive_core/component.dart';
|
import 'package:rive/src/rive_core/component.dart';
|
||||||
import 'package:rive/src/rive_core/component_dirt.dart';
|
import 'package:rive/src/rive_core/component_dirt.dart';
|
||||||
import 'package:rive/src/rive_core/container_component.dart';
|
import 'package:rive/src/rive_core/container_component.dart';
|
||||||
import 'package:rive/src/rive_core/shapes/paint/shape_paint_mutator.dart';
|
import 'package:rive/src/rive_core/shapes/paint/shape_paint_mutator.dart';
|
||||||
import 'package:rive/src/rive_core/shapes/shape.dart';
|
import 'package:rive/src/rive_core/shapes/shape.dart';
|
||||||
import 'package:rive/src/rive_core/shapes/shape_paint_container.dart';
|
import 'package:rive/src/rive_core/shapes/shape_paint_container.dart';
|
||||||
import 'package:rive/src/generated/shapes/paint/shape_paint_base.dart';
|
|
||||||
export 'package:rive/src/generated/shapes/paint/shape_paint_base.dart';
|
export 'package:rive/src/generated/shapes/paint/shape_paint_base.dart';
|
||||||
|
|
||||||
/// Generic ShapePaint that abstracts Stroke and Fill. Automatically hooks up
|
/// Generic ShapePaint that abstracts Stroke and Fill. Automatically hooks up
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
import 'dart:ui';
|
import 'dart:ui';
|
||||||
|
|
||||||
|
import 'package:rive/src/generated/shapes/paint/solid_color_base.dart';
|
||||||
import 'package:rive/src/rive_core/component_dirt.dart';
|
import 'package:rive/src/rive_core/component_dirt.dart';
|
||||||
import 'package:rive/src/rive_core/shapes/paint/shape_paint.dart';
|
import 'package:rive/src/rive_core/shapes/paint/shape_paint.dart';
|
||||||
import 'package:rive/src/rive_core/shapes/paint/shape_paint_mutator.dart';
|
import 'package:rive/src/rive_core/shapes/paint/shape_paint_mutator.dart';
|
||||||
import 'package:rive/src/generated/shapes/paint/solid_color_base.dart';
|
|
||||||
export 'package:rive/src/generated/shapes/paint/solid_color_base.dart';
|
export 'package:rive/src/generated/shapes/paint/solid_color_base.dart';
|
||||||
|
|
||||||
/// A solid color painter for a shape. Works for both Fill and Stroke.
|
/// A solid color painter for a shape. Works for both Fill and Stroke.
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:rive/src/generated/shapes/paint/stroke_base.dart';
|
||||||
import 'package:rive/src/rive_core/component_dirt.dart';
|
import 'package:rive/src/rive_core/component_dirt.dart';
|
||||||
import 'package:rive/src/rive_core/shapes/paint/stroke_effect.dart';
|
import 'package:rive/src/rive_core/shapes/paint/stroke_effect.dart';
|
||||||
import 'package:rive/src/rive_core/shapes/shape.dart';
|
import 'package:rive/src/rive_core/shapes/shape.dart';
|
||||||
import 'package:rive/src/rive_core/shapes/shape_paint_container.dart';
|
import 'package:rive/src/rive_core/shapes/shape_paint_container.dart';
|
||||||
import 'package:rive/src/generated/shapes/paint/stroke_base.dart';
|
|
||||||
export 'package:rive/src/generated/shapes/paint/stroke_base.dart';
|
export 'package:rive/src/generated/shapes/paint/stroke_base.dart';
|
||||||
|
|
||||||
/// A stroke Shape painter.
|
/// A stroke Shape painter.
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
import 'dart:ui';
|
import 'dart:ui';
|
||||||
|
|
||||||
|
import 'package:rive/src/generated/shapes/paint/trim_path_base.dart';
|
||||||
import 'package:rive/src/rive_core/component_dirt.dart';
|
import 'package:rive/src/rive_core/component_dirt.dart';
|
||||||
import 'package:rive/src/rive_core/shapes/paint/stroke.dart';
|
import 'package:rive/src/rive_core/shapes/paint/stroke.dart';
|
||||||
import 'package:rive/src/rive_core/shapes/paint/stroke_effect.dart';
|
import 'package:rive/src/rive_core/shapes/paint/stroke_effect.dart';
|
||||||
import 'package:rive/src/rive_core/shapes/paint/trim_path_drawing.dart';
|
import 'package:rive/src/rive_core/shapes/paint/trim_path_drawing.dart';
|
||||||
|
|
||||||
import 'package:rive/src/generated/shapes/paint/trim_path_base.dart';
|
|
||||||
export 'package:rive/src/generated/shapes/paint/trim_path_base.dart';
|
export 'package:rive/src/generated/shapes/paint/trim_path_base.dart';
|
||||||
|
|
||||||
enum TrimPathMode {
|
enum TrimPathMode {
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import 'package:rive/src/rive_core/math/mat2d.dart';
|
|
||||||
import 'package:rive/src/generated/shapes/parametric_path_base.dart';
|
import 'package:rive/src/generated/shapes/parametric_path_base.dart';
|
||||||
|
import 'package:rive/src/rive_core/math/mat2d.dart';
|
||||||
|
|
||||||
export 'package:rive/src/generated/shapes/parametric_path_base.dart';
|
export 'package:rive/src/generated/shapes/parametric_path_base.dart';
|
||||||
|
|
||||||
abstract class ParametricPath extends ParametricPathBase {
|
abstract class ParametricPath extends ParametricPathBase {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import 'dart:math';
|
import 'dart:math';
|
||||||
import 'dart:ui' as ui;
|
import 'dart:ui' as ui;
|
||||||
|
|
||||||
|
import 'package:rive/src/generated/shapes/path_base.dart';
|
||||||
import 'package:rive/src/rive_core/component.dart';
|
import 'package:rive/src/rive_core/component.dart';
|
||||||
import 'package:rive/src/rive_core/component_dirt.dart';
|
import 'package:rive/src/rive_core/component_dirt.dart';
|
||||||
import 'package:rive/src/rive_core/component_flags.dart';
|
import 'package:rive/src/rive_core/component_flags.dart';
|
||||||
@ -11,7 +12,7 @@ import 'package:rive/src/rive_core/shapes/cubic_vertex.dart';
|
|||||||
import 'package:rive/src/rive_core/shapes/path_vertex.dart';
|
import 'package:rive/src/rive_core/shapes/path_vertex.dart';
|
||||||
import 'package:rive/src/rive_core/shapes/shape.dart';
|
import 'package:rive/src/rive_core/shapes/shape.dart';
|
||||||
import 'package:rive/src/rive_core/shapes/straight_vertex.dart';
|
import 'package:rive/src/rive_core/shapes/straight_vertex.dart';
|
||||||
import 'package:rive/src/generated/shapes/path_base.dart';
|
|
||||||
export 'package:rive/src/generated/shapes/path_base.dart';
|
export 'package:rive/src/generated/shapes/path_base.dart';
|
||||||
|
|
||||||
/// An abstract low level path that gets implemented by parametric and point
|
/// An abstract low level path that gets implemented by parametric and point
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
import 'dart:typed_data';
|
import 'dart:typed_data';
|
||||||
|
|
||||||
|
import 'package:rive/src/generated/shapes/path_vertex_base.dart';
|
||||||
import 'package:rive/src/rive_core/bones/weight.dart';
|
import 'package:rive/src/rive_core/bones/weight.dart';
|
||||||
import 'package:rive/src/rive_core/component.dart';
|
import 'package:rive/src/rive_core/component.dart';
|
||||||
import 'package:rive/src/rive_core/math/mat2d.dart';
|
import 'package:rive/src/rive_core/math/mat2d.dart';
|
||||||
import 'package:rive/src/rive_core/math/vec2d.dart';
|
import 'package:rive/src/rive_core/math/vec2d.dart';
|
||||||
import 'package:rive/src/rive_core/shapes/path.dart';
|
import 'package:rive/src/rive_core/shapes/path.dart';
|
||||||
import 'package:rive/src/generated/shapes/path_vertex_base.dart';
|
|
||||||
export 'package:rive/src/generated/shapes/path_vertex_base.dart';
|
export 'package:rive/src/generated/shapes/path_vertex_base.dart';
|
||||||
|
|
||||||
abstract class PathVertex<T extends Weight> extends PathVertexBase {
|
abstract class PathVertex<T extends Weight> extends PathVertexBase {
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
|
import 'package:rive/src/generated/shapes/points_path_base.dart';
|
||||||
import 'package:rive/src/rive_core/bones/skinnable.dart';
|
import 'package:rive/src/rive_core/bones/skinnable.dart';
|
||||||
import 'package:rive/src/rive_core/component.dart';
|
import 'package:rive/src/rive_core/component.dart';
|
||||||
import 'package:rive/src/rive_core/component_dirt.dart';
|
import 'package:rive/src/rive_core/component_dirt.dart';
|
||||||
import 'package:rive/src/rive_core/math/mat2d.dart';
|
import 'package:rive/src/rive_core/math/mat2d.dart';
|
||||||
import 'package:rive/src/rive_core/shapes/path_vertex.dart';
|
import 'package:rive/src/rive_core/shapes/path_vertex.dart';
|
||||||
import 'package:rive/src/generated/shapes/points_path_base.dart';
|
|
||||||
|
|
||||||
export 'package:rive/src/generated/shapes/points_path_base.dart';
|
export 'package:rive/src/generated/shapes/points_path_base.dart';
|
||||||
|
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
import 'dart:math';
|
import 'dart:math';
|
||||||
|
|
||||||
import 'package:rive/src/rive_core/shapes/path_vertex.dart';
|
|
||||||
import 'package:rive/src/rive_core/bones/weight.dart';
|
|
||||||
import 'package:rive/src/rive_core/shapes/straight_vertex.dart';
|
|
||||||
import 'package:rive/src/generated/shapes/polygon_base.dart';
|
import 'package:rive/src/generated/shapes/polygon_base.dart';
|
||||||
|
import 'package:rive/src/rive_core/bones/weight.dart';
|
||||||
|
import 'package:rive/src/rive_core/shapes/path_vertex.dart';
|
||||||
|
import 'package:rive/src/rive_core/shapes/straight_vertex.dart';
|
||||||
|
|
||||||
export 'package:rive/src/generated/shapes/polygon_base.dart';
|
export 'package:rive/src/generated/shapes/polygon_base.dart';
|
||||||
|
|
||||||
class Polygon extends PolygonBase {
|
class Polygon extends PolygonBase {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
|
import 'package:rive/src/generated/shapes/rectangle_base.dart';
|
||||||
import 'package:rive/src/rive_core/shapes/path_vertex.dart';
|
import 'package:rive/src/rive_core/shapes/path_vertex.dart';
|
||||||
import 'package:rive/src/rive_core/shapes/straight_vertex.dart';
|
import 'package:rive/src/rive_core/shapes/straight_vertex.dart';
|
||||||
import 'package:rive/src/generated/shapes/rectangle_base.dart';
|
|
||||||
export 'package:rive/src/generated/shapes/rectangle_base.dart';
|
export 'package:rive/src/generated/shapes/rectangle_base.dart';
|
||||||
|
|
||||||
class Rectangle extends RectangleBase {
|
class Rectangle extends RectangleBase {
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
import 'dart:ui' as ui;
|
import 'dart:ui' as ui;
|
||||||
|
|
||||||
|
import 'package:collection/collection.dart';
|
||||||
|
import 'package:rive/src/generated/shapes/shape_base.dart';
|
||||||
import 'package:rive/src/rive_core/component_dirt.dart';
|
import 'package:rive/src/rive_core/component_dirt.dart';
|
||||||
import 'package:rive/src/rive_core/shapes/paint/linear_gradient.dart' as core;
|
import 'package:rive/src/rive_core/shapes/paint/linear_gradient.dart' as core;
|
||||||
import 'package:rive/src/rive_core/shapes/paint/shape_paint_mutator.dart';
|
import 'package:rive/src/rive_core/shapes/paint/shape_paint_mutator.dart';
|
||||||
@ -7,8 +9,7 @@ import 'package:rive/src/rive_core/shapes/paint/stroke.dart';
|
|||||||
import 'package:rive/src/rive_core/shapes/path.dart';
|
import 'package:rive/src/rive_core/shapes/path.dart';
|
||||||
import 'package:rive/src/rive_core/shapes/path_composer.dart';
|
import 'package:rive/src/rive_core/shapes/path_composer.dart';
|
||||||
import 'package:rive/src/rive_core/shapes/shape_paint_container.dart';
|
import 'package:rive/src/rive_core/shapes/shape_paint_container.dart';
|
||||||
import 'package:rive/src/generated/shapes/shape_base.dart';
|
|
||||||
import 'package:collection/collection.dart';
|
|
||||||
export 'package:rive/src/generated/shapes/shape_base.dart';
|
export 'package:rive/src/generated/shapes/shape_base.dart';
|
||||||
|
|
||||||
class Shape extends ShapeBase with ShapePaintContainer {
|
class Shape extends ShapeBase with ShapePaintContainer {
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
|
import 'package:meta/meta.dart';
|
||||||
import 'package:rive/src/rive_core/component.dart';
|
import 'package:rive/src/rive_core/component.dart';
|
||||||
import 'package:rive/src/rive_core/math/mat2d.dart';
|
import 'package:rive/src/rive_core/math/mat2d.dart';
|
||||||
import 'package:rive/src/rive_core/math/vec2d.dart';
|
import 'package:rive/src/rive_core/math/vec2d.dart';
|
||||||
|
|
||||||
import 'package:rive/src/rive_core/shapes/paint/fill.dart';
|
import 'package:rive/src/rive_core/shapes/paint/fill.dart';
|
||||||
import 'package:meta/meta.dart';
|
|
||||||
import 'package:rive/src/rive_core/shapes/paint/shape_paint_mutator.dart';
|
import 'package:rive/src/rive_core/shapes/paint/shape_paint_mutator.dart';
|
||||||
import 'package:rive/src/rive_core/shapes/paint/stroke.dart';
|
import 'package:rive/src/rive_core/shapes/paint/stroke.dart';
|
||||||
|
|
||||||
@ -71,7 +71,7 @@ abstract class ShapePaintContainer {
|
|||||||
/// ShapePaintContainer to ContainerComponent/Shape/Artboard/etc.
|
/// ShapePaintContainer to ContainerComponent/Shape/Artboard/etc.
|
||||||
bool addDirt(int value, {bool recurse = false});
|
bool addDirt(int value, {bool recurse = false});
|
||||||
|
|
||||||
bool addDependent(Component dependent);
|
bool addDependent(Component dependent, {Component? via});
|
||||||
void appendChild(Component child);
|
void appendChild(Component child);
|
||||||
Mat2D get worldTransform;
|
Mat2D get worldTransform;
|
||||||
Vec2D get worldTranslation;
|
Vec2D get worldTranslation;
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
import 'dart:math';
|
import 'dart:math';
|
||||||
|
|
||||||
|
import 'package:rive/src/generated/shapes/star_base.dart';
|
||||||
import 'package:rive/src/rive_core/bones/weight.dart';
|
import 'package:rive/src/rive_core/bones/weight.dart';
|
||||||
import 'package:rive/src/rive_core/shapes/path_vertex.dart';
|
import 'package:rive/src/rive_core/shapes/path_vertex.dart';
|
||||||
import 'package:rive/src/rive_core/shapes/straight_vertex.dart';
|
import 'package:rive/src/rive_core/shapes/straight_vertex.dart';
|
||||||
import 'package:rive/src/generated/shapes/star_base.dart';
|
|
||||||
export 'package:rive/src/generated/shapes/star_base.dart';
|
export 'package:rive/src/generated/shapes/star_base.dart';
|
||||||
|
|
||||||
class Star extends StarBase {
|
class Star extends StarBase {
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
import 'package:rive/src/core/core.dart';
|
import 'package:rive/src/core/core.dart';
|
||||||
|
import 'package:rive/src/generated/shapes/straight_vertex_base.dart';
|
||||||
import 'package:rive/src/rive_core/bones/weight.dart';
|
import 'package:rive/src/rive_core/bones/weight.dart';
|
||||||
import 'package:rive/src/rive_core/component.dart';
|
import 'package:rive/src/rive_core/component.dart';
|
||||||
import 'package:rive/src/rive_core/math/vec2d.dart';
|
import 'package:rive/src/rive_core/math/vec2d.dart';
|
||||||
import 'package:rive/src/generated/shapes/straight_vertex_base.dart';
|
|
||||||
export 'package:rive/src/generated/shapes/straight_vertex_base.dart';
|
export 'package:rive/src/generated/shapes/straight_vertex_base.dart';
|
||||||
|
|
||||||
class StraightVertex extends StraightVertexBase {
|
class StraightVertex extends StraightVertexBase {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
|
import 'package:rive/src/generated/shapes/triangle_base.dart';
|
||||||
import 'package:rive/src/rive_core/shapes/path_vertex.dart';
|
import 'package:rive/src/rive_core/shapes/path_vertex.dart';
|
||||||
import 'package:rive/src/rive_core/shapes/straight_vertex.dart';
|
import 'package:rive/src/rive_core/shapes/straight_vertex.dart';
|
||||||
import 'package:rive/src/generated/shapes/triangle_base.dart';
|
|
||||||
|
|
||||||
/// Export the Base class for external use (e.g. rive.dart)
|
/// Export the Base class for external use (e.g. rive.dart)
|
||||||
export 'package:rive/src/generated/shapes/triangle_base.dart';
|
export 'package:rive/src/generated/shapes/triangle_base.dart';
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import 'dart:collection';
|
import 'dart:collection';
|
||||||
|
|
||||||
import 'package:rive/src/core/core.dart';
|
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/scheduler.dart';
|
import 'package:flutter/scheduler.dart';
|
||||||
|
import 'package:rive/src/core/core.dart';
|
||||||
import 'package:rive/src/rive_core/animation/animation_state.dart';
|
import 'package:rive/src/rive_core/animation/animation_state.dart';
|
||||||
import 'package:rive/src/rive_core/animation/animation_state_instance.dart';
|
import 'package:rive/src/rive_core/animation/animation_state_instance.dart';
|
||||||
import 'package:rive/src/rive_core/animation/any_state.dart';
|
import 'package:rive/src/rive_core/animation/any_state.dart';
|
||||||
|
@ -1,14 +1,17 @@
|
|||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
|
import 'package:rive/src/generated/shapes/clipping_shape_base.dart';
|
||||||
|
import 'package:rive/src/generated/transform_component_base.dart';
|
||||||
import 'package:rive/src/rive_core/component.dart';
|
import 'package:rive/src/rive_core/component.dart';
|
||||||
import 'package:rive/src/rive_core/component_dirt.dart';
|
import 'package:rive/src/rive_core/component_dirt.dart';
|
||||||
|
import 'package:rive/src/rive_core/constraints/constraint.dart';
|
||||||
|
import 'package:rive/src/rive_core/constraints/ik_constraint.dart';
|
||||||
import 'package:rive/src/rive_core/container_component.dart';
|
import 'package:rive/src/rive_core/container_component.dart';
|
||||||
import 'package:rive/src/rive_core/draw_rules.dart';
|
import 'package:rive/src/rive_core/draw_rules.dart';
|
||||||
import 'package:rive/src/rive_core/drawable.dart';
|
import 'package:rive/src/rive_core/drawable.dart';
|
||||||
import 'package:rive/src/rive_core/math/mat2d.dart';
|
import 'package:rive/src/rive_core/math/mat2d.dart';
|
||||||
import 'package:rive/src/rive_core/math/vec2d.dart';
|
import 'package:rive/src/rive_core/math/vec2d.dart';
|
||||||
import 'package:rive/src/rive_core/shapes/clipping_shape.dart';
|
import 'package:rive/src/rive_core/shapes/clipping_shape.dart';
|
||||||
import 'package:rive/src/generated/shapes/clipping_shape_base.dart';
|
|
||||||
import 'package:rive/src/generated/transform_component_base.dart';
|
|
||||||
export 'package:rive/src/generated/transform_component_base.dart';
|
export 'package:rive/src/generated/transform_component_base.dart';
|
||||||
|
|
||||||
abstract class TransformComponent extends TransformComponentBase {
|
abstract class TransformComponent extends TransformComponentBase {
|
||||||
@ -20,6 +23,10 @@ abstract class TransformComponent extends TransformComponentBase {
|
|||||||
final List<ClippingShape> _clippingShapes = [];
|
final List<ClippingShape> _clippingShapes = [];
|
||||||
Iterable<ClippingShape> get clippingShapes => _clippingShapes;
|
Iterable<ClippingShape> get clippingShapes => _clippingShapes;
|
||||||
|
|
||||||
|
/// Constraints applied to this TransformComponent.
|
||||||
|
final List<Constraint> _constraints = [];
|
||||||
|
Iterable<Constraint> get constraints => _constraints;
|
||||||
|
|
||||||
double _renderOpacity = 0;
|
double _renderOpacity = 0;
|
||||||
double get renderOpacity => _renderOpacity;
|
double get renderOpacity => _renderOpacity;
|
||||||
|
|
||||||
@ -77,6 +84,12 @@ abstract class TransformComponent extends TransformComponentBase {
|
|||||||
} else {
|
} else {
|
||||||
Mat2D.copy(worldTransform, transform);
|
Mat2D.copy(worldTransform, transform);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_constraints.isNotEmpty) {
|
||||||
|
for (final constraint in _constraints) {
|
||||||
|
constraint.constrain(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void calculateWorldTransform() {
|
void calculateWorldTransform() {
|
||||||
@ -150,6 +163,9 @@ abstract class TransformComponent extends TransformComponentBase {
|
|||||||
_clippingShapes.add(child as ClippingShape);
|
_clippingShapes.add(child as ClippingShape);
|
||||||
addDirt(ComponentDirt.clip, recurse: true);
|
addDirt(ComponentDirt.clip, recurse: true);
|
||||||
|
|
||||||
|
break;
|
||||||
|
case IKConstraintBase.typeKey:
|
||||||
|
_constraints.add(child as Constraint);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -168,6 +184,10 @@ abstract class TransformComponent extends TransformComponentBase {
|
|||||||
_clippingShapes.remove(child as ClippingShape);
|
_clippingShapes.remove(child as ClippingShape);
|
||||||
addDirt(ComponentDirt.clip, recurse: true);
|
addDirt(ComponentDirt.clip, recurse: true);
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
case IKConstraintBase.typeKey:
|
||||||
|
_constraints.remove(child as Constraint);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:rive/rive.dart';
|
import 'package:rive/rive.dart';
|
||||||
|
import 'package:rive/src/core/core.dart';
|
||||||
import 'package:rive/src/rive_core/artboard.dart';
|
import 'package:rive/src/rive_core/artboard.dart';
|
||||||
import 'package:rive/src/rive_core/component.dart';
|
import 'package:rive/src/rive_core/component.dart';
|
||||||
import 'package:rive/src/rive_core/event.dart';
|
import 'package:rive/src/rive_core/event.dart';
|
||||||
import 'package:rive/src/core/core.dart';
|
|
||||||
|
|
||||||
/// Adds getters for linear animations and state machines
|
/// Adds getters for linear animations and state machines
|
||||||
extension RuntimeArtboardGetters on RuntimeArtboard {
|
extension RuntimeArtboardGetters on RuntimeArtboard {
|
||||||
|
Reference in New Issue
Block a user