@react-native-ohos/react-native-reanimated 3.18.1-rc.6 → 4.0.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/compatibility.json +161 -0
- package/harmony/reanimated/BuildProfile.ets +1 -1
- package/harmony/reanimated/build-profile.json5 +8 -1
- package/harmony/reanimated/oh-package.json5 +3 -2
- package/harmony/reanimated/src/main/cpp/CMakeLists.txt +31 -40
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/AnimatedSensor/AnimatedSensorModule.cpp +11 -16
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/AnimatedSensor/AnimatedSensorModule.h +3 -4
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/InterpolatorRegistry.cpp +390 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/InterpolatorRegistry.h +16 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/definitions.h +30 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/filters/FilterOp.cpp +46 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/filters/FilterOp.h +23 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/transforms/Quaternion.cpp +53 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/transforms/Quaternion.h +21 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/transforms/TransformMatrix.cpp +166 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/transforms/TransformMatrix.h +71 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/transforms/TransformMatrix2D.cpp +368 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/transforms/TransformMatrix2D.h +53 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/transforms/TransformMatrix3D.cpp +594 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/transforms/TransformMatrix3D.h +67 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/transforms/TransformOp.cpp +52 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/transforms/TransformOp.h +26 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/transforms/vectors.cpp +156 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/transforms/vectors.h +76 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSAngle.cpp +93 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSAngle.h +33 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSBoolean.cpp +48 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSBoolean.h +31 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSColor.cpp +135 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSColor.h +61 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSDiscreteArray.cpp +100 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSDiscreteArray.h +44 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSKeyword.cpp +81 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSKeyword.h +53 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSLength.cpp +122 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSLength.h +38 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSNumber.cpp +82 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSNumber.h +63 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSValue.h +118 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSValueVariant.cpp +174 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/CSSValueVariant.h +111 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/complex/CSSBoxShadow.cpp +196 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/complex/CSSBoxShadow.h +66 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/complex/CSSDropShadow.cpp +134 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/common/values/complex/CSSDropShadow.h +44 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/configs/CSSAnimationConfig.cpp +174 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/configs/CSSAnimationConfig.h +49 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/configs/CSSKeyframesConfig.cpp +45 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/configs/CSSKeyframesConfig.h +26 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/configs/CSSTransitionConfig.cpp +90 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/configs/CSSTransitionConfig.h +43 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/configs/common.cpp +17 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/configs/common.h +13 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/core/CSSAnimation.cpp +127 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/core/CSSAnimation.h +51 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/core/CSSTransition.cpp +145 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/core/CSSTransition.h +47 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/easing/EasingFunctions.cpp +69 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/easing/EasingFunctions.h +22 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/easing/cubicBezier.cpp +66 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/easing/cubicBezier.h +15 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/easing/linear.cpp +28 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/easing/linear.h +15 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/easing/steps.cpp +13 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/easing/steps.h +12 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/InterpolatorFactory.cpp +157 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/InterpolatorFactory.h +189 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/PropertyInterpolator.cpp +76 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/PropertyInterpolator.h +66 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/configs.h +20 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/filters/FilterOperation.cpp +136 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/filters/FilterOperation.h +40 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/filters/FilterOperationInterpolator.cpp +38 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/filters/FilterOperationInterpolator.h +24 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/filters/FilterStyleInterpolator.cpp +58 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/filters/FilterStyleInterpolator.h +24 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/filters/operations/blur.h +14 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/filters/operations/brightness.h +14 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/filters/operations/contrast.h +14 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/filters/operations/dropShadow.h +17 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/filters/operations/grayscale.h +14 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/filters/operations/hueRotate.h +14 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/filters/operations/invert.h +14 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/filters/operations/opacity.h +14 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/filters/operations/saturate.h +14 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/filters/operations/sepia.h +14 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/groups/ArrayPropertiesInterpolator.cpp +95 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/groups/ArrayPropertiesInterpolator.h +36 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/groups/GroupPropertiesInterpolator.cpp +41 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/groups/GroupPropertiesInterpolator.h +32 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/groups/RecordPropertiesInterpolator.cpp +99 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/groups/RecordPropertiesInterpolator.h +37 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/operations/OperationsStyleInterpolator.cpp +308 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/operations/OperationsStyleInterpolator.h +100 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/operations/StyleOperation.cpp +19 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/operations/StyleOperation.h +94 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/operations/StyleOperationInterpolator.cpp +18 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/operations/StyleOperationInterpolator.h +43 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/styles/AnimationStyleInterpolator.h +26 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/styles/TransitionStyleInterpolator.cpp +103 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/styles/TransitionStyleInterpolator.h +42 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/TransformOperation.cpp +224 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/TransformOperation.h +52 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/TransformOperationInterpolator.cpp +218 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/TransformOperationInterpolator.h +89 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/TransformsStyleInterpolator.cpp +149 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/TransformsStyleInterpolator.h +33 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/operations/matrix.cpp +208 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/operations/matrix.h +56 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/operations/perspective.cpp +42 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/operations/perspective.h +20 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/operations/rotate.cpp +41 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/operations/rotate.h +39 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/operations/scale.cpp +28 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/operations/scale.h +25 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/operations/skew.cpp +14 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/operations/skew.h +20 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/operations/translate.cpp +39 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/transforms/operations/translate.h +25 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/values/ResolvableValueInterpolator.cpp +47 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/values/ResolvableValueInterpolator.h +43 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/values/SimpleValueInterpolator.cpp +70 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/values/SimpleValueInterpolator.h +40 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/values/ValueInterpolator.cpp +146 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/interpolation/values/ValueInterpolator.h +71 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/misc/ViewStylesRepository.cpp +155 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/misc/ViewStylesRepository.h +53 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/progress/AnimationProgressProvider.cpp +170 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/progress/AnimationProgressProvider.h +67 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/progress/KeyframeProgressProvider.h +12 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/progress/RawProgressProvider.cpp +41 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/progress/RawProgressProvider.h +31 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/progress/TransitionProgressProvider.cpp +193 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/progress/TransitionProgressProvider.h +77 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/registries/CSSAnimationsRegistry.cpp +340 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/registries/CSSAnimationsRegistry.h +80 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/registries/CSSKeyframesRegistry.cpp +45 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/registries/CSSKeyframesRegistry.h +29 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/registries/CSSTransitionsRegistry.cpp +167 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/registries/CSSTransitionsRegistry.h +51 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/registries/StaticPropsRegistry.cpp +61 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/registries/StaticPropsRegistry.h +33 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/svg/values/SVGBrush.cpp +80 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/svg/values/SVGBrush.h +39 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/svg/values/SVGLength.cpp +93 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/svg/values/SVGLength.h +36 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/svg/values/SVGStrokeDashArray.cpp +110 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/svg/values/SVGStrokeDashArray.h +33 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/utils/DelayedItemsManager.cpp +75 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/utils/DelayedItemsManager.h +45 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/utils/algorithms.cpp +12 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/utils/algorithms.h +10 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/utils/interpolators.cpp +36 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/utils/interpolators.h +23 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/utils/props.cpp +149 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/CSS/utils/props.h +32 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ReanimatedCommitHook.cpp +51 -39
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ReanimatedCommitHook.h +13 -15
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ReanimatedCommitShadowNode.h +0 -3
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ReanimatedMountHook.cpp +22 -53
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ReanimatedMountHook.h +12 -8
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ShadowTreeCloner.cpp +46 -37
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ShadowTreeCloner.h +3 -10
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/updates/AnimatedPropsRegistry.cpp +72 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/updates/AnimatedPropsRegistry.h +25 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/updates/UpdatesRegistry.cpp +160 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/updates/UpdatesRegistry.h +71 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/updates/UpdatesRegistryManager.cpp +161 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/updates/UpdatesRegistryManager.h +65 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationType.h +4 -2
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsManager.cpp +62 -157
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsManager.h +38 -46
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxyCommon.cpp +79 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxyCommon.h +81 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxy_Experimental.cpp +864 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxy_Experimental.h +214 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/{LayoutAnimationsProxy.cpp → LayoutAnimationsProxy_Legacy.cpp} +303 -276
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxy_Legacy.h +220 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsUtils.cpp +5 -65
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsUtils.h +52 -82
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/PropsDiffer.cpp +456 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/PropsDiffer.h +102 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/SharedTransitions.cpp +544 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/NativeModules/PropValueProcessor.cpp +119 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/NativeModules/PropValueProcessor.h +39 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/NativeModules/ReanimatedModuleProxy.cpp +957 -552
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/NativeModules/ReanimatedModuleProxy.h +87 -111
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/NativeModules/ReanimatedModuleProxySpec.cpp +115 -163
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/NativeModules/ReanimatedModuleProxySpec.h +38 -54
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/RuntimeDecorators/RNRuntimeDecorator.cpp +34 -36
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/RuntimeDecorators/RNRuntimeDecorator.h +8 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/RuntimeDecorators/UIRuntimeDecorator.cpp +46 -58
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/RuntimeDecorators/UIRuntimeDecorator.h +5 -9
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Tools/FeatureFlags.cpp +18 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Tools/FeatureFlags.h +44 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Tools/PlatformDepMethodsHolder.h +26 -57
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Tools/ReanimatedSystraceSection.h +12 -33
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Tools/ReanimatedVersion.cpp +46 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/{worklets → reanimated}/Tools/ReanimatedVersion.h +3 -4
- package/harmony/reanimated/src/main/cpp/ReanimatedModule.cpp +60 -85
- package/harmony/reanimated/src/main/cpp/ReanimatedNodesManager.cpp +1 -0
- package/harmony/reanimated/src/main/cpp/ReanimatedPackage.cpp +0 -3
- package/harmony/reanimated/src/main/cpp/ReanimatedSensor.cpp +266 -0
- package/harmony/reanimated/src/main/cpp/ReanimatedSensor.h +36 -0
- package/harmony/reanimated/src/main/cpp/ReanimatedSensorContainer.cpp +36 -0
- package/harmony/reanimated/src/main/cpp/ReanimatedSensorContainer.h +23 -0
- package/harmony/reanimated/src/main/cpp/ReanimatedUIScheduler.h +3 -3
- package/harmony/reanimated/src/main/ets/ReanimatedModule.ts +12 -1
- package/harmony/reanimated/src/main/ets/ReanimatedPackage.ts +1 -4
- package/harmony/reanimated.har +0 -0
- package/package.json +36 -18
- package/scripts/deploy.js +191 -0
- package/scripts/set-reanimated-version.js +37 -0
- package/scripts/update-version.js +119 -0
- package/scripts/validate-react-native-version.js +46 -0
- package/scripts/validate-worklets-build.js +17 -0
- package/scripts/validate-worklets-version.js +79 -0
- package/scripts/worklets-version.json +4 -0
- package/LICENSE +0 -21
- package/README.OpenSource +0 -11
- package/README.md +0 -10
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/PropsRegistry.cpp +0 -68
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/PropsRegistry.h +0 -68
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxy.h +0 -147
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Tools/CollectionUtils.h +0 -14
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Tools/FeaturesConfig.cpp +0 -5
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Tools/FeaturesConfig.h +0 -19
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/NativeModules/WorkletsModuleProxy.cpp +0 -47
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/NativeModules/WorkletsModuleProxy.h +0 -59
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/NativeModules/WorkletsModuleProxySpec.cpp +0 -27
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/NativeModules/WorkletsModuleProxySpec.h +0 -25
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Registries/EventHandlerRegistry.cpp +0 -94
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Registries/EventHandlerRegistry.h +0 -49
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Registries/WorkletRuntimeRegistry.cpp +0 -8
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Registries/WorkletRuntimeRegistry.h +0 -39
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/SharedItems/Shareables.cpp +0 -326
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/SharedItems/Shareables.h +0 -345
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/AsyncQueue.cpp +0 -52
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/AsyncQueue.h +0 -35
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/Defs.h +0 -10
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/JSISerializer.cpp +0 -342
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/JSISerializer.h +0 -47
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/JSLogger.cpp +0 -16
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/JSLogger.h +0 -20
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/JSScheduler.cpp +0 -20
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/JSScheduler.h +0 -29
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/PlatformLogger.h +0 -16
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/ReanimatedJSIUtils.cpp +0 -26
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/ReanimatedJSIUtils.h +0 -199
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/ReanimatedVersion.cpp +0 -95
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/SingleInstanceChecker.h +0 -72
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/ThreadSafeQueue.h +0 -49
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/UIScheduler.cpp +0 -20
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/UIScheduler.h +0 -22
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/WorkletEventHandler.cpp +0 -29
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/WorkletEventHandler.h +0 -41
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/RNRuntimeWorkletDecorator.cpp +0 -16
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/RNRuntimeWorkletDecorator.h +0 -19
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/ReanimatedHermesRuntime.cpp +0 -112
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/ReanimatedHermesRuntime.h +0 -127
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/ReanimatedRuntime.cpp +0 -53
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/ReanimatedRuntime.h +0 -22
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/RuntimeInitialization.md +0 -191
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/WorkletRuntime.cpp +0 -155
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/WorkletRuntime.h +0 -90
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/WorkletRuntimeCollector.h +0 -36
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/WorkletRuntimeDecorator.cpp +0 -182
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/WorkletRuntimeDecorator.h +0 -22
- package/harmony/reanimated/src/main/cpp/ReanimatedLogger.cpp +0 -33
- package/harmony/reanimated/src/main/cpp/WorkletsModule.cpp +0 -61
- package/harmony/reanimated/src/main/cpp/WorkletsModule.h +0 -22
- package/harmony/reanimated/src/main/cpp/patches/AnimatedSensor/AnimatedSensorModule.cpp +0 -89
- package/harmony/reanimated/src/main/cpp/patches/Fabric/ShadowTreeCloner.cpp +0 -95
- package/harmony/reanimated/src/main/cpp/patches/NativeModules/ReanimatedModuleProxy.cpp +0 -964
- package/harmony/reanimated/src/main/ets/WorkletsModule.ts +0 -15
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include <reanimated/CSS/interpolation/configs.h>
|
|
4
|
+
#include <reanimated/CSS/interpolation/operations/StyleOperationInterpolator.h>
|
|
5
|
+
#include <reanimated/CSS/interpolation/transforms/operations/matrix.h>
|
|
6
|
+
#include <reanimated/CSS/interpolation/transforms/operations/perspective.h>
|
|
7
|
+
|
|
8
|
+
#include <memory>
|
|
9
|
+
#include <type_traits>
|
|
10
|
+
|
|
11
|
+
namespace reanimated::css {
|
|
12
|
+
|
|
13
|
+
// Base implementation for simple operations
|
|
14
|
+
template <typename TOperation, typename = void>
|
|
15
|
+
class TransformOperationInterpolator : public StyleOperationInterpolator {
|
|
16
|
+
public:
|
|
17
|
+
using StyleOperationInterpolator::StyleOperationInterpolator;
|
|
18
|
+
|
|
19
|
+
std::unique_ptr<StyleOperation> interpolate(
|
|
20
|
+
double progress,
|
|
21
|
+
const std::shared_ptr<StyleOperation> &from,
|
|
22
|
+
const std::shared_ptr<StyleOperation> &to,
|
|
23
|
+
const StyleOperationsInterpolationContext &context) const override;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
// Specialization for PerspectiveOperation
|
|
27
|
+
template <>
|
|
28
|
+
class TransformOperationInterpolator<PerspectiveOperation, void> : public StyleOperationInterpolator {
|
|
29
|
+
public:
|
|
30
|
+
explicit TransformOperationInterpolator(const std::shared_ptr<PerspectiveOperation> &defaultOperation);
|
|
31
|
+
|
|
32
|
+
std::unique_ptr<StyleOperation> interpolate(
|
|
33
|
+
double progress,
|
|
34
|
+
const std::shared_ptr<StyleOperation> &from,
|
|
35
|
+
const std::shared_ptr<StyleOperation> &to,
|
|
36
|
+
const StyleOperationsInterpolationContext &context) const override;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
// Specialization for MatrixOperation
|
|
40
|
+
template <>
|
|
41
|
+
class TransformOperationInterpolator<MatrixOperation, void> : public StyleOperationInterpolator {
|
|
42
|
+
public:
|
|
43
|
+
explicit TransformOperationInterpolator(const std::shared_ptr<MatrixOperation> &defaultOperation);
|
|
44
|
+
|
|
45
|
+
std::unique_ptr<StyleOperation> interpolate(
|
|
46
|
+
double progress,
|
|
47
|
+
const std::shared_ptr<StyleOperation> &from,
|
|
48
|
+
const std::shared_ptr<StyleOperation> &to,
|
|
49
|
+
const StyleOperationsInterpolationContext &context) const override;
|
|
50
|
+
|
|
51
|
+
protected:
|
|
52
|
+
template <typename MatrixType>
|
|
53
|
+
MatrixType interpolateMatrix(double progress, const TransformMatrix::Shared &from, const TransformMatrix::Shared &to)
|
|
54
|
+
const;
|
|
55
|
+
|
|
56
|
+
TransformMatrix::Shared matrixFromOperation(
|
|
57
|
+
const std::shared_ptr<TransformOperation> &operation,
|
|
58
|
+
bool shouldBe3D,
|
|
59
|
+
const StyleOperationsInterpolationContext &context) const;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
// Specialization for resolvable operations
|
|
63
|
+
template <typename TOperation>
|
|
64
|
+
class TransformOperationInterpolator<
|
|
65
|
+
TOperation,
|
|
66
|
+
std::enable_if_t<ResolvableOp<TOperation> && !std::is_same_v<TOperation, PerspectiveOperation> && !std::is_same_v<TOperation, MatrixOperation>>> : public StyleOperationInterpolator {
|
|
67
|
+
public:
|
|
68
|
+
TransformOperationInterpolator(
|
|
69
|
+
const std::shared_ptr<TOperation> &defaultOperation,
|
|
70
|
+
ResolvableValueInterpolatorConfig config);
|
|
71
|
+
|
|
72
|
+
std::unique_ptr<StyleOperation> interpolate(
|
|
73
|
+
double progress,
|
|
74
|
+
const std::shared_ptr<StyleOperation> &from,
|
|
75
|
+
const std::shared_ptr<StyleOperation> &to,
|
|
76
|
+
const StyleOperationsInterpolationContext &context) const override;
|
|
77
|
+
|
|
78
|
+
std::shared_ptr<StyleOperation> resolveOperation(
|
|
79
|
+
const std::shared_ptr<StyleOperation> &operation,
|
|
80
|
+
const StyleOperationsInterpolationContext &context) const override;
|
|
81
|
+
|
|
82
|
+
protected:
|
|
83
|
+
const ResolvableValueInterpolatorConfig config_;
|
|
84
|
+
|
|
85
|
+
ResolvableValueInterpolationContext getResolvableValueContext(
|
|
86
|
+
const StyleOperationsInterpolationContext &context) const;
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
} // namespace reanimated::css
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
#include <reanimated/CSS/interpolation/transforms/TransformsStyleInterpolator.h>
|
|
2
|
+
|
|
3
|
+
#include <unordered_map>
|
|
4
|
+
|
|
5
|
+
namespace reanimated::css {
|
|
6
|
+
|
|
7
|
+
const folly::dynamic defaultStyleValue = folly::dynamic::array(MatrixOperation(TransformMatrix3D()).toDynamic());
|
|
8
|
+
|
|
9
|
+
TransformsStyleInterpolator::TransformsStyleInterpolator(
|
|
10
|
+
const PropertyPath &propertyPath,
|
|
11
|
+
const std::shared_ptr<StyleOperationInterpolators> &interpolators,
|
|
12
|
+
const std::shared_ptr<ViewStylesRepository> &viewStylesRepository)
|
|
13
|
+
: OperationsStyleInterpolatorBase<TransformOperation>(
|
|
14
|
+
propertyPath,
|
|
15
|
+
interpolators,
|
|
16
|
+
viewStylesRepository,
|
|
17
|
+
defaultStyleValue) {}
|
|
18
|
+
|
|
19
|
+
void TransformsStyleInterpolator::addConvertedOperations(
|
|
20
|
+
const std::shared_ptr<TransformOperation> &sourceOperation,
|
|
21
|
+
const std::shared_ptr<TransformOperation> &targetOperation,
|
|
22
|
+
StyleOperations &sourceResult,
|
|
23
|
+
StyleOperations &targetResult) const {
|
|
24
|
+
const auto convertedOps = sourceOperation->convertTo(static_cast<TransformOp>(targetOperation->type));
|
|
25
|
+
|
|
26
|
+
targetResult.emplace_back(targetOperation);
|
|
27
|
+
for (size_t k = 0; k < convertedOps.size(); ++k) {
|
|
28
|
+
sourceResult.emplace_back(convertedOps[k]);
|
|
29
|
+
// Converted operations will contain one operation with the same type and
|
|
30
|
+
// can contain more operations derived from the source operation (we need
|
|
31
|
+
// to pair them with operations of the same type with default values)
|
|
32
|
+
if (k > 0) {
|
|
33
|
+
targetResult.emplace_back(getDefaultOperationOfType(convertedOps[k]->type));
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
std::optional<std::pair<StyleOperations, StyleOperations>> TransformsStyleInterpolator::createInterpolationPair(
|
|
39
|
+
const StyleOperations &fromOperations,
|
|
40
|
+
const StyleOperations &toOperations) const {
|
|
41
|
+
StyleOperations fromOperationsResult, toOperationsResult;
|
|
42
|
+
size_t i = 0, j = 0;
|
|
43
|
+
bool shouldInterpolateMatrices = false;
|
|
44
|
+
|
|
45
|
+
// Build index maps and check for matrix operation
|
|
46
|
+
std::unordered_map<uint8_t, size_t> lastIndexInFrom, lastIndexInTo;
|
|
47
|
+
for (size_t idx = 0; idx < fromOperations.size(); ++idx) {
|
|
48
|
+
if (static_cast<TransformOp>(fromOperations[idx]->type) == TransformOp::Matrix) {
|
|
49
|
+
shouldInterpolateMatrices = true;
|
|
50
|
+
break;
|
|
51
|
+
}
|
|
52
|
+
lastIndexInFrom[fromOperations[idx]->type] = idx;
|
|
53
|
+
}
|
|
54
|
+
for (size_t idx = 0; idx < toOperations.size() && !shouldInterpolateMatrices; ++idx) {
|
|
55
|
+
if (static_cast<TransformOp>(toOperations[idx]->type) == TransformOp::Matrix) {
|
|
56
|
+
shouldInterpolateMatrices = true;
|
|
57
|
+
break;
|
|
58
|
+
}
|
|
59
|
+
lastIndexInTo[toOperations[idx]->type] = idx;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
while (!shouldInterpolateMatrices && i < fromOperations.size() && j < toOperations.size()) {
|
|
63
|
+
const auto &fromOperation = std::static_pointer_cast<TransformOperation>(fromOperations[i]);
|
|
64
|
+
const auto &toOperation = std::static_pointer_cast<TransformOperation>(toOperations[j]);
|
|
65
|
+
const auto fromType = static_cast<TransformOp>(fromOperation->type);
|
|
66
|
+
const auto toType = static_cast<TransformOp>(toOperation->type);
|
|
67
|
+
|
|
68
|
+
// Case 1: Types match directly
|
|
69
|
+
if (fromType == toType) {
|
|
70
|
+
fromOperationsResult.emplace_back(fromOperation);
|
|
71
|
+
toOperationsResult.emplace_back(toOperation);
|
|
72
|
+
i++;
|
|
73
|
+
j++;
|
|
74
|
+
} else if (fromOperation->canConvertTo(toType)) {
|
|
75
|
+
// Case 2: Operations can be converted to each other's type
|
|
76
|
+
addConvertedOperations(fromOperation, toOperation, fromOperationsResult, toOperationsResult);
|
|
77
|
+
i++;
|
|
78
|
+
j++;
|
|
79
|
+
} else if (toOperation->canConvertTo(fromType)) {
|
|
80
|
+
addConvertedOperations(toOperation, fromOperation, toOperationsResult, fromOperationsResult);
|
|
81
|
+
i++;
|
|
82
|
+
j++;
|
|
83
|
+
} else {
|
|
84
|
+
if (fromType == TransformOp::Perspective || toType == TransformOp::Perspective) {
|
|
85
|
+
shouldInterpolateMatrices = true;
|
|
86
|
+
break;
|
|
87
|
+
}
|
|
88
|
+
// Case 3: Use default values if no conversion possible
|
|
89
|
+
bool toExistsLaterInFrom = lastIndexInFrom.count(toOperation->type) && lastIndexInFrom[toOperation->type] > i;
|
|
90
|
+
bool fromExistsLaterInTo = lastIndexInTo.count(fromOperation->type) && lastIndexInTo[fromOperation->type] > j;
|
|
91
|
+
|
|
92
|
+
if (toExistsLaterInFrom == fromExistsLaterInTo) {
|
|
93
|
+
// If neither exists later, or both exist later (were reordered), we
|
|
94
|
+
// cannot interpolate the operations directly and we need to convert
|
|
95
|
+
// these operations to matrices
|
|
96
|
+
shouldInterpolateMatrices = true;
|
|
97
|
+
break;
|
|
98
|
+
} else if (!fromExistsLaterInTo) {
|
|
99
|
+
// If fromOperation does not exist later in toOperations, we can
|
|
100
|
+
// interpolate it to the default value
|
|
101
|
+
fromOperationsResult.emplace_back(fromOperation);
|
|
102
|
+
toOperationsResult.emplace_back(getDefaultOperationOfType(fromOperation->type));
|
|
103
|
+
i++;
|
|
104
|
+
} else {
|
|
105
|
+
// If toOperation does not exist later in fromOperations, we can
|
|
106
|
+
// interpolate it from the default value
|
|
107
|
+
fromOperationsResult.emplace_back(getDefaultOperationOfType(toOperation->type));
|
|
108
|
+
toOperationsResult.emplace_back(toOperation);
|
|
109
|
+
j++;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// Convert all operations to matrices if matrix interpolation is required
|
|
115
|
+
if (shouldInterpolateMatrices) {
|
|
116
|
+
return std::make_pair(
|
|
117
|
+
StyleOperations{std::make_shared<MatrixOperation>(convertToTransformOperations(fromOperations))},
|
|
118
|
+
StyleOperations{std::make_shared<MatrixOperation>(convertToTransformOperations(toOperations))});
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// Add remaining operations with default values
|
|
122
|
+
for (; i < fromOperations.size(); ++i) {
|
|
123
|
+
fromOperationsResult.emplace_back(fromOperations[i]);
|
|
124
|
+
toOperationsResult.emplace_back(getDefaultOperationOfType(fromOperations[i]->type));
|
|
125
|
+
}
|
|
126
|
+
for (; j < toOperations.size(); ++j) {
|
|
127
|
+
fromOperationsResult.emplace_back(getDefaultOperationOfType(toOperations[j]->type));
|
|
128
|
+
toOperationsResult.emplace_back(toOperations[j]);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
return std::make_pair(fromOperationsResult, toOperationsResult);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
TransformOperations TransformsStyleInterpolator::convertToTransformOperations(const StyleOperations &operations) const {
|
|
135
|
+
TransformOperations result;
|
|
136
|
+
result.reserve(operations.size());
|
|
137
|
+
|
|
138
|
+
for (const auto &operation : operations) {
|
|
139
|
+
result.emplace_back(std::static_pointer_cast<TransformOperation>(operation));
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
return result;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
std::shared_ptr<TransformOperation> TransformsStyleInterpolator::getDefaultOperationOfType(const uint8_t type) const {
|
|
146
|
+
return std::static_pointer_cast<TransformOperation>(interpolators_->at(type)->getDefaultOperation());
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
} // namespace reanimated::css
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include <reanimated/CSS/interpolation/operations/OperationsStyleInterpolator.h>
|
|
4
|
+
#include <reanimated/CSS/interpolation/transforms/TransformOperationInterpolator.h>
|
|
5
|
+
|
|
6
|
+
#include <memory>
|
|
7
|
+
#include <utility>
|
|
8
|
+
|
|
9
|
+
namespace reanimated::css {
|
|
10
|
+
|
|
11
|
+
class TransformsStyleInterpolator final : public OperationsStyleInterpolatorBase<TransformOperation> {
|
|
12
|
+
public:
|
|
13
|
+
TransformsStyleInterpolator(
|
|
14
|
+
const PropertyPath &propertyPath,
|
|
15
|
+
const std::shared_ptr<StyleOperationInterpolators> &interpolators,
|
|
16
|
+
const std::shared_ptr<ViewStylesRepository> &viewStylesRepository);
|
|
17
|
+
|
|
18
|
+
protected:
|
|
19
|
+
std::optional<std::pair<StyleOperations, StyleOperations>> createInterpolationPair(
|
|
20
|
+
const StyleOperations &fromOperations,
|
|
21
|
+
const StyleOperations &toOperations) const override;
|
|
22
|
+
|
|
23
|
+
private:
|
|
24
|
+
void addConvertedOperations(
|
|
25
|
+
const std::shared_ptr<TransformOperation> &sourceOperation,
|
|
26
|
+
const std::shared_ptr<TransformOperation> &targetOperation,
|
|
27
|
+
StyleOperations &sourceResult,
|
|
28
|
+
StyleOperations &targetResult) const;
|
|
29
|
+
TransformOperations convertToTransformOperations(const StyleOperations &operations) const;
|
|
30
|
+
std::shared_ptr<TransformOperation> getDefaultOperationOfType(uint8_t type) const;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
} // namespace reanimated::css
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
#include <reanimated/CSS/interpolation/transforms/TransformOperationInterpolator.h>
|
|
2
|
+
#include <reanimated/CSS/interpolation/transforms/operations/matrix.h>
|
|
3
|
+
|
|
4
|
+
#include <deque>
|
|
5
|
+
#include <memory>
|
|
6
|
+
#include <utility>
|
|
7
|
+
|
|
8
|
+
namespace reanimated::css {
|
|
9
|
+
|
|
10
|
+
TransformMatrix3D matrixFromOperations3D(TransformOperations &operations) {
|
|
11
|
+
TransformMatrix3D result;
|
|
12
|
+
for (int i = static_cast<int>(operations.size()) - 1; i >= 0; i--) {
|
|
13
|
+
result *= static_cast<const TransformMatrix3D &>(*operations[i]->toMatrix(true));
|
|
14
|
+
}
|
|
15
|
+
return result;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
TransformMatrix2D matrixFromOperations2D(TransformOperations &operations) {
|
|
19
|
+
TransformMatrix2D result;
|
|
20
|
+
for (int i = static_cast<int>(operations.size()) - 1; i >= 0; i--) {
|
|
21
|
+
result *= static_cast<const TransformMatrix2D &>(*operations[i]->toMatrix(false));
|
|
22
|
+
}
|
|
23
|
+
return result;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
std::pair<TransformOperations, bool> flattenOperations(const TransformOperations &operations) {
|
|
27
|
+
std::deque<std::shared_ptr<TransformOperation>> unprocessedQueue(operations.begin(), operations.end());
|
|
28
|
+
TransformOperations result;
|
|
29
|
+
bool is3D = false;
|
|
30
|
+
|
|
31
|
+
while (!unprocessedQueue.empty()) {
|
|
32
|
+
const auto operation = unprocessedQueue.front();
|
|
33
|
+
unprocessedQueue.pop_front();
|
|
34
|
+
|
|
35
|
+
if (operation->type == static_cast<uint8_t>(TransformOp::Matrix)) {
|
|
36
|
+
const auto matrixOperation = std::static_pointer_cast<MatrixOperation>(operation);
|
|
37
|
+
if (std::holds_alternative<TransformOperations>(matrixOperation->value)) {
|
|
38
|
+
// If the current operation is a matrix created from other operations,
|
|
39
|
+
// add all of these operations at the beginning of the queue
|
|
40
|
+
const auto &nestedOps = std::get<TransformOperations>(matrixOperation->value);
|
|
41
|
+
unprocessedQueue.insert(unprocessedQueue.begin(), nestedOps.begin(), nestedOps.end());
|
|
42
|
+
continue;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (operation->is3D()) {
|
|
47
|
+
is3D = true;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
result.emplace_back(operation);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return {std::move(result), is3D};
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Simplifies the vector of operations by converting to matrices and multiplying
|
|
58
|
+
* transformations that can be converted. This reduces the number of operations
|
|
59
|
+
* in the resulting operations vector or returns a single matrix if all
|
|
60
|
+
* operations can be converted to a matrix.
|
|
61
|
+
*/
|
|
62
|
+
std::pair<MatrixOperationValue, bool> simplifyOperations(const TransformOperations &operations) {
|
|
63
|
+
const auto [flattenedOperations, is3D] = flattenOperations(operations);
|
|
64
|
+
|
|
65
|
+
TransformOperations result;
|
|
66
|
+
TransformOperations toSimplify;
|
|
67
|
+
result.reserve(operations.size());
|
|
68
|
+
toSimplify.reserve(operations.size());
|
|
69
|
+
|
|
70
|
+
// const auto simplify = [&]() {
|
|
71
|
+
// return is3D ? std::make_shared<MatrixOperation>(matrixFromOperations3D(toSimplify))
|
|
72
|
+
// : std::make_shared<MatrixOperation>(matrixFromOperations2D(toSimplify));
|
|
73
|
+
// };
|
|
74
|
+
//TODO
|
|
75
|
+
const auto simplify = [](TransformOperations &toSimplify,bool is3DValue) {
|
|
76
|
+
return is3DValue ? std::make_shared<MatrixOperation>(matrixFromOperations3D(toSimplify))
|
|
77
|
+
: std::make_shared<MatrixOperation>(matrixFromOperations2D(toSimplify));
|
|
78
|
+
};
|
|
79
|
+
for (const auto &operation : flattenedOperations) {
|
|
80
|
+
if (operation->shouldResolve()) {
|
|
81
|
+
if (toSimplify.size() > 0) {
|
|
82
|
+
result.emplace_back(simplify(toSimplify,is3D));
|
|
83
|
+
toSimplify.clear();
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// Keep operations that need to be resolved unchanged in the transform
|
|
87
|
+
// operations vector
|
|
88
|
+
result.emplace_back(operation);
|
|
89
|
+
} else {
|
|
90
|
+
toSimplify.emplace_back(operation);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// Result is empty only if there was not a single operation that needed to be
|
|
95
|
+
// resolved (all operations were added to the toSimplify vector)
|
|
96
|
+
if (result.empty()) {
|
|
97
|
+
return {simplify(toSimplify,is3D)->toMatrix(is3D), is3D};
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
result.emplace_back(simplify(toSimplify,is3D));
|
|
101
|
+
|
|
102
|
+
return {std::move(result), is3D};
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
MatrixOperation::MatrixOperation(MatrixOperationValue value)
|
|
106
|
+
: TransformOperation(TransformOp::Matrix), value(std::move(value)) {
|
|
107
|
+
// Initialize is3D_ based on the variant content
|
|
108
|
+
if (std::holds_alternative<TransformMatrix::Shared>(this->value)) {
|
|
109
|
+
const auto &matrix = std::get<TransformMatrix::Shared>(this->value);
|
|
110
|
+
is3D_ = matrix->getDimension() == MATRIX_3D_DIMENSION;
|
|
111
|
+
} else {
|
|
112
|
+
// If it contains TransformOperations, check if any operation is 3D
|
|
113
|
+
const auto &operations = std::get<TransformOperations>(this->value);
|
|
114
|
+
is3D_ = false;
|
|
115
|
+
for (const auto &operation : operations) {
|
|
116
|
+
if (operation->is3D()) {
|
|
117
|
+
is3D_ = true;
|
|
118
|
+
break;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
MatrixOperation::MatrixOperation(jsi::Runtime &rt, const jsi::Value &value)
|
|
125
|
+
: MatrixOperation([&]() -> TransformMatrix::Shared {
|
|
126
|
+
// Try 2D first, then 3D (will throw if neither works)
|
|
127
|
+
if (TransformMatrix2D::canConstruct(rt, value)) {
|
|
128
|
+
is3D_ = false;
|
|
129
|
+
return std::make_shared<const TransformMatrix2D>(rt, value);
|
|
130
|
+
}
|
|
131
|
+
is3D_ = true;
|
|
132
|
+
return std::make_shared<const TransformMatrix3D>(rt, value);
|
|
133
|
+
}()) {}
|
|
134
|
+
|
|
135
|
+
MatrixOperation::MatrixOperation(const folly::dynamic &value)
|
|
136
|
+
: MatrixOperation([&]() -> TransformMatrix::Shared {
|
|
137
|
+
// Try 2D first, then 3D (will throw if neither works)
|
|
138
|
+
if (TransformMatrix2D::canConstruct(value)) {
|
|
139
|
+
is3D_ = false;
|
|
140
|
+
return std::make_shared<const TransformMatrix2D>(value);
|
|
141
|
+
}
|
|
142
|
+
is3D_ = true;
|
|
143
|
+
return std::make_shared<const TransformMatrix3D>(value);
|
|
144
|
+
}()) {}
|
|
145
|
+
|
|
146
|
+
MatrixOperation::MatrixOperation(TransformMatrix2D matrix)
|
|
147
|
+
: TransformOperation(TransformOp::Matrix),
|
|
148
|
+
value(std::make_shared<const TransformMatrix2D>(std::move(matrix))),
|
|
149
|
+
is3D_(false) {}
|
|
150
|
+
|
|
151
|
+
MatrixOperation::MatrixOperation(TransformMatrix3D matrix)
|
|
152
|
+
: TransformOperation(TransformOp::Matrix),
|
|
153
|
+
value(std::make_shared<const TransformMatrix3D>(std::move(matrix))),
|
|
154
|
+
is3D_(true) {}
|
|
155
|
+
|
|
156
|
+
MatrixOperation::MatrixOperation(TransformOperations operations)
|
|
157
|
+
// Simplify operations to reduce the number of matrix
|
|
158
|
+
// multiplications during matrix keyframe interpolation
|
|
159
|
+
: TransformOperation(TransformOp::Matrix), value([&]() {
|
|
160
|
+
const auto &[value, is3D] = simplifyOperations(operations);
|
|
161
|
+
is3D_ = is3D;
|
|
162
|
+
return value;
|
|
163
|
+
}()) {}
|
|
164
|
+
|
|
165
|
+
bool MatrixOperation::is3D() const {
|
|
166
|
+
return is3D_;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
folly::dynamic MatrixOperation::valueToDynamic() const {
|
|
170
|
+
return getMatrixFromVariant()->toDynamic();
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
TransformMatrix::Shared MatrixOperation::toMatrix(const bool force3D) const {
|
|
174
|
+
const auto &storedMatrix = getMatrixFromVariant();
|
|
175
|
+
|
|
176
|
+
if (force3D && storedMatrix->getDimension() == MATRIX_2D_DIMENSION) {
|
|
177
|
+
return std::make_shared<const TransformMatrix3D>(
|
|
178
|
+
TransformMatrix3D::from2D(static_cast<const TransformMatrix2D &>(*storedMatrix)));
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
return storedMatrix;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
const TransformMatrix::Shared &MatrixOperation::getMatrixFromVariant() const {
|
|
185
|
+
if (!std::holds_alternative<TransformMatrix::Shared>(value)) {
|
|
186
|
+
throw std::runtime_error("[Reanimated] Cannot convert unprocessed transform operations to the matrix.");
|
|
187
|
+
}
|
|
188
|
+
return std::get<TransformMatrix::Shared>(value);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
bool MatrixOperation::areValuesEqual(const StyleOperation &other) const {
|
|
192
|
+
const auto &otherOperation = static_cast<const MatrixOperation &>(other);
|
|
193
|
+
|
|
194
|
+
// Quick check: if variants have different types, they're not equal
|
|
195
|
+
if (value.index() != otherOperation.value.index()) {
|
|
196
|
+
return false;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
// Both hold TransformOperations
|
|
200
|
+
if (std::holds_alternative<TransformOperations>(value)) {
|
|
201
|
+
return std::get<TransformOperations>(value) == std::get<TransformOperations>(otherOperation.value);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
// Both hold matrices
|
|
205
|
+
return *std::get<TransformMatrix::Shared>(value) == *std::get<TransformMatrix::Shared>(otherOperation.value);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
} // namespace reanimated::css
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include <reanimated/CSS/common/transforms/TransformMatrix2D.h>
|
|
4
|
+
#include <reanimated/CSS/common/transforms/TransformMatrix3D.h>
|
|
5
|
+
#include <reanimated/CSS/interpolation/transforms/TransformOperation.h>
|
|
6
|
+
|
|
7
|
+
#include <utility>
|
|
8
|
+
#include <variant>
|
|
9
|
+
|
|
10
|
+
namespace reanimated::css {
|
|
11
|
+
|
|
12
|
+
// MatrixOperationValue type for matrix operations
|
|
13
|
+
using MatrixOperationValue = std::variant<TransformMatrix::Shared, TransformOperations>;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Multiplies all operations in the vector to a single 3D matrix
|
|
17
|
+
* @param operations - the vector of operations that can be represented in 3D
|
|
18
|
+
*/
|
|
19
|
+
TransformMatrix3D matrixFromOperations3D(TransformOperations &operations);
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Multiplies all operations in the vector to a single 2D matrix
|
|
23
|
+
* @param operations - the vector of operations that can be represented in 2D
|
|
24
|
+
*/
|
|
25
|
+
TransformMatrix2D matrixFromOperations2D(TransformOperations &operations);
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* MatrixOperation does not inherit from TransformOperationBase because its value type
|
|
29
|
+
* is different from the other transform operations which use a CSSValue-derived type.
|
|
30
|
+
* Instead, it uses a variant of TransformMatrix::Shared and TransformOperations that
|
|
31
|
+
* doesn't have a value field.
|
|
32
|
+
*/
|
|
33
|
+
struct MatrixOperation final : public TransformOperation {
|
|
34
|
+
const MatrixOperationValue value;
|
|
35
|
+
|
|
36
|
+
explicit MatrixOperation(MatrixOperationValue value);
|
|
37
|
+
explicit MatrixOperation(jsi::Runtime &rt, const jsi::Value &value);
|
|
38
|
+
explicit MatrixOperation(const folly::dynamic &value);
|
|
39
|
+
explicit MatrixOperation(TransformMatrix2D matrix);
|
|
40
|
+
explicit MatrixOperation(TransformMatrix3D matrix);
|
|
41
|
+
explicit MatrixOperation(TransformOperations operations);
|
|
42
|
+
|
|
43
|
+
bool is3D() const override;
|
|
44
|
+
folly::dynamic valueToDynamic() const override;
|
|
45
|
+
TransformMatrix::Shared toMatrix(bool force3D) const override;
|
|
46
|
+
|
|
47
|
+
protected:
|
|
48
|
+
bool areValuesEqual(const StyleOperation &other) const override;
|
|
49
|
+
|
|
50
|
+
private:
|
|
51
|
+
bool is3D_;
|
|
52
|
+
|
|
53
|
+
const TransformMatrix::Shared &getMatrixFromVariant() const;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
} // namespace reanimated::css
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
#include <reanimated/CSS/common/transforms/TransformMatrix3D.h>
|
|
2
|
+
#include <reanimated/CSS/interpolation/transforms/operations/perspective.h>
|
|
3
|
+
|
|
4
|
+
#include <algorithm>
|
|
5
|
+
#include <cmath>
|
|
6
|
+
#include <memory>
|
|
7
|
+
|
|
8
|
+
namespace reanimated::css {
|
|
9
|
+
|
|
10
|
+
double sanitizePerspectiveValue(double value) {
|
|
11
|
+
if (value < 0) {
|
|
12
|
+
// Round value between -1 and 0 to -1
|
|
13
|
+
return std::min(value, -1.0);
|
|
14
|
+
}
|
|
15
|
+
// Round value between 0 and 1 to 1
|
|
16
|
+
return std::max(value, 1.0);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
PerspectiveOperation::PerspectiveOperation(const double value)
|
|
20
|
+
: TransformOperationBase<TransformOp::Perspective, CSSDouble>(CSSDouble(sanitizePerspectiveValue(value))) {}
|
|
21
|
+
|
|
22
|
+
bool PerspectiveOperation::is3D() const {
|
|
23
|
+
return true;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
folly::dynamic PerspectiveOperation::valueToDynamic() const {
|
|
27
|
+
if (std::isinf(value.value)) {
|
|
28
|
+
return folly::dynamic();
|
|
29
|
+
}
|
|
30
|
+
return value.toDynamic();
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
TransformMatrix::Shared PerspectiveOperation::toMatrix(bool /* force3D */) const {
|
|
34
|
+
if (!cachedMatrix_) {
|
|
35
|
+
// Perspective is a 3D operation
|
|
36
|
+
cachedMatrix_ =
|
|
37
|
+
std::make_shared<const TransformMatrix3D>(TransformMatrix3D::create<TransformOp::Perspective>(value.value));
|
|
38
|
+
}
|
|
39
|
+
return cachedMatrix_;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
} // namespace reanimated::css
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include <reanimated/CSS/common/values/CSSNumber.h>
|
|
4
|
+
#include <reanimated/CSS/interpolation/transforms/TransformOperation.h>
|
|
5
|
+
|
|
6
|
+
#include <memory>
|
|
7
|
+
|
|
8
|
+
namespace reanimated::css {
|
|
9
|
+
|
|
10
|
+
struct PerspectiveOperation final : public TransformOperationBase<TransformOp::Perspective, CSSDouble> {
|
|
11
|
+
using TransformOperationBase<TransformOp::Perspective, CSSDouble>::TransformOperationBase;
|
|
12
|
+
|
|
13
|
+
explicit PerspectiveOperation(double value);
|
|
14
|
+
|
|
15
|
+
bool is3D() const override;
|
|
16
|
+
folly::dynamic valueToDynamic() const override;
|
|
17
|
+
TransformMatrix::Shared toMatrix(bool /* force3D */) const override;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
} // namespace reanimated::css
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
#include <reanimated/CSS/common/transforms/TransformMatrix3D.h>
|
|
2
|
+
#include <reanimated/CSS/interpolation/transforms/operations/rotate.h>
|
|
3
|
+
|
|
4
|
+
#include <memory>
|
|
5
|
+
#include <string>
|
|
6
|
+
|
|
7
|
+
namespace reanimated::css {
|
|
8
|
+
|
|
9
|
+
template <TransformOp TOperation>
|
|
10
|
+
RotateOperationBase2D<TOperation>::RotateOperationBase2D(const std::string &value)
|
|
11
|
+
: TransformOperationBase<TOperation, CSSAngle>(CSSAngle(value)) {}
|
|
12
|
+
|
|
13
|
+
template <TransformOp TOperation>
|
|
14
|
+
RotateOperationBase3D<TOperation>::RotateOperationBase3D(const std::string &value)
|
|
15
|
+
: TransformOperationBase<TOperation, CSSAngle>(CSSAngle(value)) {}
|
|
16
|
+
|
|
17
|
+
template <TransformOp TOperation>
|
|
18
|
+
bool RotateOperationBase3D<TOperation>::is3D() const {
|
|
19
|
+
return true;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
template <TransformOp TOperation>
|
|
23
|
+
TransformMatrix::Shared RotateOperationBase3D<TOperation>::toMatrix(bool /* force3D */) const {
|
|
24
|
+
return std::make_shared<const TransformMatrix3D>(TransformMatrix3D::create<TOperation>(this->value.value));
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
bool RotateZOperation::canConvertTo(TransformOp type) const {
|
|
28
|
+
return type == TransformOp::Rotate;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
TransformOperations RotateZOperation::convertTo(TransformOp type) const {
|
|
32
|
+
assertCanConvertTo(type);
|
|
33
|
+
return {std::make_shared<RotateOperation>(value)};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
template struct RotateOperationBase2D<TransformOp::Rotate>;
|
|
37
|
+
template struct RotateOperationBase2D<TransformOp::RotateZ>;
|
|
38
|
+
template struct RotateOperationBase3D<TransformOp::RotateX>;
|
|
39
|
+
template struct RotateOperationBase3D<TransformOp::RotateY>;
|
|
40
|
+
|
|
41
|
+
} // namespace reanimated::css
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include <reanimated/CSS/common/transforms/TransformMatrix.h>
|
|
4
|
+
#include <reanimated/CSS/common/values/CSSAngle.h>
|
|
5
|
+
#include <reanimated/CSS/interpolation/transforms/TransformOperation.h>
|
|
6
|
+
|
|
7
|
+
#include <string>
|
|
8
|
+
|
|
9
|
+
namespace reanimated::css {
|
|
10
|
+
|
|
11
|
+
template <TransformOp TOperation>
|
|
12
|
+
struct RotateOperationBase2D : public TransformOperationBase<TOperation, CSSAngle> {
|
|
13
|
+
using TransformOperationBase<TOperation, CSSAngle>::TransformOperationBase;
|
|
14
|
+
|
|
15
|
+
explicit RotateOperationBase2D(const std::string &value);
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
template <TransformOp TOperation>
|
|
19
|
+
struct RotateOperationBase3D : public TransformOperationBase<TOperation, CSSAngle> {
|
|
20
|
+
using TransformOperationBase<TOperation, CSSAngle>::TransformOperationBase;
|
|
21
|
+
|
|
22
|
+
explicit RotateOperationBase3D(const std::string &value);
|
|
23
|
+
|
|
24
|
+
bool is3D() const override;
|
|
25
|
+
TransformMatrix::Shared toMatrix(bool /* force3D */) const override;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
using RotateOperation = RotateOperationBase2D<TransformOp::Rotate>;
|
|
29
|
+
using RotateXOperation = RotateOperationBase3D<TransformOp::RotateX>;
|
|
30
|
+
using RotateYOperation = RotateOperationBase3D<TransformOp::RotateY>;
|
|
31
|
+
|
|
32
|
+
struct RotateZOperation final : public RotateOperationBase2D<TransformOp::RotateZ> {
|
|
33
|
+
using RotateOperationBase2D<TransformOp::RotateZ>::RotateOperationBase2D;
|
|
34
|
+
|
|
35
|
+
bool canConvertTo(TransformOp type) const override;
|
|
36
|
+
TransformOperations convertTo(TransformOp type) const override;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
} // namespace reanimated::css
|