Adding distance constraint.

This commit is contained in:
Luigi Rosso
2021-07-26 13:57:57 -07:00
committed by Luigi Rosso
parent cc4774264c
commit 53ea9b5839
71 changed files with 267 additions and 126 deletions

View File

@ -0,0 +1,77 @@
/// Core automatically generated
/// lib/src/generated/constraints/distance_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 DistanceConstraintBase extends TargetedConstraint {
static const int typeKey = 82;
@override
int get coreType => DistanceConstraintBase.typeKey;
@override
Set<int> get coreTypes => {
DistanceConstraintBase.typeKey,
TargetedConstraintBase.typeKey,
ConstraintBase.typeKey,
ComponentBase.typeKey
};
/// --------------------------------------------------------------------------
/// Distance field with key 177.
static const double distanceInitialValue = 100.0;
double _distance = distanceInitialValue;
static const int distancePropertyKey = 177;
/// The unit distance the constraint will move the constrained object relative
/// to the target.
double get distance => _distance;
/// Change the [_distance] field value.
/// [distanceChanged] will be invoked only if the field's value has changed.
set distance(double value) {
if (_distance == value) {
return;
}
double from = _distance;
_distance = value;
if (hasValidated) {
distanceChanged(from, value);
}
}
void distanceChanged(double from, double to);
/// --------------------------------------------------------------------------
/// ModeValue field with key 178.
static const int modeValueInitialValue = 0;
int _modeValue = modeValueInitialValue;
static const int modeValuePropertyKey = 178;
/// Backing value for the mode enum.
int get modeValue => _modeValue;
/// Change the [_modeValue] field value.
/// [modeValueChanged] will be invoked only if the field's value has changed.
set modeValue(int value) {
if (_modeValue == value) {
return;
}
int from = _modeValue;
_modeValue = value;
if (hasValidated) {
modeValueChanged(from, value);
}
}
void modeValueChanged(int from, int to);
@override
void copy(DistanceConstraintBase source) {
super.copy(source);
_distance = source._distance;
_modeValue = source._modeValue;
}
}

View File

