support for interrupting transitions on state change

We are adding a flag to support interrupting transitions on state changes.

Diffs=
337f9df1c support for interrupting transitions on state change (#6850)

Co-authored-by: hernan <hernan@rive.app>
This commit is contained in:
bodymovin
2024-03-15 19:26:13 +00:00
parent b68f6e89a9
commit b53ddd7cd6
4 changed files with 7 additions and 2 deletions

View File

@ -1 +1 @@
e68c7b6ded17c667fe344426e54710875fc58e94
337f9df1c04ace751fe16ed2b014477155d9cbfc

View File

@ -71,6 +71,8 @@ class StateTransition extends StateTransitionBase {
bool get isDisabled => (flags & StateTransitionFlags.disabled) != 0;
bool get pauseOnExit => (flags & StateTransitionFlags.pauseOnExit) != 0;
bool get enableExitTime => (flags & StateTransitionFlags.enableExitTime) != 0;
bool get enableEarlyExit =>
(flags & StateTransitionFlags.enableEarlyExit) != 0;
/// The amount of time to mix the outgoing animation onto the incoming one
/// when changing state. Only applies when going out from an AnimationState.

View File

@ -207,7 +207,7 @@ class LayerController {
double _holdTime = 0;
bool updateState(bool ignoreTriggers) {
if (isTransitioning) {
if (isTransitioning && _transition!.enableEarlyExit == false) {
return false;
}
_waitingForExit = false;

View File

@ -14,4 +14,7 @@ class StateTransitionFlags {
/// Whether the animation is held at exit or if it keeps advancing during
/// mixing.
static const int pauseOnExit = 1 << 4;
/// Whether the transition can exit before it is complete.
static const int enableEarlyExit = 1 << 5;
}