From a0216e0e6bcf72523acab21f5c42ecb7d2f8ca98 Mon Sep 17 00:00:00 2001 From: bodymovin Date: Fri, 16 Aug 2024 17:40:06 +0000 Subject: [PATCH] Use artboard properties as transition conditions Adding support for transition conditions based on artboard properties. transition_artboard_condition extends from transition_viewmodel_condition. It might be good to rename transition_viewmodel_condition to transition_property_condition at some point since it is extensible enough to support viewmodels, but also with other properties like here. Diffs= 93cc33b45 Use artboard properties as transition conditions (#7796) c5fc07de9 Init NestedAnimation's nestedArtboard as nullptr (#7857) fb7756072 added some simple windows build scripts to make building on windows from powershell or command prompt easier (#7800) ed56d2de6 editor: nine-slicing core data type definitions (#7840) Co-authored-by: hernan --- .rive_head | 2 +- .../transition_artboard_condition_base.dart | 19 +++++++ ...ion_property_artboard_comparator_base.dart | 54 +++++++++++++++++++ .../transition_artboard_condition.dart | 5 ++ 4 files changed, 79 insertions(+), 1 deletion(-) create mode 100644 lib/src/generated/animation/transition_artboard_condition_base.dart create mode 100644 lib/src/generated/animation/transition_property_artboard_comparator_base.dart create mode 100644 lib/src/rive_core/animation/transition_artboard_condition.dart diff --git a/.rive_head b/.rive_head index 2db670ff..7e901c4a 100644 --- a/.rive_head +++ b/.rive_head @@ -1 +1 @@ -4fb978a9230fc006b5e575364f062907e7dd2afe +93cc33b45086e528b22d1245a8f7855bac299a21 diff --git a/lib/src/generated/animation/transition_artboard_condition_base.dart b/lib/src/generated/animation/transition_artboard_condition_base.dart new file mode 100644 index 00000000..0a7b2d4f --- /dev/null +++ b/lib/src/generated/animation/transition_artboard_condition_base.dart @@ -0,0 +1,19 @@ +// Core automatically generated +// lib/src/generated/animation/transition_artboard_condition_base.dart. +// Do not modify manually. + +import 'package:rive/src/generated/animation/transition_condition_base.dart'; +import 'package:rive/src/rive_core/animation/transition_viewmodel_condition.dart'; + +abstract class TransitionArtboardConditionBase + extends TransitionViewModelCondition { + static const int typeKey = 497; + @override + int get coreType => TransitionArtboardConditionBase.typeKey; + @override + Set get coreTypes => { + TransitionArtboardConditionBase.typeKey, + TransitionViewModelConditionBase.typeKey, + TransitionConditionBase.typeKey + }; +} diff --git a/lib/src/generated/animation/transition_property_artboard_comparator_base.dart b/lib/src/generated/animation/transition_property_artboard_comparator_base.dart new file mode 100644 index 00000000..fa45621d --- /dev/null +++ b/lib/src/generated/animation/transition_property_artboard_comparator_base.dart @@ -0,0 +1,54 @@ +// Core automatically generated +// nullnull +// t. +// Do not modify manually. + +import 'package:rive/src/core/core.dart'; +import 'package:rive/src/generated/animation/transition_comparator_base.dart'; +import 'package:rive/src/rive_core/animation/transition_property_comparator.dart'; + +abstract class TransitionPropertyArtboardComparatorBase + extends TransitionPropertyComparator { + static const int typeKey = 496; + @override + int get coreType => TransitionPropertyArtboardComparatorBase.typeKey; + @override + Set get coreTypes => { + TransitionPropertyArtboardComparatorBase.typeKey, + TransitionPropertyComparatorBase.typeKey, + TransitionComparatorBase.typeKey + }; + + /// -------------------------------------------------------------------------- + /// PropertyType field with key 677. + static const int propertyTypePropertyKey = 677; + static const int propertyTypeInitialValue = 0; + int _propertyType = propertyTypeInitialValue; + + /// Integer representation of the artboard's property used for condition + int get propertyType => _propertyType; + + /// Change the [_propertyType] field value. + /// [propertyTypeChanged] will be invoked only if the field's value has + /// changed. + set propertyType(int value) { + if (_propertyType == value) { + return; + } + int from = _propertyType; + _propertyType = value; + if (hasValidated) { + propertyTypeChanged(from, value); + } + } + + void propertyTypeChanged(int from, int to); + + @override + void copy(Core source) { + super.copy(source); + if (source is TransitionPropertyArtboardComparatorBase) { + _propertyType = source._propertyType; + } + } +} diff --git a/lib/src/rive_core/animation/transition_artboard_condition.dart b/lib/src/rive_core/animation/transition_artboard_condition.dart new file mode 100644 index 00000000..3066fc6f --- /dev/null +++ b/lib/src/rive_core/animation/transition_artboard_condition.dart @@ -0,0 +1,5 @@ +import 'package:rive/src/generated/animation/transition_artboard_condition_base.dart'; + +export 'package:rive/src/generated/animation/transition_artboard_condition_base.dart'; + +class TransitionArtboardCondition extends TransitionArtboardConditionBase {}