@ -46,6 +46,7 @@ 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/constraint_base.dart';
import 'package:rive/src/generated/constraints/distance_constraint_base.dart';
import 'package:rive/src/generated/constraints/ik_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/constraints/targeted_constraint_base.dart';
import 'package:rive/src/generated/draw_rules_base.dart'; import 'package:rive/src/generated/draw_rules_base.dart';
@ -110,6 +111,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/distance_constraint.dart';
import 'package:rive/src/rive_core/constraints/ik_constraint.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';
@ -140,6 +142,8 @@ class RiveCoreContext {
switch (typeKey) { switch (typeKey) {
case DrawTargetBase.typeKey: case DrawTargetBase.typeKey:
return DrawTarget(); return DrawTarget();
case DistanceConstraintBase.typeKey:
return DistanceConstraint();
case IKConstraintBase.typeKey: case IKConstraintBase.typeKey:
return IKConstraint(); return IKConstraint();
case AnimationStateBase.typeKey: case AnimationStateBase.typeKey:
@ -289,6 +293,16 @@ class RiveCoreContext {
object.targetId = value; object.targetId = value;
} }
break; break;
case DistanceConstraintBase.distancePropertyKey:
if (object is DistanceConstraintBase && value is double) {
object.distance = value;
}
break;
case DistanceConstraintBase.modeValuePropertyKey:
if (object is DistanceConstraintBase && value is int) {
object.modeValue = value;
}
break;
case IKConstraintBase.invertDirectionPropertyKey: case IKConstraintBase.invertDirectionPropertyKey:
if (object is IKConstraintBase && value is bool) { if (object is IKConstraintBase && value is bool) {
object.invertDirection = value; object.invertDirection = value;
@ -917,6 +931,7 @@ class RiveCoreContext {
case DrawTargetBase.drawableIdPropertyKey: case DrawTargetBase.drawableIdPropertyKey:
case DrawTargetBase.placementValuePropertyKey: case DrawTargetBase.placementValuePropertyKey:
case TargetedConstraintBase.targetIdPropertyKey: case TargetedConstraintBase.targetIdPropertyKey:
case DistanceConstraintBase.modeValuePropertyKey:
case IKConstraintBase.parentBoneCountPropertyKey: case IKConstraintBase.parentBoneCountPropertyKey:
case AnimationStateBase.animationIdPropertyKey: case AnimationStateBase.animationIdPropertyKey:
case KeyedObjectBase.objectIdPropertyKey: case KeyedObjectBase.objectIdPropertyKey:
@ -960,6 +975,7 @@ class RiveCoreContext {
case TendonBase.boneIdPropertyKey: case TendonBase.boneIdPropertyKey:
return uintType; return uintType;
case ConstraintBase.strengthPropertyKey: case ConstraintBase.strengthPropertyKey:
case DistanceConstraintBase.distancePropertyKey:
case StateMachineNumberBase.valuePropertyKey: case StateMachineNumberBase.valuePropertyKey:
case TransitionNumberConditionBase.valuePropertyKey: case TransitionNumberConditionBase.valuePropertyKey:
case CubicInterpolatorBase.x1PropertyKey: case CubicInterpolatorBase.x1PropertyKey:
@ -1069,6 +1085,8 @@ class RiveCoreContext {
return (object as DrawTargetBase).placementValue; return (object as DrawTargetBase).placementValue;
case TargetedConstraintBase.targetIdPropertyKey: case TargetedConstraintBase.targetIdPropertyKey:
return (object as TargetedConstraintBase).targetId; return (object as TargetedConstraintBase).targetId;
case DistanceConstraintBase.modeValuePropertyKey:
return (object as DistanceConstraintBase).modeValue;
case IKConstraintBase.parentBoneCountPropertyKey: case IKConstraintBase.parentBoneCountPropertyKey:
return (object as IKConstraintBase).parentBoneCount; return (object as IKConstraintBase).parentBoneCount;
case AnimationStateBase.animationIdPropertyKey: case AnimationStateBase.animationIdPropertyKey:
@ -1159,6 +1177,8 @@ class RiveCoreContext {
switch (propertyKey) { switch (propertyKey) {
case ConstraintBase.strengthPropertyKey: case ConstraintBase.strengthPropertyKey:
return (object as ConstraintBase).strength; return (object as ConstraintBase).strength;
case DistanceConstraintBase.distancePropertyKey:
return (object as DistanceConstraintBase).distance;
case StateMachineNumberBase.valuePropertyKey: case StateMachineNumberBase.valuePropertyKey:
return (object as StateMachineNumberBase).value; return (object as StateMachineNumberBase).value;
case TransitionNumberConditionBase.valuePropertyKey: case TransitionNumberConditionBase.valuePropertyKey:
@ -1375,6 +1395,11 @@ class RiveCoreContext {
object.targetId = value; object.targetId = value;
} }
break; break;
case DistanceConstraintBase.modeValuePropertyKey:
if (object is DistanceConstraintBase) {
object.modeValue = value;
}
break;
case IKConstraintBase.parentBoneCountPropertyKey: case IKConstraintBase.parentBoneCountPropertyKey:
if (object is IKConstraintBase) { if (object is IKConstraintBase) {
object.parentBoneCount = value; object.parentBoneCount = value;
@ -1590,6 +1615,11 @@ class RiveCoreContext {
object.strength = value; object.strength = value;
} }
break; break;
case DistanceConstraintBase.distancePropertyKey:
if (object is DistanceConstraintBase) {
object.distance = value;
}
break;
case StateMachineNumberBase.valuePropertyKey: case StateMachineNumberBase.valuePropertyKey:
if (object is StateMachineNumberBase) { if (object is StateMachineNumberBase) {
object.value = value; object.value = value;

View File

@ -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> {

View File

@ -1,10 +1,9 @@
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 {

View File

@ -1,6 +1,5 @@
import 'package:rive/src/generated/animation/any_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/generated/animation/any_state_base.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 {

View File

@ -1,10 +1,9 @@
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 {

View File

@ -1,8 +1,7 @@
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 {

View File

@ -1,7 +1,6 @@
import 'package:rive/src/core/core.dart'; import 'package:rive/src/core/core.dart';
import 'package:rive/src/generated/animation/blend_state_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/generated/animation/blend_state_base.dart';
export 'package:rive/src/generated/animation/blend_state_base.dart'; export 'package:rive/src/generated/animation/blend_state_base.dart';
// //

View File

@ -1,10 +1,9 @@
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 {

View File

@ -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';

View File

@ -1,7 +1,7 @@
import 'dart:collection'; import 'dart:collection';
import 'package:flutter/foundation.dart';
import 'package:rive/src/core/core.dart'; import 'package:rive/src/core/core.dart';
import 'package:flutter/foundation.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';

View File

@ -1,11 +1,10 @@
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 {

View File

@ -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;

View File

@ -1,6 +1,5 @@
import 'package:rive/src/generated/animation/entry_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/generated/animation/entry_state_base.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 {

View File

@ -1,6 +1,5 @@
import 'package:rive/src/generated/animation/exit_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/generated/animation/exit_state_base.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 {

View File

@ -1,12 +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/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> {

View File

@ -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 {

View File

@ -1,10 +1,11 @@
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>

View File

@ -1,9 +1,8 @@
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 {

View File

@ -1,11 +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/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 {

View File

@ -1,9 +1,8 @@
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 {

View File

@ -1,8 +1,8 @@
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_machine_component_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/generated/animation/state_machine_component_base.dart';
export 'package:rive/src/generated/animation/state_machine_component_base.dart'; export 'package:rive/src/generated/animation/state_machine_component_base.dart';

View File

@ -1,9 +1,8 @@
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 {

View File

@ -1,14 +1,13 @@
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 {

View File

@ -1,7 +1,6 @@
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';
@ -11,8 +10,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 }

View File

@ -1,9 +1,7 @@
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 {

View File

@ -1,9 +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/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';

View File

@ -1,8 +1,8 @@
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';

View File

@ -1,8 +1,7 @@
import 'dart:collection'; import 'dart:collection';
import 'package:rive/src/generated/animation/transition_trigger_condition_base.dart';
import 'package:rive/src/rive_core/animation/state_machine_trigger.dart'; import 'package:rive/src/rive_core/animation/state_machine_trigger.dart';
import 'package:rive/src/generated/animation/transition_trigger_condition_base.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 {

View File

@ -1,6 +1,5 @@
import 'package:rive/src/generated/animation/transition_value_condition_base.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_value_condition_base.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 {

View File

@ -1,7 +1,6 @@
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/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';
@ -15,6 +14,7 @@ import 'package:rive/src/rive_core/math/vec2d.dart';
import 'package:rive/src/rive_core/rive_animation_controller.dart'; import 'package:rive/src/rive_core/rive_animation_controller.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_paint_container.dart'; import 'package:rive/src/rive_core/shapes/shape_paint_container.dart';
import 'package:rive/src/generated/artboard_base.dart';
import 'package:rive/src/utilities/dependency_sorter.dart'; import 'package:rive/src/utilities/dependency_sorter.dart';
export 'package:rive/src/generated/artboard_base.dart'; export 'package:rive/src/generated/artboard_base.dart';
@ -129,7 +129,10 @@ class Artboard extends ArtboardBase with ShapePaintContainer {
didUpdate = true; didUpdate = true;
} }
} }
return updateComponents() || didUpdate; if (updateComponents() || didUpdate) {
return true;
}
return false;
} }
@override @override

View File

@ -1,7 +1,6 @@
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/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/bone_base.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);

View File

@ -1,6 +1,5 @@
import 'package:rive/src/generated/bones/cubic_weight_base.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/cubic_weight_base.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 {

View File

@ -1,11 +1,11 @@
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';

View File

@ -1,7 +1,6 @@
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 {

View File

@ -1,9 +1,8 @@
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 {

View File

@ -1,11 +1,11 @@
import 'package:flutter/foundation.dart';
import 'package:rive/src/core/core.dart'; import 'package:rive/src/core/core.dart';
import 'package:rive/src/generated/component_base.dart'; import 'package:flutter/foundation.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>

View File

@ -6,21 +6,27 @@ export 'package:rive/src/generated/constraints/constraint_base.dart';
/// providing rules for how to constrain its transform space. /// providing rules for how to constrain its transform space.
abstract class Constraint extends ConstraintBase { abstract class Constraint extends ConstraintBase {
/// Returns the [TransformComponent] which this [Constraint] is applied to. /// Returns the [TransformComponent] which this [Constraint] is applied to.
// TransformComponent? get constrainedComponent => TransformComponent? get constrainedComponent =>
// parent is TransformComponent ? parent as TransformComponent : null; parent is TransformComponent ? parent as TransformComponent : null;
TransformComponent get constrainedComponent => parent as TransformComponent;
@override @override
void strengthChanged(double from, double to) => void strengthChanged(double from, double to) =>
constrainedComponent.markTransformDirty(); constrainedComponent?.markTransformDirty();
@override @override
bool validate() => super.validate() && parent is TransformComponent; bool validate() => super.validate() && parent is TransformComponent;
void constrain(TransformComponent component); void constrain(TransformComponent component);
@override
void buildDependencies() {
super.buildDependencies();
parent!.addDependent(this);
}
@override @override
void update(int dirt) {} void update(int dirt) {}
void markConstraintDirty() => constrainedComponent.markTransformDirty(); void markConstraintDirty() => constrainedComponent?.markTransformDirty();
} }

View File

@ -0,0 +1,63 @@
import 'package:rive/src/rive_core/math/vec2d.dart';
import 'package:rive/src/generated/constraints/distance_constraint_base.dart';
import 'package:rive/src/rive_core/transform_component.dart';
export 'package:rive/src/generated/constraints/distance_constraint_base.dart';
enum DistanceConstraintMode { closer, further, exact }
const _distanceEpsilon = 0.001;
/// A constraint which transaltes its constrained component in world space to a
/// certain distance from the [target] based on [mode].
class DistanceConstraint extends DistanceConstraintBase {
@override
void constrain(TransformComponent component) {
if (target == null) {
return;
}
var targetTranslation = target!.worldTranslation;
var ourTranslation = component.worldTranslation;
var toTarget = Vec2D.subtract(Vec2D(), ourTranslation, targetTranslation);
var currentDistance = Vec2D.length(toTarget);
switch (mode) {
case DistanceConstraintMode.closer:
if (currentDistance < distance) {
return;
}
break;
case DistanceConstraintMode.further:
if (currentDistance > distance) {
return;
}
break;
case DistanceConstraintMode.exact:
break;
}
if (currentDistance < _distanceEpsilon) {
return;
}
Vec2D.scale(toTarget, toTarget, 1.0 / currentDistance);
Vec2D.scale(toTarget, toTarget, distance);
var world = component.worldTransform;
var position = Vec2D.add(Vec2D(), targetTranslation, toTarget);
Vec2D.lerp(position, ourTranslation, position, strength);
world[4] = position[0];
world[5] = position[1];
}
@override
void distanceChanged(double from, double to) => markConstraintDirty();
@override
void modeValueChanged(int from, int to) => markConstraintDirty();
DistanceConstraintMode get mode => DistanceConstraintMode.values[modeValue];
set mode(DistanceConstraintMode value) => modeValue = value.index;
@override
bool validate() => super.validate() && parent is TransformComponent;
}

View File

@ -1,13 +1,11 @@
import 'dart:math'; 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/artboard.dart';
import 'package:rive/src/rive_core/bones/bone.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/mat2d.dart';
import 'package:rive/src/rive_core/math/transform_components.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/math/vec2d.dart';
import 'package:rive/src/generated/constraints/ik_constraint_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/constraints/ik_constraint_base.dart'; export 'package:rive/src/generated/constraints/ik_constraint_base.dart';
/// A constraint which rotates its constrained bone and the parentBoneCount /// A constraint which rotates its constrained bone and the parentBoneCount
@ -34,12 +32,12 @@ class IKConstraint extends IKConstraintBase {
/// The list of bones in FK order. /// The list of bones in FK order.
final List<_BoneChainLink> _fkChain = []; final List<_BoneChainLink> _fkChain = [];
Iterable<_BoneChainLink> get fkChain => _fkChain;
@override @override
void buildDependencies() { void buildDependencies() {
super.buildDependencies(); super.buildDependencies();
parent!.addDependent(this);
// Rebuild the FK chain when we update dependencies. // Rebuild the FK chain when we update dependencies.
_fkChain.clear(); _fkChain.clear();
var boneCount = parentBoneCount; var boneCount = parentBoneCount;

View File

@ -25,7 +25,9 @@ abstract class TargetedConstraint extends TargetedConstraintBase {
super.buildDependencies(); super.buildDependencies();
// Targeted constraints must have their constrainedComponent update after // Targeted constraints must have their constrainedComponent update after
// the target. // the target.
_target?.addDependent(constrainedComponent, via: this); if (constrainedComponent != null) {
_target?.addDependent(constrainedComponent!, via: this);
}
} }
@override @override
@ -33,4 +35,5 @@ abstract class TargetedConstraint extends TargetedConstraintBase {
super.onAddedDirty(); super.onAddedDirty();
target = context.resolve(targetId); target = context.resolve(targetId);
} }
} }

View File

@ -1,9 +1,9 @@
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:flutter/material.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);

View File

@ -1,8 +1,7 @@
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 {

View File

@ -1,6 +1,6 @@
import 'package:rive/src/core/core.dart'; import 'package:rive/src/core/core.dart';
import 'package:rive/src/generated/draw_target_base.dart';
import 'package:rive/src/rive_core/drawable.dart'; import 'package:rive/src/rive_core/drawable.dart';
import 'package:rive/src/generated/draw_target_base.dart';
export 'package:rive/src/generated/draw_target_base.dart'; export 'package:rive/src/generated/draw_target_base.dart';

View File

@ -1,13 +1,12 @@
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 {

View File

@ -1,7 +1,6 @@
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 {}

View File

@ -1,10 +1,9 @@
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 {

View File

@ -1,10 +1,9 @@
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 {

View File

@ -1,10 +1,9 @@
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 {

View File

@ -1,10 +1,9 @@
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 {

View File

@ -1,10 +1,9 @@
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 {

View File

@ -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';

View File

@ -1,9 +1,8 @@
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.

View File

@ -1,8 +1,8 @@
import 'dart:ui' as ui; import 'dart:ui' as ui;
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/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';
import 'package:rive/src/generated/shapes/paint/gradient_stop_base.dart';
export 'package:rive/src/generated/shapes/paint/gradient_stop_base.dart'; export 'package:rive/src/generated/shapes/paint/gradient_stop_base.dart';

View File

@ -1,14 +1,13 @@
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

View File

@ -1,14 +1,13 @@
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

View File

@ -1,10 +1,9 @@
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.

View File

@ -1,10 +1,9 @@
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.

View File

@ -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 {

View File

@ -1,6 +1,5 @@
import 'package:rive/src/generated/shapes/parametric_path_base.dart';
import 'package:rive/src/rive_core/math/mat2d.dart'; import 'package:rive/src/rive_core/math/mat2d.dart';
import 'package:rive/src/generated/shapes/parametric_path_base.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 {

View File

@ -1,7 +1,6 @@
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';
@ -12,7 +11,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

View File

@ -1,12 +1,11 @@
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 {

View File

@ -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';

View File

@ -1,9 +1,9 @@
import 'dart:math'; import 'dart:math';
import 'package:rive/src/generated/shapes/polygon_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/polygon_base.dart';
export 'package:rive/src/generated/shapes/polygon_base.dart'; export 'package:rive/src/generated/shapes/polygon_base.dart';

View File

@ -1,7 +1,6 @@
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 {

View File

@ -1,7 +1,6 @@
import 'dart:ui' as ui; import 'dart:ui' as ui;
import 'package:collection/collection.dart'; 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';
@ -9,6 +8,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';
export 'package:rive/src/generated/shapes/shape_base.dart'; export 'package:rive/src/generated/shapes/shape_base.dart';

View File

@ -1,10 +1,9 @@
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 {

View File

@ -1,9 +1,8 @@
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 {

View File

@ -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';

View File

@ -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';

View File

@ -1,6 +1,4 @@
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/constraint.dart';
@ -11,7 +9,10 @@ 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';
import 'constraints/distance_constraint.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 {
@ -165,6 +166,7 @@ abstract class TransformComponent extends TransformComponentBase {
break; break;
case IKConstraintBase.typeKey: case IKConstraintBase.typeKey:
case DistanceConstraintBase.typeKey:
_constraints.add(child as Constraint); _constraints.add(child as Constraint);
break; break;
} }
@ -186,6 +188,7 @@ abstract class TransformComponent extends TransformComponentBase {
} }
break; break;
case IKConstraintBase.typeKey: case IKConstraintBase.typeKey:
case DistanceConstraintBase.typeKey:
_constraints.remove(child as Constraint); _constraints.remove(child as Constraint);
break; break;