Minor cleanup

This commit is contained in:
Luigi Rosso
2021-05-07 22:25:29 -07:00
parent df1ed3e288
commit 607a8a3ee4
3 changed files with 6 additions and 5 deletions

View File

@ -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<BlendStateTransition>()) {
if (transition.exitBlendAnimationId >= 0 &&

View File

@ -10,7 +10,7 @@ abstract class BlendState<T extends BlendAnimation> 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);
}

View File

@ -18,7 +18,7 @@ class BlendStateDirectInstance
? inputValue
: animation.blendAnimation.input?.value) ??
0;
animation.mix = value / 100;
animation.mix = (value / 100).clamp(0, 1);
}
}
}