react-native-reanimated 2.3.0-alpha.3 → 2.3.0-beta.4
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/Common/cpp/LayoutAnimations/LayoutAnimationsProxy.cpp +15 -8
- package/Common/cpp/NativeModules/NativeReanimatedModule.cpp +176 -154
- package/Common/cpp/NativeModules/NativeReanimatedModuleSpec.cpp +49 -33
- package/Common/cpp/Registries/EventHandlerRegistry.cpp +14 -7
- package/Common/cpp/Registries/MapperRegistry.cpp +24 -20
- package/Common/cpp/Registries/WorkletsCache.cpp +19 -9
- package/Common/cpp/SharedItems/FrozenObject.cpp +17 -8
- package/Common/cpp/SharedItems/MutableValue.cpp +38 -25
- package/Common/cpp/SharedItems/MutableValueSetterProxy.cpp +11 -7
- package/Common/cpp/SharedItems/RemoteObject.cpp +9 -5
- package/Common/cpp/SharedItems/ShareableValue.cpp +211 -160
- package/Common/cpp/Tools/FeaturesConfig.cpp +5 -0
- package/Common/cpp/Tools/JSIStoreValueUser.cpp +25 -6
- package/Common/cpp/Tools/Mapper.cpp +30 -30
- package/Common/cpp/Tools/RuntimeDecorator.cpp +124 -86
- package/Common/cpp/Tools/Scheduler.cpp +6 -5
- package/Common/cpp/Tools/WorkletEventHandler.cpp +4 -2
- package/Common/cpp/headers/LayoutAnimations/LayoutAnimationsProxy.h +12 -11
- package/Common/cpp/headers/NativeModules/NativeReanimatedModule.h +50 -31
- package/Common/cpp/headers/NativeModules/NativeReanimatedModuleSpec.h +34 -16
- package/Common/cpp/headers/Registries/EventHandlerRegistry.h +15 -8
- package/Common/cpp/headers/Registries/MapperRegistry.h +5 -4
- package/Common/cpp/headers/Registries/WorkletsCache.h +9 -7
- package/Common/cpp/headers/SharedItems/FrozenObject.h +19 -11
- package/Common/cpp/headers/SharedItems/HostFunctionHandler.h +8 -4
- package/Common/cpp/headers/SharedItems/MutableValue.h +23 -12
- package/Common/cpp/headers/SharedItems/MutableValueSetterProxy.h +12 -7
- package/Common/cpp/headers/SharedItems/RemoteObject.h +19 -8
- package/Common/cpp/headers/SharedItems/RuntimeManager.h +26 -25
- package/Common/cpp/headers/SharedItems/ShareableValue.h +32 -27
- package/Common/cpp/headers/SharedItems/SharedParent.h +10 -7
- package/Common/cpp/headers/SharedItems/ValueWrapper.h +95 -72
- package/Common/cpp/headers/SpecTools/ErrorHandler.h +18 -19
- package/Common/cpp/headers/Tools/FeaturesConfig.h +19 -0
- package/Common/cpp/headers/Tools/JSIStoreValueUser.h +13 -16
- package/Common/cpp/headers/Tools/Mapper.h +19 -16
- package/Common/cpp/headers/Tools/PlatformDepMethodsHolder.h +17 -7
- package/Common/cpp/headers/Tools/ReanimatedHiddenHeaders.h +7 -11
- package/Common/cpp/headers/Tools/RuntimeDecorator.h +36 -27
- package/Common/cpp/headers/Tools/Scheduler.h +30 -35
- package/Common/cpp/headers/Tools/WorkletEventHandler.h +11 -8
- package/Common/cpp/hidden_headers/Logger.h +14 -14
- package/Common/cpp/hidden_headers/LoggerInterface.h +8 -9
- package/Common/cpp/hidden_headers/SpeedChecker.h +7 -8
- package/README.md +1 -1
- package/RNReanimated.podspec +24 -6
- package/android/build.gradle +38 -29
- package/android/react-native-reanimated-63-hermes.aar +0 -0
- package/android/react-native-reanimated-63-jsc.aar +0 -0
- package/android/react-native-reanimated-64-hermes.aar +0 -0
- package/android/react-native-reanimated-64-jsc.aar +0 -0
- package/android/react-native-reanimated-65-hermes.aar +0 -0
- package/android/react-native-reanimated-65-jsc.aar +0 -0
- package/android/react-native-reanimated-66-hermes.aar +0 -0
- package/android/react-native-reanimated-66-jsc.aar +0 -0
- package/android/react-native-reanimated-67-hermes.aar +0 -0
- package/android/react-native-reanimated-67-jsc.aar +0 -0
- package/ios/LayoutReanimation/REAAnimationsManager.h +10 -8
- package/ios/LayoutReanimation/REAAnimationsManager.m +91 -87
- package/ios/LayoutReanimation/REASnapshot.h +2 -2
- package/ios/LayoutReanimation/REASnapshot.m +8 -7
- package/ios/LayoutReanimation/REAUIManager.h +4 -4
- package/ios/LayoutReanimation/REAUIManager.mm +116 -70
- package/ios/Nodes/REAAlwaysNode.m +14 -15
- package/ios/Nodes/REABezierNode.m +8 -7
- package/ios/Nodes/REABlockNode.m +1 -1
- package/ios/Nodes/REACallFuncNode.h +0 -1
- package/ios/Nodes/REACallFuncNode.m +10 -8
- package/ios/Nodes/REAClockNodes.m +22 -20
- package/ios/Nodes/REAConcatNode.h +0 -1
- package/ios/Nodes/REAConcatNode.m +2 -2
- package/ios/Nodes/REACondNode.m +7 -5
- package/ios/Nodes/READebugNode.m +5 -4
- package/ios/Nodes/REAEventNode.m +1 -1
- package/ios/Nodes/REAFunctionNode.h +0 -1
- package/ios/Nodes/REAFunctionNode.m +2 -2
- package/ios/Nodes/REAJSCallNode.m +4 -5
- package/ios/Nodes/REANode.h +3 -4
- package/ios/Nodes/REANode.m +9 -11
- package/ios/Nodes/REAOperatorNode.m +68 -67
- package/ios/Nodes/REAParamNode.h +1 -3
- package/ios/Nodes/REAParamNode.m +15 -17
- package/ios/Nodes/REAPropsNode.h +1 -3
- package/ios/Nodes/REAPropsNode.m +19 -22
- package/ios/Nodes/REASetNode.h +0 -1
- package/ios/Nodes/REASetNode.m +7 -5
- package/ios/Nodes/REAStyleNode.h +0 -1
- package/ios/Nodes/REAStyleNode.m +2 -4
- package/ios/Nodes/REATransformNode.h +0 -1
- package/ios/Nodes/REATransformNode.m +3 -5
- package/ios/Nodes/REAValueNode.m +5 -7
- package/ios/REAEventDispatcher.m +4 -4
- package/ios/REAModule.h +0 -2
- package/ios/REAModule.m +29 -38
- package/ios/REANodesManager.h +11 -19
- package/ios/REANodesManager.m +106 -130
- package/ios/REAUtils.h +5 -3
- package/ios/RNGestureHandlerStateManager.h +5 -0
- package/ios/Transitioning/RCTConvert+REATransition.m +45 -29
- package/ios/Transitioning/REAAllTransitions.h +2 -2
- package/ios/Transitioning/REAAllTransitions.m +14 -25
- package/ios/Transitioning/REATransition.h +8 -7
- package/ios/Transitioning/REATransition.m +19 -16
- package/ios/Transitioning/REATransitionAnimation.h +1 -1
- package/ios/Transitioning/REATransitionAnimation.m +2 -3
- package/ios/Transitioning/REATransitionManager.m +3 -3
- package/ios/native/NativeMethods.h +20 -5
- package/ios/native/NativeMethods.mm +14 -6
- package/ios/native/NativeProxy.h +4 -2
- package/ios/native/NativeProxy.mm +84 -63
- package/ios/native/REAIOSErrorHandler.h +13 -10
- package/ios/native/REAIOSErrorHandler.mm +19 -15
- package/ios/native/REAIOSLogger.h +8 -8
- package/ios/native/REAIOSLogger.mm +10 -6
- package/ios/native/REAIOSScheduler.h +5 -5
- package/ios/native/REAIOSScheduler.mm +17 -10
- package/ios/native/REAInitializer.h +5 -7
- package/ios/native/REAInitializer.mm +43 -31
- package/ios/native/UIResponder+Reanimated.mm +2 -2
- package/lib/Animated.js +9 -1
- package/lib/ConfigHelper.js +121 -138
- package/lib/ReanimatedEventEmitter.js +0 -1
- package/lib/ReanimatedModule.js +0 -1
- package/lib/ReanimatedModule.macos.js +0 -1
- package/lib/ReanimatedModule.native.js +5 -6
- package/lib/ReanimatedModule.windows.js +0 -1
- package/lib/ReanimatedModuleCompat.js +64 -35
- package/lib/createAnimatedComponent.js +468 -487
- package/lib/index.js +9 -1
- package/lib/reanimated2/NativeMethods.js +7 -12
- package/lib/reanimated2/NativeReanimated/NativeReanimated.js +37 -0
- package/lib/reanimated2/NativeReanimated/index.js +15 -0
- package/lib/reanimated2/PropAdapters.js +0 -1
- package/lib/reanimated2/UpdateProps.js +6 -7
- package/lib/reanimated2/ViewDescriptorsSet.js +4 -4
- package/lib/reanimated2/WorkletEventHandler.js +15 -13
- package/lib/reanimated2/animation/delay.js +8 -2
- package/lib/reanimated2/animation/spring.js +2 -0
- package/lib/reanimated2/animation/styleAnimation.js +7 -3
- package/lib/reanimated2/animation/util.js +25 -2
- package/lib/reanimated2/core.js +41 -17
- package/lib/reanimated2/globals.d.ts +21 -1
- package/lib/reanimated2/hook/useAnimatedRef.js +1 -1
- package/lib/reanimated2/hook/useAnimatedStyle.js +3 -3
- package/lib/reanimated2/index.js +1 -0
- package/lib/reanimated2/interpolation.js +95 -87
- package/lib/reanimated2/js-reanimated/JSReanimated.js +13 -10
- package/lib/reanimated2/js-reanimated/Mapper.js +4 -3
- package/lib/reanimated2/js-reanimated/MapperRegistry.js +3 -6
- package/lib/reanimated2/js-reanimated/MutableValue.js +0 -2
- package/lib/reanimated2/js-reanimated/index.js +10 -8
- package/lib/reanimated2/layoutReanimation/LayoutAnimationRepository.js +33 -2
- package/lib/reanimated2/layoutReanimation/animationBuilder/BaseAnimationBuilder.js +27 -124
- package/lib/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.js +125 -0
- package/lib/reanimated2/layoutReanimation/animationBuilder/index.js +1 -2
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Bounce.js +115 -45
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Default.js +7 -2
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Fade.js +21 -21
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Flip.js +25 -25
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js +19 -17
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.js +5 -5
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Roll.js +9 -9
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Rotate.js +17 -17
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Slide.js +19 -19
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Stretch.js +9 -9
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Zoom.js +33 -33
- package/lib/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.js +78 -0
- package/lib/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.js +128 -0
- package/lib/reanimated2/layoutReanimation/defaultTransitions/FadingTransition.js +37 -0
- package/lib/reanimated2/layoutReanimation/defaultTransitions/JumpingTransition.js +41 -0
- package/lib/reanimated2/layoutReanimation/defaultTransitions/LinearTransition.js +34 -0
- package/lib/reanimated2/layoutReanimation/defaultTransitions/SequencedTransition.js +46 -0
- package/lib/reanimated2/layoutReanimation/defaultTransitions/index.js +6 -0
- package/lib/reanimated2/layoutReanimation/index.js +1 -0
- package/lib/reanimated2/mock.js +3 -1
- package/lib/reanimated2/utils.js +9 -0
- package/lib/setAndForwardRef.js +14 -48
- package/libSo/fbjni/jni/arm64-v8a/libfbjni.so +0 -0
- package/libSo/fbjni/jni/armeabi-v7a/libfbjni.so +0 -0
- package/libSo/fbjni/jni/x86/libfbjni.so +0 -0
- package/libSo/fbjni/jni/x86_64/libfbjni.so +0 -0
- package/mock.js +1 -1
- package/package.json +28 -17
- package/plugin.js +220 -39
- package/react-native-reanimated.d.ts +542 -547
- package/src/Animated.js +9 -1
- package/src/{ConfigHelper.js → ConfigHelper.ts} +15 -7
- package/src/{ReanimatedEventEmitter.js → ReanimatedEventEmitter.ts} +0 -0
- package/src/{ReanimatedModule.js → ReanimatedModule.macos.ts} +0 -0
- package/src/{ReanimatedModule.native.js → ReanimatedModule.native.ts} +0 -0
- package/src/{ReanimatedModule.macos.js → ReanimatedModule.ts} +0 -0
- package/src/{ReanimatedModule.windows.js → ReanimatedModule.windows.ts} +0 -0
- package/src/ReanimatedModuleCompat.ts +51 -0
- package/src/{createAnimatedComponent.js → createAnimatedComponent.tsx} +285 -126
- package/src/reanimated2/NativeMethods.ts +34 -13
- package/src/reanimated2/NativeReanimated/NativeReanimated.ts +72 -0
- package/src/reanimated2/NativeReanimated/index.ts +18 -0
- package/src/reanimated2/PropAdapters.ts +0 -1
- package/src/reanimated2/UpdateProps.ts +31 -15
- package/src/reanimated2/ViewDescriptorsSet.ts +15 -12
- package/src/reanimated2/WorkletEventHandler.ts +41 -23
- package/src/reanimated2/animation/commonTypes.ts +4 -4
- package/src/reanimated2/animation/decay.ts +2 -2
- package/src/reanimated2/animation/delay.ts +11 -5
- package/src/reanimated2/animation/index.ts +7 -7
- package/src/reanimated2/animation/repeat.ts +4 -4
- package/src/reanimated2/animation/sequence.ts +2 -2
- package/src/reanimated2/animation/spring.ts +6 -5
- package/src/reanimated2/animation/styleAnimation.ts +27 -15
- package/src/reanimated2/animation/timing.ts +5 -5
- package/src/reanimated2/animation/util.ts +47 -8
- package/src/reanimated2/commonTypes.ts +3 -0
- package/src/reanimated2/core.ts +80 -34
- package/src/reanimated2/globals.d.ts +21 -1
- package/src/reanimated2/hook/useAnimatedGestureHandler.ts +1 -1
- package/src/reanimated2/hook/useAnimatedRef.ts +13 -15
- package/src/reanimated2/hook/useAnimatedScrollHandler.ts +3 -3
- package/src/reanimated2/hook/useAnimatedStyle.ts +7 -7
- package/src/reanimated2/hook/utils.ts +4 -3
- package/src/reanimated2/index.ts +1 -0
- package/src/reanimated2/interpolation.ts +170 -103
- package/src/reanimated2/js-reanimated/JSReanimated.ts +37 -23
- package/src/reanimated2/js-reanimated/Mapper.ts +22 -9
- package/src/reanimated2/js-reanimated/MapperRegistry.ts +22 -19
- package/src/reanimated2/js-reanimated/MutableValue.ts +11 -11
- package/src/reanimated2/js-reanimated/index.ts +31 -14
- package/src/reanimated2/layoutReanimation/LayoutAnimationRepository.ts +75 -0
- package/src/reanimated2/layoutReanimation/animationBuilder/BaseAnimationBuilder.ts +29 -159
- package/src/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.ts +169 -0
- package/src/reanimated2/layoutReanimation/animationBuilder/Keyframe.ts +2 -2
- package/src/reanimated2/layoutReanimation/animationBuilder/commonTypes.ts +3 -9
- package/src/reanimated2/layoutReanimation/animationBuilder/index.ts +1 -5
- package/src/reanimated2/layoutReanimation/defaultAnimations/Bounce.ts +162 -82
- package/src/reanimated2/layoutReanimation/defaultAnimations/Default.ts +7 -2
- package/src/reanimated2/layoutReanimation/defaultAnimations/Fade.ts +32 -32
- package/src/reanimated2/layoutReanimation/defaultAnimations/Flip.ts +38 -38
- package/src/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.ts +34 -32
- package/src/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.ts +8 -8
- package/src/reanimated2/layoutReanimation/defaultAnimations/Roll.ts +14 -14
- package/src/reanimated2/layoutReanimation/defaultAnimations/Rotate.ts +26 -26
- package/src/reanimated2/layoutReanimation/defaultAnimations/Slide.ts +28 -28
- package/src/reanimated2/layoutReanimation/defaultAnimations/Stretch.ts +14 -14
- package/src/reanimated2/layoutReanimation/defaultAnimations/Zoom.ts +50 -50
- package/src/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.ts +104 -0
- package/src/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.ts +213 -0
- package/src/reanimated2/layoutReanimation/defaultTransitions/FadingTransition.ts +60 -0
- package/src/reanimated2/layoutReanimation/defaultTransitions/JumpingTransition.ts +58 -0
- package/src/reanimated2/layoutReanimation/defaultTransitions/LinearTransition.ts +41 -0
- package/src/reanimated2/layoutReanimation/defaultTransitions/SequencedTransition.ts +78 -0
- package/src/reanimated2/layoutReanimation/defaultTransitions/index.ts +6 -0
- package/src/reanimated2/layoutReanimation/index.ts +1 -0
- package/src/reanimated2/mock.ts +3 -1
- package/src/reanimated2/utils.ts +21 -0
- package/src/{setAndForwardRef.js → setAndForwardRef.ts} +12 -2
- package/android/react-native-reanimated-62-hermes.aar +0 -0
- package/android/react-native-reanimated-62-jsc.aar +0 -0
- package/lib/reanimated2/NativeReanimated.js +0 -48
- package/lib/reanimated2/layoutReanimation/animationBuilder/BaseBounceAnimationBuilder.js +0 -55
- package/lib/reanimated2/layoutReanimation/animationBuilder/LayoutAnimationBuilder.js +0 -165
- package/src/ReanimatedModuleCompat.js +0 -37
- package/src/reanimated2/NativeReanimated.ts +0 -70
- package/src/reanimated2/layoutReanimation/LayoutAnimationRepository.tsx +0 -41
- package/src/reanimated2/layoutReanimation/animationBuilder/BaseBounceAnimationBuilder.ts +0 -82
- package/src/reanimated2/layoutReanimation/animationBuilder/LayoutAnimationBuilder.ts +0 -217
|
@@ -1,119 +1,127 @@
|
|
|
1
|
-
//
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
function
|
|
1
|
+
// @ts-ignore JS file
|
|
2
|
+
import interpolateNode from '../reanimated1/derived/interpolate';
|
|
3
|
+
export var Extrapolation;
|
|
4
|
+
(function (Extrapolation) {
|
|
5
|
+
Extrapolation["IDENTITY"] = "identity";
|
|
6
|
+
Extrapolation["CLAMP"] = "clamp";
|
|
7
|
+
Extrapolation["EXTEND"] = "extend";
|
|
8
|
+
})(Extrapolation || (Extrapolation = {}));
|
|
9
|
+
function isNode(x) {
|
|
10
|
+
'worklet';
|
|
11
|
+
return x.__nodeId !== undefined;
|
|
12
|
+
}
|
|
13
|
+
function getVal(type, coef, val, leftEdgeOutput, rightEdgeOutput, x) {
|
|
5
14
|
'worklet';
|
|
6
|
-
const { type, coef, val, ll, rr, x } = config;
|
|
7
15
|
switch (type) {
|
|
8
|
-
case
|
|
16
|
+
case Extrapolation.IDENTITY:
|
|
9
17
|
return x;
|
|
10
|
-
case
|
|
11
|
-
if (coef * val < coef *
|
|
12
|
-
return
|
|
18
|
+
case Extrapolation.CLAMP:
|
|
19
|
+
if (coef * val < coef * leftEdgeOutput) {
|
|
20
|
+
return leftEdgeOutput;
|
|
13
21
|
}
|
|
14
|
-
return
|
|
15
|
-
case
|
|
22
|
+
return rightEdgeOutput;
|
|
23
|
+
case Extrapolation.EXTEND:
|
|
16
24
|
default:
|
|
17
25
|
return val;
|
|
18
26
|
}
|
|
19
27
|
}
|
|
20
28
|
function isExtrapolate(value) {
|
|
21
29
|
'worklet';
|
|
22
|
-
return (value ===
|
|
23
|
-
value ===
|
|
24
|
-
value ===
|
|
30
|
+
return (value === Extrapolation.EXTEND ||
|
|
31
|
+
value === Extrapolation.CLAMP ||
|
|
32
|
+
value === Extrapolation.IDENTITY);
|
|
25
33
|
}
|
|
34
|
+
// validates extrapolations type
|
|
35
|
+
// if type is correct, converts it to ExtrapolationConfig
|
|
26
36
|
function validateType(type) {
|
|
27
37
|
'worklet';
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
${extrapolate}: 'clamp',
|
|
36
|
-
})`;
|
|
37
|
-
type = type !== null && type !== void 0 ? type : 'extend';
|
|
38
|
-
// eslint-disable-next-line no-prototype-builtins
|
|
39
|
-
const hasExtrapolateLeft = type.hasOwnProperty('extrapolateLeft');
|
|
40
|
-
// eslint-disable-next-line no-prototype-builtins
|
|
41
|
-
const hasExtrapolateRight = type.hasOwnProperty('extrapolateRight');
|
|
42
|
-
if (typeof type === 'object' &&
|
|
43
|
-
((Object.keys(type).length === 2 &&
|
|
44
|
-
!(hasExtrapolateLeft && hasExtrapolateRight)) ||
|
|
45
|
-
(Object.keys(type).length === 1 &&
|
|
46
|
-
!(hasExtrapolateLeft || hasExtrapolateRight)) ||
|
|
47
|
-
Object.keys(type).length > 2)) {
|
|
48
|
-
throw new Error(EXTRAPOLATE_ERROR_MSG);
|
|
38
|
+
// initialize extrapolationConfig with default extrapolation
|
|
39
|
+
const extrapolationConfig = {
|
|
40
|
+
extrapolateLeft: Extrapolation.EXTEND,
|
|
41
|
+
extrapolateRight: Extrapolation.EXTEND,
|
|
42
|
+
};
|
|
43
|
+
if (!type) {
|
|
44
|
+
return extrapolationConfig;
|
|
49
45
|
}
|
|
50
|
-
if (typeof type === '
|
|
51
|
-
if (
|
|
52
|
-
throw new Error(
|
|
53
|
-
|
|
54
|
-
if (hasExtrapolateRight && !isExtrapolate(type.extrapolateRight)) {
|
|
55
|
-
throw new Error(EXTRAPOLATE_ERROR('extrapolateRight'));
|
|
46
|
+
if (typeof type === 'string') {
|
|
47
|
+
if (!isExtrapolate(type)) {
|
|
48
|
+
throw new Error(`Reanimated: not supported value for "interpolate" \nSupported values: ["extend", "clamp", "identity", Extrapolatation.CLAMP, Extrapolatation.EXTEND, Extrapolatation.IDENTITY]\n Valid example:
|
|
49
|
+
interpolate(value, [inputRange], [outputRange], "clamp")`);
|
|
56
50
|
}
|
|
51
|
+
extrapolationConfig.extrapolateLeft = type;
|
|
52
|
+
extrapolationConfig.extrapolateRight = type;
|
|
53
|
+
return extrapolationConfig;
|
|
57
54
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
55
|
+
// otherwise type is extrapolation config object
|
|
56
|
+
if ((type.extrapolateLeft && !isExtrapolate(type.extrapolateLeft)) ||
|
|
57
|
+
(type.extrapolateRight && !isExtrapolate(type.extrapolateRight))) {
|
|
58
|
+
throw new Error(`Reanimated: not supported value for "interpolate" \nSupported values: ["extend", "clamp", "identity", Extrapolatation.CLAMP, Extrapolatation.EXTEND, Extrapolatation.IDENTITY]\n Valid example:
|
|
59
|
+
interpolate(value, [inputRange], [outputRange], {
|
|
60
|
+
extrapolateLeft: Extrapolation.CLAMP,
|
|
61
|
+
extrapolateRight: Extrapolation.IDENTITY
|
|
62
|
+
}})`);
|
|
61
63
|
}
|
|
64
|
+
Object.assign(extrapolationConfig, type);
|
|
65
|
+
return extrapolationConfig;
|
|
62
66
|
}
|
|
63
|
-
|
|
64
|
-
// e.g. function interpolate(x, input, output, type = Extrapolate.CLAMP)
|
|
65
|
-
function internalInterpolate(x, l, r, ll, rr, type) {
|
|
67
|
+
function internalInterpolate(x, narrowedInput, extrapolationConfig) {
|
|
66
68
|
'worklet';
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
const
|
|
71
|
-
const
|
|
72
|
-
const
|
|
73
|
-
if (
|
|
74
|
-
|
|
75
|
-
}
|
|
76
|
-
if (typeof type === 'object') {
|
|
77
|
-
if (coef * val < coef * ll) {
|
|
78
|
-
return getVal(Object.assign(config, { type: type.extrapolateLeft }));
|
|
79
|
-
}
|
|
80
|
-
else if (coef * val > coef * ll) {
|
|
81
|
-
return getVal(Object.assign(config, { type: type.extrapolateRight }));
|
|
82
|
-
}
|
|
69
|
+
const { leftEdgeInput, rightEdgeInput, leftEdgeOutput, rightEdgeOutput, } = narrowedInput;
|
|
70
|
+
if (rightEdgeInput - leftEdgeInput === 0)
|
|
71
|
+
return leftEdgeOutput;
|
|
72
|
+
const progress = (x - leftEdgeInput) / (rightEdgeInput - leftEdgeInput);
|
|
73
|
+
const val = leftEdgeOutput + progress * (rightEdgeOutput - leftEdgeOutput);
|
|
74
|
+
const coef = rightEdgeOutput >= leftEdgeOutput ? 1 : -1;
|
|
75
|
+
if (coef * val < coef * leftEdgeOutput) {
|
|
76
|
+
return getVal(extrapolationConfig.extrapolateLeft, coef, val, leftEdgeOutput, rightEdgeOutput, x);
|
|
83
77
|
}
|
|
84
|
-
if (coef * val
|
|
85
|
-
return getVal(
|
|
78
|
+
else if (coef * val > coef * rightEdgeOutput) {
|
|
79
|
+
return getVal(extrapolationConfig.extrapolateRight, coef, val, leftEdgeOutput, rightEdgeOutput, x);
|
|
86
80
|
}
|
|
87
81
|
return val;
|
|
88
82
|
}
|
|
83
|
+
// TODO: support default values in worklets:
|
|
84
|
+
// e.g. function interpolate(x, input, output, type = Extrapolatation.CLAMP)
|
|
89
85
|
export function interpolate(x, input, output, type) {
|
|
90
86
|
'worklet';
|
|
91
|
-
if (
|
|
87
|
+
if (input.length < 2 || output.length < 2) {
|
|
88
|
+
throw Error('Interpolation input and output should contain at least two values.');
|
|
89
|
+
}
|
|
90
|
+
const extrapolationConfig = validateType(type);
|
|
91
|
+
if (isNode(x)) {
|
|
92
92
|
console.warn(`interpolate() was renamed to interpolateNode() in Reanimated 2. Please use interpolateNode() instead`);
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
93
|
+
return interpolateNode(x, {
|
|
94
|
+
inputRange: input,
|
|
95
|
+
outputRange: output,
|
|
96
|
+
extrapolateLeft: extrapolationConfig.extrapolateLeft,
|
|
97
|
+
extrapolateRight: extrapolationConfig.extrapolateRight,
|
|
98
|
+
});
|
|
96
99
|
}
|
|
97
100
|
const length = input.length;
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
101
|
+
const narrowedInput = {
|
|
102
|
+
leftEdgeInput: input[0],
|
|
103
|
+
rightEdgeInput: input[1],
|
|
104
|
+
leftEdgeOutput: output[0],
|
|
105
|
+
rightEdgeOutput: output[1],
|
|
106
|
+
};
|
|
107
|
+
if (length > 2) {
|
|
108
|
+
if (x > input[length - 1]) {
|
|
109
|
+
narrowedInput.leftEdgeInput = input[length - 2];
|
|
110
|
+
narrowedInput.rightEdgeInput = input[length - 1];
|
|
111
|
+
narrowedInput.leftEdgeOutput = output[length - 2];
|
|
112
|
+
narrowedInput.rightEdgeOutput = output[length - 1];
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
for (let i = 1; i < length; ++i) {
|
|
116
|
+
if (x <= input[i]) {
|
|
117
|
+
narrowedInput.leftEdgeInput = input[i - 1];
|
|
118
|
+
narrowedInput.rightEdgeInput = input[i];
|
|
119
|
+
narrowedInput.leftEdgeOutput = output[i - 1];
|
|
120
|
+
narrowedInput.rightEdgeOutput = output[i];
|
|
121
|
+
break;
|
|
122
|
+
}
|
|
115
123
|
}
|
|
116
124
|
}
|
|
117
125
|
}
|
|
118
|
-
return internalInterpolate
|
|
126
|
+
return internalInterpolate(x, narrowedInput, extrapolationConfig);
|
|
119
127
|
}
|
|
@@ -1,21 +1,19 @@
|
|
|
1
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
2
|
-
// @ts-nocheck
|
|
3
1
|
import MapperRegistry from './MapperRegistry';
|
|
4
2
|
import MutableValue from './MutableValue';
|
|
5
3
|
import Mapper from './Mapper';
|
|
6
|
-
|
|
4
|
+
import { NativeReanimated } from '../NativeReanimated/NativeReanimated';
|
|
5
|
+
export default class JSReanimated extends NativeReanimated {
|
|
7
6
|
constructor() {
|
|
8
|
-
|
|
7
|
+
super(false);
|
|
9
8
|
this._valueSetter = undefined;
|
|
10
9
|
this._renderRequested = false;
|
|
11
10
|
this._mapperRegistry = new MapperRegistry(this);
|
|
12
11
|
this._frames = [];
|
|
13
|
-
this.timeProvider = {};
|
|
14
12
|
if (process.env.JEST_WORKER_ID) {
|
|
15
|
-
this.timeProvider
|
|
13
|
+
this.timeProvider = { now: () => Date.now() };
|
|
16
14
|
}
|
|
17
15
|
else {
|
|
18
|
-
this.timeProvider
|
|
16
|
+
this.timeProvider = { now: () => window.performance.now() };
|
|
19
17
|
}
|
|
20
18
|
}
|
|
21
19
|
pushFrame(frame) {
|
|
@@ -52,9 +50,10 @@ export default class JSReanimated {
|
|
|
52
50
|
return value;
|
|
53
51
|
}
|
|
54
52
|
makeMutable(value) {
|
|
53
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
55
54
|
return new MutableValue(value, this._valueSetter);
|
|
56
55
|
}
|
|
57
|
-
makeRemote(object) {
|
|
56
|
+
makeRemote(object = {}) {
|
|
58
57
|
return object;
|
|
59
58
|
}
|
|
60
59
|
startMapper(mapper, inputs = [], outputs = []) {
|
|
@@ -66,10 +65,14 @@ export default class JSReanimated {
|
|
|
66
65
|
stopMapper(mapperId) {
|
|
67
66
|
this._mapperRegistry.stopMapper(mapperId);
|
|
68
67
|
}
|
|
69
|
-
registerEventHandler(
|
|
68
|
+
registerEventHandler(_, __) {
|
|
70
69
|
// noop
|
|
70
|
+
return '';
|
|
71
71
|
}
|
|
72
|
-
unregisterEventHandler(
|
|
72
|
+
unregisterEventHandler(_) {
|
|
73
73
|
// noop
|
|
74
74
|
}
|
|
75
|
+
enableLayoutAnimations() {
|
|
76
|
+
console.warn('[Reanimated] enableLayoutAnimations is not available for WEB yet');
|
|
77
|
+
}
|
|
75
78
|
}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
2
|
-
// @ts-nocheck
|
|
3
1
|
import MutableValue from './MutableValue';
|
|
4
2
|
export default class Mapper {
|
|
5
3
|
constructor(module, mapper, inputs = [], outputs = []) {
|
|
@@ -23,7 +21,10 @@ export default class Mapper {
|
|
|
23
21
|
extractMutablesFromArray(array) {
|
|
24
22
|
const res = [];
|
|
25
23
|
function extractMutables(value) {
|
|
26
|
-
if (value
|
|
24
|
+
if (value == null) {
|
|
25
|
+
// return;
|
|
26
|
+
}
|
|
27
|
+
else if (value instanceof MutableValue) {
|
|
27
28
|
res.push(value);
|
|
28
29
|
}
|
|
29
30
|
else if (Array.isArray(value)) {
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
2
|
-
// @ts-nocheck
|
|
3
1
|
export default class MapperRegistry {
|
|
4
2
|
constructor(module) {
|
|
5
3
|
this.sortedMappers = [];
|
|
@@ -78,7 +76,8 @@ export default class MapperRegistry {
|
|
|
78
76
|
while (nodes.length)
|
|
79
77
|
dfs(nodes[0]);
|
|
80
78
|
const postArray = Object.keys(post).map((key) => {
|
|
81
|
-
|
|
79
|
+
const num = parseInt(key);
|
|
80
|
+
return [num, post[num]];
|
|
82
81
|
});
|
|
83
82
|
postArray.sort((a, b) => {
|
|
84
83
|
return b[1] - a[1];
|
|
@@ -95,9 +94,7 @@ export default class MapperRegistry {
|
|
|
95
94
|
}
|
|
96
95
|
}
|
|
97
96
|
class Node {
|
|
98
|
-
constructor(mapper,
|
|
99
|
-
this.mapper = null;
|
|
100
|
-
this.children = [];
|
|
97
|
+
constructor(mapper, children = []) {
|
|
101
98
|
this.mapper = mapper;
|
|
102
99
|
this.children = children;
|
|
103
100
|
}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
2
|
-
// @ts-nocheck
|
|
3
1
|
import JSReanimated from './JSReanimated';
|
|
4
2
|
import { shouldBeUseWeb } from '../PlatformChecker';
|
|
5
3
|
const reanimatedJS = new JSReanimated();
|
|
@@ -22,25 +20,29 @@ if (shouldBeUseWeb()) {
|
|
|
22
20
|
global._scrollTo = () => {
|
|
23
21
|
console.warn("[Reanimated] You can't use 'scrollTo' method with Chrome Debugger or with web version");
|
|
24
22
|
};
|
|
23
|
+
global._setGestureState = () => {
|
|
24
|
+
console.warn("[Reanimated] You can't use 'setGestureState' method with Chrome Debugger or with web version");
|
|
25
|
+
};
|
|
25
26
|
}
|
|
26
27
|
export const _updatePropsJS = (updates, viewRef) => {
|
|
27
|
-
if (viewRef
|
|
28
|
+
if (viewRef._component) {
|
|
29
|
+
const component = viewRef._component;
|
|
28
30
|
const [rawStyles] = Object.keys(updates).reduce((acc, key) => {
|
|
29
31
|
const value = updates[key];
|
|
30
32
|
const index = typeof value === 'function' ? 1 : 0;
|
|
31
33
|
acc[index][key] = value;
|
|
32
34
|
return acc;
|
|
33
35
|
}, [{}, {}]);
|
|
34
|
-
if (typeof
|
|
35
|
-
setNativeProps(
|
|
36
|
+
if (typeof component.setNativeProps === 'function') {
|
|
37
|
+
setNativeProps(component, rawStyles);
|
|
36
38
|
}
|
|
37
|
-
else if (Object.keys(
|
|
38
|
-
Object.keys(
|
|
39
|
+
else if (Object.keys(component.props).length > 0) {
|
|
40
|
+
Object.keys(component.props).forEach((key) => {
|
|
39
41
|
if (!rawStyles[key]) {
|
|
40
42
|
return;
|
|
41
43
|
}
|
|
42
44
|
const dashedKey = key.replace(/[A-Z]/g, (m) => '-' + m.toLowerCase());
|
|
43
|
-
|
|
45
|
+
component._touchableNode.setAttribute(dashedKey, rawStyles[key]);
|
|
44
46
|
});
|
|
45
47
|
}
|
|
46
48
|
else {
|
|
@@ -1,34 +1,65 @@
|
|
|
1
1
|
/* global _stopObservingProgress, _startObservingProgress */
|
|
2
2
|
import { runOnUI } from '../core';
|
|
3
3
|
import { withStyleAnimation } from '../animation/styleAnimation';
|
|
4
|
+
import { ColorProperties } from '../UpdateProps';
|
|
5
|
+
import { processColor } from '../Colors';
|
|
4
6
|
runOnUI(() => {
|
|
5
7
|
'worklet';
|
|
6
8
|
const configs = {};
|
|
9
|
+
const enteringAnimationForTag = {};
|
|
7
10
|
global.LayoutAnimationRepository = {
|
|
8
11
|
configs,
|
|
9
12
|
registerConfig(tag, config) {
|
|
10
13
|
configs[tag] = config;
|
|
14
|
+
enteringAnimationForTag[tag] = null;
|
|
11
15
|
},
|
|
12
16
|
removeConfig(tag) {
|
|
13
17
|
delete configs[tag];
|
|
18
|
+
delete enteringAnimationForTag[tag];
|
|
14
19
|
},
|
|
15
20
|
startAnimationForTag(tag, type, yogaValues) {
|
|
16
21
|
if (configs[tag] == null) {
|
|
17
22
|
return; // :(
|
|
18
23
|
}
|
|
19
24
|
const style = configs[tag][type](yogaValues);
|
|
25
|
+
let currentAnimation = style.animations;
|
|
26
|
+
if (type === 'entering') {
|
|
27
|
+
enteringAnimationForTag[tag] = style;
|
|
28
|
+
}
|
|
29
|
+
else if (type === 'layout' && enteringAnimationForTag[tag] !== null) {
|
|
30
|
+
const entryAniamtion = enteringAnimationForTag[tag].animations;
|
|
31
|
+
const layoutAnimation = style.animations;
|
|
32
|
+
currentAnimation = {};
|
|
33
|
+
for (const key in entryAniamtion) {
|
|
34
|
+
currentAnimation[key] = entryAniamtion[key];
|
|
35
|
+
}
|
|
36
|
+
for (const key in layoutAnimation) {
|
|
37
|
+
currentAnimation[key] = layoutAnimation[key];
|
|
38
|
+
}
|
|
39
|
+
}
|
|
20
40
|
const sv = configs[tag].sv;
|
|
21
41
|
_stopObservingProgress(tag, false);
|
|
22
42
|
_startObservingProgress(tag, sv);
|
|
23
|
-
|
|
43
|
+
const backupColor = {};
|
|
44
|
+
for (const key in style.initialValues) {
|
|
45
|
+
if (ColorProperties.includes(key)) {
|
|
46
|
+
const value = style.initialValues[key];
|
|
47
|
+
backupColor[key] = value;
|
|
48
|
+
style.initialValues[key] = processColor(value);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
sv.value = Object.assign({}, sv._value, style.initialValues);
|
|
24
52
|
_stopObservingProgress(tag, false);
|
|
25
|
-
const animation = withStyleAnimation(
|
|
53
|
+
const animation = withStyleAnimation(currentAnimation);
|
|
26
54
|
animation.callback = (finished) => {
|
|
27
55
|
if (finished) {
|
|
28
56
|
_stopObservingProgress(tag, finished);
|
|
29
57
|
}
|
|
30
58
|
style.callback && style.callback(finished);
|
|
31
59
|
};
|
|
60
|
+
if (backupColor) {
|
|
61
|
+
configs[tag].sv._value = Object.assign(Object.assign({}, configs[tag].sv.value), backupColor);
|
|
62
|
+
}
|
|
32
63
|
configs[tag].sv.value = animation;
|
|
33
64
|
_startObservingProgress(tag, sv);
|
|
34
65
|
},
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { withDelay
|
|
1
|
+
import { withDelay } from '../../animation';
|
|
2
2
|
export class BaseAnimationBuilder {
|
|
3
3
|
constructor() {
|
|
4
|
+
this.randomizeDelay = false;
|
|
4
5
|
this.build = () => {
|
|
5
6
|
throw Error('Unimplemented method in child class.');
|
|
6
7
|
};
|
|
@@ -13,14 +14,6 @@ export class BaseAnimationBuilder {
|
|
|
13
14
|
this.durationV = durationMs;
|
|
14
15
|
return this;
|
|
15
16
|
}
|
|
16
|
-
static easing(easingFunction) {
|
|
17
|
-
const instance = this.createInstance();
|
|
18
|
-
return instance.easing(easingFunction);
|
|
19
|
-
}
|
|
20
|
-
easing(easingFunction) {
|
|
21
|
-
this.easingV = easingFunction;
|
|
22
|
-
return this;
|
|
23
|
-
}
|
|
24
17
|
static delay(delayMs) {
|
|
25
18
|
const instance = this.createInstance();
|
|
26
19
|
return instance.delay(delayMs);
|
|
@@ -29,138 +22,48 @@ export class BaseAnimationBuilder {
|
|
|
29
22
|
this.delayV = delayMs;
|
|
30
23
|
return this;
|
|
31
24
|
}
|
|
32
|
-
static
|
|
33
|
-
const instance = this.createInstance();
|
|
34
|
-
return instance.rotate(degree);
|
|
35
|
-
}
|
|
36
|
-
rotate(degree) {
|
|
37
|
-
this.rotateV = degree;
|
|
38
|
-
return this;
|
|
39
|
-
}
|
|
40
|
-
static springify() {
|
|
41
|
-
const instance = this.createInstance();
|
|
42
|
-
return instance.springify();
|
|
43
|
-
}
|
|
44
|
-
springify() {
|
|
45
|
-
this.type = withSpring;
|
|
46
|
-
return this;
|
|
47
|
-
}
|
|
48
|
-
static damping(damping) {
|
|
49
|
-
const instance = this.createInstance();
|
|
50
|
-
return instance.damping(damping);
|
|
51
|
-
}
|
|
52
|
-
damping(damping) {
|
|
53
|
-
this.dampingV = damping;
|
|
54
|
-
return this;
|
|
55
|
-
}
|
|
56
|
-
static mass(mass) {
|
|
57
|
-
const instance = this.createInstance();
|
|
58
|
-
return instance.mass(mass);
|
|
59
|
-
}
|
|
60
|
-
mass(mass) {
|
|
61
|
-
this.massV = mass;
|
|
62
|
-
return this;
|
|
63
|
-
}
|
|
64
|
-
static stiffness(stiffness) {
|
|
65
|
-
const instance = this.createInstance();
|
|
66
|
-
return instance.stiffness(stiffness);
|
|
67
|
-
}
|
|
68
|
-
stiffness(stiffness) {
|
|
69
|
-
this.stiffnessV = stiffness;
|
|
70
|
-
return this;
|
|
71
|
-
}
|
|
72
|
-
static overshootClamping(overshootClamping) {
|
|
73
|
-
const instance = this.createInstance();
|
|
74
|
-
return instance.overshootClamping(overshootClamping);
|
|
75
|
-
}
|
|
76
|
-
overshootClamping(overshootClamping) {
|
|
77
|
-
this.overshootClampingV = overshootClamping;
|
|
78
|
-
return this;
|
|
79
|
-
}
|
|
80
|
-
static restDisplacementThreshold(restDisplacementThreshold) {
|
|
25
|
+
static withCallback(callback) {
|
|
81
26
|
const instance = this.createInstance();
|
|
82
|
-
return instance.
|
|
27
|
+
return instance.withCallback(callback);
|
|
83
28
|
}
|
|
84
|
-
|
|
85
|
-
this.
|
|
29
|
+
withCallback(callback) {
|
|
30
|
+
this.callbackV = callback;
|
|
86
31
|
return this;
|
|
87
32
|
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
return
|
|
33
|
+
// 300ms is the default animation duration. If any animation has different default has to override this method.
|
|
34
|
+
static getDuration() {
|
|
35
|
+
return 300;
|
|
91
36
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
return this;
|
|
37
|
+
getDuration() {
|
|
38
|
+
var _a;
|
|
39
|
+
return (_a = this.durationV) !== null && _a !== void 0 ? _a : 300;
|
|
95
40
|
}
|
|
96
|
-
static
|
|
41
|
+
static randomDelay() {
|
|
97
42
|
const instance = this.createInstance();
|
|
98
|
-
return instance.
|
|
43
|
+
return instance.randomDelay();
|
|
99
44
|
}
|
|
100
|
-
|
|
101
|
-
this.
|
|
45
|
+
randomDelay() {
|
|
46
|
+
this.randomizeDelay = true;
|
|
102
47
|
return this;
|
|
103
48
|
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
49
|
+
// when randomizeDelay is set to true, randomize delay between 0 and provided value (or 1000ms if delay is not provided)
|
|
50
|
+
getDelay() {
|
|
51
|
+
var _a, _b;
|
|
52
|
+
return this.randomizeDelay
|
|
53
|
+
? Math.random() * ((_a = this.delayV) !== null && _a !== void 0 ? _a : 1000)
|
|
54
|
+
: (_b = this.delayV) !== null && _b !== void 0 ? _b : 0;
|
|
107
55
|
}
|
|
108
56
|
getDelayFunction() {
|
|
109
|
-
const
|
|
110
|
-
return
|
|
57
|
+
const isDelayProvided = this.randomizeDelay || this.delayV;
|
|
58
|
+
return isDelayProvided
|
|
111
59
|
? withDelay
|
|
112
60
|
: (_, animation) => {
|
|
113
61
|
'worklet';
|
|
114
62
|
return animation;
|
|
115
63
|
};
|
|
116
64
|
}
|
|
117
|
-
|
|
118
|
-
const
|
|
119
|
-
|
|
120
|
-
const rotate = this.rotateV;
|
|
121
|
-
const type = this.type ? this.type : withTiming;
|
|
122
|
-
const damping = this.dampingV;
|
|
123
|
-
const mass = this.massV;
|
|
124
|
-
const stiffness = this.stiffnessV;
|
|
125
|
-
const overshootClamping = this.overshootClampingV;
|
|
126
|
-
const restDisplacementThreshold = this.restDisplacementThresholdV;
|
|
127
|
-
const restSpeedThreshold = this.restSpeedThresholdV;
|
|
128
|
-
const animation = type;
|
|
129
|
-
const config = {};
|
|
130
|
-
if (type === withTiming) {
|
|
131
|
-
if (easing) {
|
|
132
|
-
config.easing = easing;
|
|
133
|
-
}
|
|
134
|
-
if (duration) {
|
|
135
|
-
config.duration = duration;
|
|
136
|
-
}
|
|
137
|
-
if (rotate) {
|
|
138
|
-
config.rotate = rotate;
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
else {
|
|
142
|
-
if (damping) {
|
|
143
|
-
config.damping = damping;
|
|
144
|
-
}
|
|
145
|
-
if (mass) {
|
|
146
|
-
config.mass = mass;
|
|
147
|
-
}
|
|
148
|
-
if (stiffness) {
|
|
149
|
-
config.stiffness = stiffness;
|
|
150
|
-
}
|
|
151
|
-
if (overshootClamping) {
|
|
152
|
-
config.overshootClamping = overshootClamping;
|
|
153
|
-
}
|
|
154
|
-
if (restDisplacementThreshold) {
|
|
155
|
-
config.restDisplacementThreshold = restDisplacementThreshold;
|
|
156
|
-
}
|
|
157
|
-
if (restSpeedThreshold) {
|
|
158
|
-
config.restSpeedThreshold = restSpeedThreshold;
|
|
159
|
-
}
|
|
160
|
-
if (rotate) {
|
|
161
|
-
config.rotate = rotate;
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
return [animation, config];
|
|
65
|
+
static build() {
|
|
66
|
+
const instance = this.createInstance();
|
|
67
|
+
return instance.build();
|
|
165
68
|
}
|
|
166
69
|
}
|