diff --git a/lib/src/core/importers/layer_state_importer.dart b/lib/src/core/importers/layer_state_importer.dart index 3dd8e8f..b3fa662 100644 --- a/lib/src/core/importers/layer_state_importer.dart +++ b/lib/src/core/importers/layer_state_importer.dart @@ -1,7 +1,6 @@ import 'package:rive/src/core/importers/artboard_import_stack_object.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_direct.dart'; import 'package:rive/src/rive_core/animation/blend_state_transition.dart'; import 'package:rive/src/rive_core/animation/layer_state.dart'; import 'package:rive/src/rive_core/animation/state_transition.dart'; @@ -16,8 +15,10 @@ class LayerStateImporter extends ArtboardImportStackObject { } bool addBlendAnimation(BlendAnimation blendAnimation) { - if (state is BlendStateDirect) { - var blendState = state as BlendStateDirect; + // This works because we explicitly export our transitions before our + // animations. + if (state is BlendState) { + var blendState = state as BlendState; for (final transition in state.transitions.whereType()) { if (transition.exitBlendAnimationId >= 0 && diff --git a/lib/src/rive_core/animation/blend_state.dart b/lib/src/rive_core/animation/blend_state.dart index e6a157b..2fe958c 100644 --- a/lib/src/rive_core/animation/blend_state.dart +++ b/lib/src/rive_core/animation/blend_state.dart @@ -10,7 +10,7 @@ abstract class BlendState extends BlendStateBase { void internalAddAnimation(T animation) { assert(!_animations.contains(animation), - 'shouln\'t already contain the animation'); + 'shouldn\'t already contain the animation'); _animations.add(animation); } diff --git a/lib/src/rive_core/animation/blend_state_direct_instance.dart b/lib/src/rive_core/animation/blend_state_direct_instance.dart index dde8470..4105754 100644 --- a/lib/src/rive_core/animation/blend_state_direct_instance.dart +++ b/lib/src/rive_core/animation/blend_state_direct_instance.dart @@ -18,7 +18,7 @@ class BlendStateDirectInstance ? inputValue : animation.blendAnimation.input?.value) ?? 0; - animation.mix = value / 100; + animation.mix = (value / 100).clamp(0, 1); } } }