react-native-reanimated 2.12.0 → 2.14.0
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/NativeModules/NativeReanimatedModule.cpp +1 -0
- package/Common/cpp/Tools/ReanimatedVersion.cpp +17 -0
- package/Common/cpp/Tools/ReanimatedVersion.h +11 -0
- package/RNReanimated.podspec +2 -1
- package/android/.gradle/7.5.1/checksums/checksums.lock +0 -0
- package/android/.gradle/7.5.1/checksums/md5-checksums.bin +0 -0
- package/android/.gradle/7.5.1/checksums/sha1-checksums.bin +0 -0
- package/android/.gradle/7.5.1/dependencies-accessors/dependencies-accessors.lock +0 -0
- package/android/.gradle/7.5.1/executionHistory/executionHistory.bin +0 -0
- package/android/.gradle/7.5.1/executionHistory/executionHistory.lock +0 -0
- package/android/.gradle/7.5.1/fileHashes/fileHashes.bin +0 -0
- package/android/.gradle/7.5.1/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/7.5.1/fileHashes/resourceHashesCache.bin +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/cache.properties +1 -1
- package/android/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
- package/android/.gradle/file-system.probe +0 -0
- package/android/CMakeLists.txt +192 -189
- package/android/build.gradle +395 -317
- package/android/react-native-reanimated-67-hermes.aar +0 -0
- package/android/react-native-reanimated-67-jsc.aar +0 -0
- package/android/react-native-reanimated-68-hermes.aar +0 -0
- package/android/react-native-reanimated-68-jsc.aar +0 -0
- package/android/react-native-reanimated-69-hermes.aar +0 -0
- package/android/react-native-reanimated-69-jsc.aar +0 -0
- package/android/react-native-reanimated-70-hermes.aar +0 -0
- package/android/react-native-reanimated-70-jsc.aar +0 -0
- package/android/react-native-reanimated-71-hermes.aar +0 -0
- package/android/react-native-reanimated-71-jsc.aar +0 -0
- package/android/src/main/cpp/NativeProxy.cpp +8 -0
- package/android/src/main/java/com/swmansion/reanimated/ReanimatedPackage.java +5 -4
- package/android/src/main/java/com/swmansion/reanimated/sensor/ReanimatedSensorContainer.java +1 -1
- package/android/src/reactNativeVersionPatch/ReanimatedUIManager/70/com/swmansion/reanimated/ReanimatedUIManagerFactory.java +16 -0
- package/android/src/{main/java → reactNativeVersionPatch/ReanimatedUIManager/70}/com/swmansion/reanimated/layoutReanimation/ReanimatedUIManager.java +0 -0
- package/android/src/reactNativeVersionPatch/ReanimatedUIManager/latest/com/swmansion/reanimated/ReanimatedUIManagerFactory.java +63 -0
- package/android/src/reactNativeVersionPatch/ReanimatedUIManager/latest/com/swmansion/reanimated/layoutReanimation/ReanimatedUIManager.java +271 -0
- package/android/src/reactNativeVersionPatch/nativeHierarchyManager/latest/com/swmansion/reanimated/layoutReanimation/ReanimatedNativeHierarchyManager.java +3 -30
- package/ios/REAModule.mm +11 -7
- package/ios/native/REAInitializer.mm +4 -0
- package/lib/createAnimatedComponent.js +5 -0
- package/lib/reanimated2/Colors.js +27 -11
- package/lib/reanimated2/NativeReanimated/NativeReanimated.js +4 -0
- package/lib/reanimated2/animation/util.js +15 -15
- package/lib/reanimated2/globals.d.ts +2 -0
- package/lib/reanimated2/interpolateColor.js +79 -20
- package/lib/reanimated2/jestUtils.js +14 -7
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Bounce.js +16 -18
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js +8 -10
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Roll.js +15 -10
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Slide.js +8 -10
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Zoom.js +24 -18
- package/lib/reanimated2/platform-specific/checkVersion.js +24 -0
- package/lib/reanimated2/platform-specific/checkVersion.web.js +6 -0
- package/lib/types/{Animated.d.ts → lib/Animated.d.ts} +0 -0
- package/lib/types/{ConfigHelper.d.ts → lib/ConfigHelper.d.ts} +0 -0
- package/lib/types/{ReanimatedEventEmitter.d.ts → lib/ReanimatedEventEmitter.d.ts} +0 -0
- package/lib/types/{ReanimatedModule.d.ts → lib/ReanimatedModule.d.ts} +0 -0
- package/lib/types/{ReanimatedModule.macos.d.ts → lib/ReanimatedModule.macos.d.ts} +0 -0
- package/lib/types/{ReanimatedModule.native.d.ts → lib/ReanimatedModule.native.d.ts} +0 -0
- package/lib/types/{ReanimatedModule.windows.d.ts → lib/ReanimatedModule.windows.d.ts} +0 -0
- package/lib/types/{ReanimatedModuleCompat.d.ts → lib/ReanimatedModuleCompat.d.ts} +0 -0
- package/lib/types/{createAnimatedComponent.d.ts → lib/createAnimatedComponent.d.ts} +0 -0
- package/lib/types/{index.d.ts → lib/index.d.ts} +0 -0
- package/lib/types/{index.web.d.ts → lib/index.web.d.ts} +0 -0
- package/lib/types/{reanimated2 → lib/reanimated2}/Bezier.d.ts +0 -0
- package/lib/types/{reanimated2 → lib/reanimated2}/Colors.d.ts +5 -3
- package/lib/types/{reanimated2 → lib/reanimated2}/Easing.d.ts +0 -0
- package/lib/types/{reanimated2 → lib/reanimated2}/NativeMethods.d.ts +0 -0
- package/lib/types/{reanimated2 → lib/reanimated2}/NativeReanimated/NativeReanimated.d.ts +0 -0
- package/lib/types/{reanimated2 → lib/reanimated2}/NativeReanimated/index.d.ts +0 -0
- package/lib/types/{reanimated2 → lib/reanimated2}/PlatformChecker.d.ts +0 -0
- package/lib/types/{reanimated2 → lib/reanimated2}/PropAdapters.d.ts +0 -0
- package/lib/types/{reanimated2 → lib/reanimated2}/UpdateProps.d.ts +0 -0
- package/lib/types/{reanimated2 → lib/reanimated2}/ViewDescriptorsSet.d.ts +0 -0
- package/lib/types/{reanimated2 → lib/reanimated2}/WorkletEventHandler.d.ts +0 -0
- package/lib/types/{reanimated2 → lib/reanimated2}/__mocks__/MutableValue.d.ts +0 -0
- package/lib/types/{reanimated2 → lib/reanimated2}/__mocks__/NativeReanimated.d.ts +0 -0
- package/lib/types/{reanimated2 → lib/reanimated2}/animation/commonTypes.d.ts +0 -0
- package/lib/types/{reanimated2 → lib/reanimated2}/animation/decay.d.ts +0 -0
- package/lib/types/{reanimated2 → lib/reanimated2}/animation/delay.d.ts +0 -0
- package/lib/types/{reanimated2 → lib/reanimated2}/animation/index.d.ts +0 -0
- package/lib/types/{reanimated2 → lib/reanimated2}/animation/repeat.d.ts +0 -0
- package/lib/types/{reanimated2 → lib/reanimated2}/animation/sequence.d.ts +0 -0
- package/lib/types/{reanimated2 → lib/reanimated2}/animation/spring.d.ts +0 -0
- package/lib/types/{reanimated2 → lib/reanimated2}/animation/styleAnimation.d.ts +0 -0
- package/lib/types/{reanimated2 → lib/reanimated2}/animation/timing.d.ts +0 -0
- package/lib/types/{reanimated2 → lib/reanimated2}/animation/util.d.ts +0 -0
- package/lib/types/{reanimated2 → lib/reanimated2}/commonTypes.d.ts +0 -0
- package/lib/types/{reanimated2 → lib/reanimated2}/component/FlatList.d.ts +0 -0
- package/lib/types/{reanimated2 → lib/reanimated2}/component/Image.d.ts +0 -0
- package/lib/types/{reanimated2 → lib/reanimated2}/component/ScrollView.d.ts +0 -0
- package/lib/types/{reanimated2 → lib/reanimated2}/component/Text.d.ts +0 -0
- package/lib/types/{reanimated2 → lib/reanimated2}/component/View.d.ts +0 -0
- package/lib/types/{reanimated2 → lib/reanimated2}/core.d.ts +0 -0
- package/lib/types/{reanimated2 → lib/reanimated2}/frameCallback/FrameCallbackRegistryJS.d.ts +0 -0
- package/lib/types/{reanimated2 → lib/reanimated2}/frameCallback/FrameCallbackRegistryUI.d.ts +0 -0
- package/lib/types/{reanimated2 → lib/reanimated2}/hook/Hooks.d.ts +0 -0
- package/lib/types/{reanimated2 → lib/reanimated2}/hook/commonTypes.d.ts +0 -0
- package/lib/types/{reanimated2 → lib/reanimated2}/hook/index.d.ts +0 -0
- package/lib/types/{reanimated2 → lib/reanimated2}/hook/useAnimatedGestureHandler.d.ts +0 -0
- package/lib/types/{reanimated2 → lib/reanimated2}/hook/useAnimatedKeyboard.d.ts +0 -0
- package/lib/types/{reanimated2 → lib/reanimated2}/hook/useAnimatedReaction.d.ts +0 -0
- package/lib/types/{reanimated2 → lib/reanimated2}/hook/useAnimatedRef.d.ts +0 -0
- package/lib/types/{reanimated2 → lib/reanimated2}/hook/useAnimatedScrollHandler.d.ts +0 -0
- package/lib/types/{reanimated2 → lib/reanimated2}/hook/useAnimatedSensor.d.ts +0 -0
- package/lib/types/{reanimated2 → lib/reanimated2}/hook/useAnimatedStyle.d.ts +0 -0
- package/lib/types/{reanimated2 → lib/reanimated2}/hook/useDerivedValue.d.ts +0 -0
- package/lib/types/{reanimated2 → lib/reanimated2}/hook/useFrameCallback.d.ts +0 -0
- package/lib/types/{reanimated2 → lib/reanimated2}/hook/useScrollViewOffset.d.ts +0 -0
- package/lib/types/{reanimated2 → lib/reanimated2}/hook/useSharedValue.d.ts +0 -0
- package/lib/types/{reanimated2 → lib/reanimated2}/hook/utils.d.ts +0 -0
- package/lib/types/{reanimated2 → lib/reanimated2}/index.d.ts +0 -0
- package/lib/types/{reanimated2 → lib/reanimated2}/interpolateColor.d.ts +8 -2
- package/lib/types/{reanimated2 → lib/reanimated2}/interpolation.d.ts +0 -0
- package/lib/types/{reanimated2 → lib/reanimated2}/jestUtils.d.ts +0 -0
- package/lib/types/{reanimated2 → lib/reanimated2}/js-reanimated/JSReanimated.d.ts +0 -0
- package/lib/types/{reanimated2 → lib/reanimated2}/js-reanimated/Mapper.d.ts +0 -0
- package/lib/types/{reanimated2 → lib/reanimated2}/js-reanimated/MapperRegistry.d.ts +0 -0
- package/lib/types/{reanimated2 → lib/reanimated2}/js-reanimated/MutableValue.d.ts +0 -0
- package/lib/types/{reanimated2 → lib/reanimated2}/js-reanimated/commonTypes.d.ts +0 -0
- package/lib/types/{reanimated2 → lib/reanimated2}/js-reanimated/global.d.ts +0 -0
- package/lib/types/{reanimated2 → lib/reanimated2}/js-reanimated/index.d.ts +0 -0
- package/lib/types/{reanimated2 → lib/reanimated2}/layoutReanimation/LayoutAnimationRepository.d.ts +0 -0
- package/lib/types/{reanimated2 → lib/reanimated2}/layoutReanimation/animationBuilder/BaseAnimationBuilder.d.ts +0 -0
- package/lib/types/{reanimated2 → lib/reanimated2}/layoutReanimation/animationBuilder/ComplexAnimationBuilder.d.ts +0 -0
- package/lib/types/{reanimated2 → lib/reanimated2}/layoutReanimation/animationBuilder/Keyframe.d.ts +0 -0
- package/lib/types/{reanimated2 → lib/reanimated2}/layoutReanimation/animationBuilder/commonTypes.d.ts +4 -0
- package/lib/types/{reanimated2 → lib/reanimated2}/layoutReanimation/animationBuilder/index.d.ts +0 -0
- package/lib/types/{reanimated2 → lib/reanimated2}/layoutReanimation/defaultAnimations/Bounce.d.ts +0 -0
- package/lib/types/{reanimated2 → lib/reanimated2}/layoutReanimation/defaultAnimations/Default.d.ts +0 -0
- package/lib/types/{reanimated2 → lib/reanimated2}/layoutReanimation/defaultAnimations/Fade.d.ts +0 -0
- package/lib/types/{reanimated2 → lib/reanimated2}/layoutReanimation/defaultAnimations/Flip.d.ts +0 -0
- package/lib/types/{reanimated2 → lib/reanimated2}/layoutReanimation/defaultAnimations/Lightspeed.d.ts +0 -0
- package/lib/types/{reanimated2 → lib/reanimated2}/layoutReanimation/defaultAnimations/Pinwheel.d.ts +0 -0
- package/lib/types/{reanimated2 → lib/reanimated2}/layoutReanimation/defaultAnimations/Roll.d.ts +0 -0
- package/lib/types/{reanimated2 → lib/reanimated2}/layoutReanimation/defaultAnimations/Rotate.d.ts +0 -0
- package/lib/types/{reanimated2 → lib/reanimated2}/layoutReanimation/defaultAnimations/Slide.d.ts +0 -0
- package/lib/types/{reanimated2 → lib/reanimated2}/layoutReanimation/defaultAnimations/Stretch.d.ts +0 -0
- package/lib/types/{reanimated2 → lib/reanimated2}/layoutReanimation/defaultAnimations/Zoom.d.ts +0 -0
- package/lib/types/{reanimated2 → lib/reanimated2}/layoutReanimation/defaultAnimations/index.d.ts +0 -0
- package/lib/types/{reanimated2 → lib/reanimated2}/layoutReanimation/defaultTransitions/CurvedTransition.d.ts +0 -0
- package/lib/types/{reanimated2 → lib/reanimated2}/layoutReanimation/defaultTransitions/EntryExitTransition.d.ts +0 -0
- package/lib/types/{reanimated2 → lib/reanimated2}/layoutReanimation/defaultTransitions/FadingTransition.d.ts +0 -0
- package/lib/types/{reanimated2 → lib/reanimated2}/layoutReanimation/defaultTransitions/JumpingTransition.d.ts +0 -0
- package/lib/types/{reanimated2 → lib/reanimated2}/layoutReanimation/defaultTransitions/LinearTransition.d.ts +0 -0
- package/lib/types/{reanimated2 → lib/reanimated2}/layoutReanimation/defaultTransitions/SequencedTransition.d.ts +0 -0
- package/lib/types/{reanimated2 → lib/reanimated2}/layoutReanimation/defaultTransitions/index.d.ts +0 -0
- package/lib/types/{reanimated2 → lib/reanimated2}/layoutReanimation/index.d.ts +0 -0
- package/lib/types/{reanimated2 → lib/reanimated2}/mock.d.ts +0 -0
- package/lib/types/{reanimated2 → lib/reanimated2}/platform-specific/RNRenderer.d.ts +0 -0
- package/lib/types/{reanimated2 → lib/reanimated2}/platform-specific/RNRenderer.web.d.ts +0 -0
- package/lib/types/lib/reanimated2/platform-specific/checkVersion.d.ts +4 -0
- package/lib/types/lib/reanimated2/platform-specific/checkVersion.web.d.ts +5 -0
- package/lib/types/{reanimated2 → lib/reanimated2}/utils.d.ts +0 -0
- package/lib/types/{setAndForwardRef.d.ts → lib/setAndForwardRef.d.ts} +0 -0
- package/package.json +8 -8
- package/plugin.js +7 -3
- package/react-native-reanimated.d.ts +11 -2
- package/scripts/reanimated_utils.rb +7 -3
- package/src/createAnimatedComponent.tsx +7 -0
- package/src/reanimated2/Colors.ts +38 -11
- package/src/reanimated2/NativeReanimated/NativeReanimated.ts +4 -0
- package/src/reanimated2/animation/util.ts +26 -15
- package/src/reanimated2/globals.d.ts +2 -0
- package/src/reanimated2/interpolateColor.ts +105 -21
- package/src/reanimated2/jestUtils.ts +14 -6
- package/src/reanimated2/layoutReanimation/animationBuilder/commonTypes.ts +4 -0
- package/src/reanimated2/layoutReanimation/defaultAnimations/Bounce.ts +16 -19
- package/src/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.ts +14 -11
- package/src/reanimated2/layoutReanimation/defaultAnimations/Roll.ts +21 -11
- package/src/reanimated2/layoutReanimation/defaultAnimations/Slide.ts +32 -11
- package/src/reanimated2/layoutReanimation/defaultAnimations/Zoom.ts +36 -19
- package/src/reanimated2/platform-specific/checkVersion.ts +28 -0
- package/src/reanimated2/platform-specific/checkVersion.web.ts +6 -0
- package/android/react-native-reanimated-66-hermes.aar +0 -0
- package/android/react-native-reanimated-66-jsc.aar +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* global _WORKLET */
|
|
2
|
-
import {
|
|
2
|
+
import { isColor, convertToRGBA, rgbaArrayToRGBAColor, toGammaSpace, toLinearSpace, } from '../Colors';
|
|
3
3
|
import NativeReanimatedModule from '../NativeReanimated';
|
|
4
4
|
let IN_STYLE_UPDATER = false;
|
|
5
5
|
export function initialUpdaterRun(updater) {
|
|
@@ -75,39 +75,39 @@ function decorateAnimation(animation) {
|
|
|
75
75
|
((_b = animation.__suffix) !== null && _b !== void 0 ? _b : '');
|
|
76
76
|
return res;
|
|
77
77
|
};
|
|
78
|
-
const tab = ['
|
|
78
|
+
const tab = ['R', 'G', 'B', 'A'];
|
|
79
79
|
const colorOnStart = (animation, value, timestamp, previousAnimation) => {
|
|
80
|
-
let
|
|
81
|
-
let
|
|
82
|
-
let
|
|
80
|
+
let RGBAValue;
|
|
81
|
+
let RGBACurrent;
|
|
82
|
+
let RGBAToValue;
|
|
83
83
|
const res = [];
|
|
84
84
|
if (isColor(value)) {
|
|
85
|
-
|
|
86
|
-
|
|
85
|
+
RGBACurrent = toLinearSpace(convertToRGBA(animation.current));
|
|
86
|
+
RGBAValue = toLinearSpace(convertToRGBA(value));
|
|
87
87
|
if (animation.toValue) {
|
|
88
|
-
|
|
88
|
+
RGBAToValue = toLinearSpace(convertToRGBA(animation.toValue));
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
tab.forEach((i, index) => {
|
|
92
92
|
animation[i] = Object.assign({}, animationCopy);
|
|
93
|
-
animation[i].current =
|
|
94
|
-
animation[i].toValue =
|
|
95
|
-
animation[i].onStart(animation[i],
|
|
93
|
+
animation[i].current = RGBACurrent[index];
|
|
94
|
+
animation[i].toValue = RGBAToValue ? RGBAToValue[index] : undefined;
|
|
95
|
+
animation[i].onStart(animation[i], RGBAValue[index], timestamp, previousAnimation ? previousAnimation[i] : undefined);
|
|
96
96
|
res.push(animation[i].current);
|
|
97
97
|
});
|
|
98
|
-
animation.current =
|
|
98
|
+
animation.current = rgbaArrayToRGBAColor(toGammaSpace(res));
|
|
99
99
|
};
|
|
100
100
|
const colorOnFrame = (animation, timestamp) => {
|
|
101
|
-
const
|
|
101
|
+
const RGBACurrent = toLinearSpace(convertToRGBA(animation.current));
|
|
102
102
|
const res = [];
|
|
103
103
|
let finished = true;
|
|
104
104
|
tab.forEach((i, index) => {
|
|
105
|
-
animation[i].current =
|
|
105
|
+
animation[i].current = RGBACurrent[index];
|
|
106
106
|
// @ts-ignore: disable-next-line
|
|
107
107
|
finished &= animation[i].onFrame(animation[i], timestamp);
|
|
108
108
|
res.push(animation[i].current);
|
|
109
109
|
});
|
|
110
|
-
animation.current =
|
|
110
|
+
animation.current = rgbaArrayToRGBAColor(toGammaSpace(res));
|
|
111
111
|
return finished;
|
|
112
112
|
};
|
|
113
113
|
const arrayOnStart = (animation, value, timestamp, previousAnimation) => {
|
|
@@ -9,6 +9,7 @@ import type { FrameCallbackRegistryUI } from './frameCallback/FrameCallbackRegis
|
|
|
9
9
|
|
|
10
10
|
declare global {
|
|
11
11
|
const _WORKLET: boolean;
|
|
12
|
+
const _REANIMATED_VERSION_CPP: string;
|
|
12
13
|
const _frameTimestamp: number | null;
|
|
13
14
|
const _eventTimestamp: number;
|
|
14
15
|
const __reanimatedModuleProxy: NativeReanimated;
|
|
@@ -49,6 +50,7 @@ declare global {
|
|
|
49
50
|
interface Global {
|
|
50
51
|
_WORKLET: boolean;
|
|
51
52
|
_IS_FABRIC: boolean;
|
|
53
|
+
_REANIMATED_VERSION_CPP: string;
|
|
52
54
|
_frameTimestamp: number | null;
|
|
53
55
|
_eventTimestamp: number;
|
|
54
56
|
__reanimatedModuleProxy: NativeReanimated;
|
|
@@ -4,20 +4,75 @@ import { interpolate } from './interpolation';
|
|
|
4
4
|
// @ts-ignore JS file
|
|
5
5
|
import { Extrapolate } from '../reanimated1/derived';
|
|
6
6
|
import { useSharedValue } from './hook/useSharedValue';
|
|
7
|
-
const interpolateColorsHSV = (value, inputRange, colors) => {
|
|
7
|
+
const interpolateColorsHSV = (value, inputRange, colors, options) => {
|
|
8
8
|
'worklet';
|
|
9
|
-
|
|
9
|
+
let h = 0;
|
|
10
|
+
const { useCorrectedHSVInterpolation = true } = options;
|
|
11
|
+
if (useCorrectedHSVInterpolation) {
|
|
12
|
+
// if the difference between hues in a range is > 180 deg
|
|
13
|
+
// then move the hue at the right end of the range +/- 360 deg
|
|
14
|
+
// and add the next point in the original place + 0.00001 with original hue
|
|
15
|
+
// to not break the next range
|
|
16
|
+
const correctedInputRange = [inputRange[0]];
|
|
17
|
+
const originalH = colors.h;
|
|
18
|
+
const correctedH = [originalH[0]];
|
|
19
|
+
for (let i = 1; i < originalH.length; ++i) {
|
|
20
|
+
const d = originalH[i] - originalH[i - 1];
|
|
21
|
+
if (originalH[i] > originalH[i - 1] && d > 0.5) {
|
|
22
|
+
correctedInputRange.push(inputRange[i]);
|
|
23
|
+
correctedInputRange.push(inputRange[i] + 0.00001);
|
|
24
|
+
correctedH.push(originalH[i] - 1);
|
|
25
|
+
correctedH.push(originalH[i]);
|
|
26
|
+
}
|
|
27
|
+
else if (originalH[i] < originalH[i - 1] && d < -0.5) {
|
|
28
|
+
correctedInputRange.push(inputRange[i]);
|
|
29
|
+
correctedInputRange.push(inputRange[i] + 0.00001);
|
|
30
|
+
correctedH.push(originalH[i] + 1);
|
|
31
|
+
correctedH.push(originalH[i]);
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
correctedInputRange.push(inputRange[i]);
|
|
35
|
+
correctedH.push(originalH[i]);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
h =
|
|
39
|
+
(interpolate(value, correctedInputRange, correctedH, Extrapolate.CLAMP) +
|
|
40
|
+
1) %
|
|
41
|
+
1;
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
h = interpolate(value, inputRange, colors.h, Extrapolate.CLAMP);
|
|
45
|
+
}
|
|
10
46
|
const s = interpolate(value, inputRange, colors.s, Extrapolate.CLAMP);
|
|
11
47
|
const v = interpolate(value, inputRange, colors.v, Extrapolate.CLAMP);
|
|
12
|
-
|
|
48
|
+
const a = interpolate(value, inputRange, colors.a, Extrapolate.CLAMP);
|
|
49
|
+
return hsvToColor(h, s, v, a);
|
|
13
50
|
};
|
|
14
|
-
const
|
|
51
|
+
const toLinearSpace = (x, gamma) => {
|
|
15
52
|
'worklet';
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
53
|
+
return x.map((v) => Math.pow(v / 255, gamma));
|
|
54
|
+
};
|
|
55
|
+
const toGammaSpace = (x, gamma) => {
|
|
56
|
+
'worklet';
|
|
57
|
+
return Math.round(Math.pow(x, 1 / gamma) * 255);
|
|
58
|
+
};
|
|
59
|
+
const interpolateColorsRGB = (value, inputRange, colors, options) => {
|
|
60
|
+
'worklet';
|
|
61
|
+
const { gamma = 2.2 } = options;
|
|
62
|
+
let { r: outputR, g: outputG, b: outputB } = colors;
|
|
63
|
+
if (gamma !== 1) {
|
|
64
|
+
outputR = toLinearSpace(outputR, gamma);
|
|
65
|
+
outputG = toLinearSpace(outputG, gamma);
|
|
66
|
+
outputB = toLinearSpace(outputB, gamma);
|
|
67
|
+
}
|
|
68
|
+
const r = interpolate(value, inputRange, outputR, Extrapolate.CLAMP);
|
|
69
|
+
const g = interpolate(value, inputRange, outputG, Extrapolate.CLAMP);
|
|
70
|
+
const b = interpolate(value, inputRange, outputB, Extrapolate.CLAMP);
|
|
19
71
|
const a = interpolate(value, inputRange, colors.a, Extrapolate.CLAMP);
|
|
20
|
-
|
|
72
|
+
if (gamma === 1) {
|
|
73
|
+
return rgbaColor(r, g, b, a);
|
|
74
|
+
}
|
|
75
|
+
return rgbaColor(toGammaSpace(r, gamma), toGammaSpace(g, gamma), toGammaSpace(b, gamma), a);
|
|
21
76
|
};
|
|
22
77
|
const getInterpolateRGB = (colors) => {
|
|
23
78
|
'worklet';
|
|
@@ -43,24 +98,27 @@ const getInterpolateHSV = (colors) => {
|
|
|
43
98
|
const h = [];
|
|
44
99
|
const s = [];
|
|
45
100
|
const v = [];
|
|
101
|
+
const a = [];
|
|
46
102
|
for (let i = 0; i < colors.length; ++i) {
|
|
47
103
|
const color = colors[i];
|
|
48
|
-
const processedColor =
|
|
49
|
-
if (processedColor) {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
104
|
+
const processedColor = processColor(color);
|
|
105
|
+
if (typeof processedColor === 'number') {
|
|
106
|
+
const processedHSVColor = RGBtoHSV(red(processedColor), green(processedColor), blue(processedColor));
|
|
107
|
+
h.push(processedHSVColor.h);
|
|
108
|
+
s.push(processedHSVColor.s);
|
|
109
|
+
v.push(processedHSVColor.v);
|
|
110
|
+
a.push(opacity(processedColor));
|
|
53
111
|
}
|
|
54
112
|
}
|
|
55
|
-
return { h, s, v };
|
|
113
|
+
return { h, s, v, a };
|
|
56
114
|
};
|
|
57
|
-
export const interpolateColor = (value, inputRange, outputRange, colorSpace = 'RGB') => {
|
|
115
|
+
export const interpolateColor = (value, inputRange, outputRange, colorSpace = 'RGB', options = {}) => {
|
|
58
116
|
'worklet';
|
|
59
117
|
if (colorSpace === 'HSV') {
|
|
60
|
-
return interpolateColorsHSV(value, inputRange, getInterpolateHSV(outputRange));
|
|
118
|
+
return interpolateColorsHSV(value, inputRange, getInterpolateHSV(outputRange), options);
|
|
61
119
|
}
|
|
62
120
|
else if (colorSpace === 'RGB') {
|
|
63
|
-
return interpolateColorsRGB(value, inputRange, getInterpolateRGB(outputRange));
|
|
121
|
+
return interpolateColorsRGB(value, inputRange, getInterpolateRGB(outputRange), options);
|
|
64
122
|
}
|
|
65
123
|
throw new Error(`Invalid color space provided: ${colorSpace}. Supported values are: ['RGB', 'HSV']`);
|
|
66
124
|
};
|
|
@@ -69,12 +127,13 @@ export var ColorSpace;
|
|
|
69
127
|
ColorSpace[ColorSpace["RGB"] = 0] = "RGB";
|
|
70
128
|
ColorSpace[ColorSpace["HSV"] = 1] = "HSV";
|
|
71
129
|
})(ColorSpace || (ColorSpace = {}));
|
|
72
|
-
export function useInterpolateConfig(inputRange, outputRange, colorSpace = ColorSpace.RGB) {
|
|
130
|
+
export function useInterpolateConfig(inputRange, outputRange, colorSpace = ColorSpace.RGB, options = {}) {
|
|
73
131
|
return useSharedValue({
|
|
74
132
|
inputRange,
|
|
75
133
|
outputRange,
|
|
76
134
|
colorSpace,
|
|
77
135
|
cache: makeMutable(null),
|
|
136
|
+
options,
|
|
78
137
|
});
|
|
79
138
|
}
|
|
80
139
|
export const interpolateSharableColor = (value, interpolateConfig) => {
|
|
@@ -85,14 +144,14 @@ export const interpolateSharableColor = (value, interpolateConfig) => {
|
|
|
85
144
|
colors = getInterpolateRGB(interpolateConfig.value.outputRange);
|
|
86
145
|
interpolateConfig.value.cache.value = colors;
|
|
87
146
|
}
|
|
88
|
-
return interpolateColorsRGB(value, interpolateConfig.value.inputRange, colors);
|
|
147
|
+
return interpolateColorsRGB(value, interpolateConfig.value.inputRange, colors, interpolateConfig.value.options);
|
|
89
148
|
}
|
|
90
149
|
else if (interpolateConfig.value.colorSpace === ColorSpace.HSV) {
|
|
91
150
|
if (!colors) {
|
|
92
151
|
colors = getInterpolateHSV(interpolateConfig.value.outputRange);
|
|
93
152
|
interpolateConfig.value.cache.value = colors;
|
|
94
153
|
}
|
|
95
|
-
return interpolateColorsHSV(value, interpolateConfig.value.inputRange, colors);
|
|
154
|
+
return interpolateColorsHSV(value, interpolateConfig.value.inputRange, colors, interpolateConfig.value.options);
|
|
96
155
|
}
|
|
97
156
|
throw new Error(`Invalid color space provided: ${interpolateConfig.value.colorSpace}. Supported values are: ['RGB', 'HSV']`);
|
|
98
157
|
};
|
|
@@ -145,14 +145,21 @@ export const advanceAnimationByFrame = (count) => {
|
|
|
145
145
|
jest.advanceTimersByTime(frameTime);
|
|
146
146
|
};
|
|
147
147
|
export const setUpTests = (userConfig = {}) => {
|
|
148
|
-
let expect;
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
}
|
|
152
|
-
catch (_) {
|
|
153
|
-
// for Jest in version 28+
|
|
154
|
-
const { expect: expectModule } = require('@jest/globals');
|
|
148
|
+
let expect = global.expect;
|
|
149
|
+
if (expect === undefined) {
|
|
150
|
+
const expectModule = require('expect');
|
|
155
151
|
expect = expectModule;
|
|
152
|
+
// Starting from Jest 28, "expect" package uses named exports instead of default export.
|
|
153
|
+
// So, requiring "expect" package doesn't give direct access to "expect" function anymore.
|
|
154
|
+
// It gives access to the module object instead.
|
|
155
|
+
// We use this info to detect if the project uses Jest 28 or higher.
|
|
156
|
+
if (typeof expect === 'object') {
|
|
157
|
+
const jestGlobals = require('@jest/globals');
|
|
158
|
+
expect = jestGlobals.expect;
|
|
159
|
+
}
|
|
160
|
+
if (expect === undefined || expect.extend === undefined) {
|
|
161
|
+
expect = expectModule.default;
|
|
162
|
+
}
|
|
156
163
|
}
|
|
157
164
|
require('setimmediate');
|
|
158
165
|
frameTime = Math.round(1000 / config.fps);
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { withSequence, withTiming } from '../../animation';
|
|
2
|
-
import { Dimensions } from 'react-native';
|
|
3
2
|
import { ComplexAnimationBuilder } from '../animationBuilder/ComplexAnimationBuilder';
|
|
4
|
-
const { width, height } = Dimensions.get('window');
|
|
5
3
|
export class BounceIn extends ComplexAnimationBuilder {
|
|
6
4
|
constructor() {
|
|
7
5
|
super(...arguments);
|
|
@@ -47,7 +45,7 @@ export class BounceInDown extends ComplexAnimationBuilder {
|
|
|
47
45
|
const duration = this.getDuration();
|
|
48
46
|
const callback = this.callbackV;
|
|
49
47
|
const initialValues = this.initialValues;
|
|
50
|
-
return () => {
|
|
48
|
+
return (values) => {
|
|
51
49
|
'worklet';
|
|
52
50
|
return {
|
|
53
51
|
animations: {
|
|
@@ -59,7 +57,7 @@ export class BounceInDown extends ComplexAnimationBuilder {
|
|
|
59
57
|
},
|
|
60
58
|
initialValues: Object.assign({ transform: [
|
|
61
59
|
{
|
|
62
|
-
translateY:
|
|
60
|
+
translateY: values.windowHeight,
|
|
63
61
|
},
|
|
64
62
|
] }, initialValues),
|
|
65
63
|
callback: callback,
|
|
@@ -87,7 +85,7 @@ export class BounceInUp extends ComplexAnimationBuilder {
|
|
|
87
85
|
const duration = this.getDuration();
|
|
88
86
|
const callback = this.callbackV;
|
|
89
87
|
const initialValues = this.initialValues;
|
|
90
|
-
return () => {
|
|
88
|
+
return (values) => {
|
|
91
89
|
'worklet';
|
|
92
90
|
return {
|
|
93
91
|
animations: {
|
|
@@ -97,7 +95,7 @@ export class BounceInUp extends ComplexAnimationBuilder {
|
|
|
97
95
|
},
|
|
98
96
|
],
|
|
99
97
|
},
|
|
100
|
-
initialValues: Object.assign({ transform: [{ translateY: -
|
|
98
|
+
initialValues: Object.assign({ transform: [{ translateY: -values.windowHeight }] }, initialValues),
|
|
101
99
|
callback: callback,
|
|
102
100
|
};
|
|
103
101
|
};
|
|
@@ -123,7 +121,7 @@ export class BounceInLeft extends ComplexAnimationBuilder {
|
|
|
123
121
|
const duration = this.getDuration();
|
|
124
122
|
const callback = this.callbackV;
|
|
125
123
|
const initialValues = this.initialValues;
|
|
126
|
-
return () => {
|
|
124
|
+
return (values) => {
|
|
127
125
|
'worklet';
|
|
128
126
|
return {
|
|
129
127
|
animations: {
|
|
@@ -133,7 +131,7 @@ export class BounceInLeft extends ComplexAnimationBuilder {
|
|
|
133
131
|
},
|
|
134
132
|
],
|
|
135
133
|
},
|
|
136
|
-
initialValues: Object.assign({ transform: [{ translateX: -
|
|
134
|
+
initialValues: Object.assign({ transform: [{ translateX: -values.windowWidth }] }, initialValues),
|
|
137
135
|
callback: callback,
|
|
138
136
|
};
|
|
139
137
|
};
|
|
@@ -159,7 +157,7 @@ export class BounceInRight extends ComplexAnimationBuilder {
|
|
|
159
157
|
const duration = this.getDuration();
|
|
160
158
|
const callback = this.callbackV;
|
|
161
159
|
const initialValues = this.initialValues;
|
|
162
|
-
return () => {
|
|
160
|
+
return (values) => {
|
|
163
161
|
'worklet';
|
|
164
162
|
return {
|
|
165
163
|
animations: {
|
|
@@ -169,7 +167,7 @@ export class BounceInRight extends ComplexAnimationBuilder {
|
|
|
169
167
|
},
|
|
170
168
|
],
|
|
171
169
|
},
|
|
172
|
-
initialValues: Object.assign({ transform: [{ translateX:
|
|
170
|
+
initialValues: Object.assign({ transform: [{ translateX: values.windowWidth }] }, initialValues),
|
|
173
171
|
callback: callback,
|
|
174
172
|
};
|
|
175
173
|
};
|
|
@@ -231,13 +229,13 @@ export class BounceOutDown extends ComplexAnimationBuilder {
|
|
|
231
229
|
const duration = this.getDuration();
|
|
232
230
|
const callback = this.callbackV;
|
|
233
231
|
const initialValues = this.initialValues;
|
|
234
|
-
return () => {
|
|
232
|
+
return (values) => {
|
|
235
233
|
'worklet';
|
|
236
234
|
return {
|
|
237
235
|
animations: {
|
|
238
236
|
transform: [
|
|
239
237
|
{
|
|
240
|
-
translateY: delayFunction(delay, withSequence(withTiming(-10, { duration: duration * 0.15 }), withTiming(10, { duration: duration * 0.15 }), withTiming(-20, { duration: duration * 0.15 }), withTiming(
|
|
238
|
+
translateY: delayFunction(delay, withSequence(withTiming(-10, { duration: duration * 0.15 }), withTiming(10, { duration: duration * 0.15 }), withTiming(-20, { duration: duration * 0.15 }), withTiming(values.windowHeight, {
|
|
241
239
|
duration: duration * 0.55,
|
|
242
240
|
}))),
|
|
243
241
|
},
|
|
@@ -269,13 +267,13 @@ export class BounceOutUp extends ComplexAnimationBuilder {
|
|
|
269
267
|
const duration = this.getDuration();
|
|
270
268
|
const callback = this.callbackV;
|
|
271
269
|
const initialValues = this.initialValues;
|
|
272
|
-
return () => {
|
|
270
|
+
return (values) => {
|
|
273
271
|
'worklet';
|
|
274
272
|
return {
|
|
275
273
|
animations: {
|
|
276
274
|
transform: [
|
|
277
275
|
{
|
|
278
|
-
translateY: delayFunction(delay, withSequence(withTiming(10, { duration: duration * 0.15 }), withTiming(-10, { duration: duration * 0.15 }), withTiming(20, { duration: duration * 0.15 }), withTiming(-
|
|
276
|
+
translateY: delayFunction(delay, withSequence(withTiming(10, { duration: duration * 0.15 }), withTiming(-10, { duration: duration * 0.15 }), withTiming(20, { duration: duration * 0.15 }), withTiming(-values.windowHeight, {
|
|
279
277
|
duration: duration * 0.55,
|
|
280
278
|
}))),
|
|
281
279
|
},
|
|
@@ -307,13 +305,13 @@ export class BounceOutLeft extends ComplexAnimationBuilder {
|
|
|
307
305
|
const duration = this.getDuration();
|
|
308
306
|
const callback = this.callbackV;
|
|
309
307
|
const initialValues = this.initialValues;
|
|
310
|
-
return () => {
|
|
308
|
+
return (values) => {
|
|
311
309
|
'worklet';
|
|
312
310
|
return {
|
|
313
311
|
animations: {
|
|
314
312
|
transform: [
|
|
315
313
|
{
|
|
316
|
-
translateX: delayFunction(delay, withSequence(withTiming(10, { duration: duration * 0.15 }), withTiming(-10, { duration: duration * 0.15 }), withTiming(20, { duration: duration * 0.15 }), withTiming(-
|
|
314
|
+
translateX: delayFunction(delay, withSequence(withTiming(10, { duration: duration * 0.15 }), withTiming(-10, { duration: duration * 0.15 }), withTiming(20, { duration: duration * 0.15 }), withTiming(-values.windowWidth, {
|
|
317
315
|
duration: duration * 0.55,
|
|
318
316
|
}))),
|
|
319
317
|
},
|
|
@@ -345,13 +343,13 @@ export class BounceOutRight extends ComplexAnimationBuilder {
|
|
|
345
343
|
const duration = this.getDuration();
|
|
346
344
|
const callback = this.callbackV;
|
|
347
345
|
const initialValues = this.initialValues;
|
|
348
|
-
return () => {
|
|
346
|
+
return (values) => {
|
|
349
347
|
'worklet';
|
|
350
348
|
return {
|
|
351
349
|
animations: {
|
|
352
350
|
transform: [
|
|
353
351
|
{
|
|
354
|
-
translateX: delayFunction(delay, withSequence(withTiming(-10, { duration: duration * 0.15 }), withTiming(10, { duration: duration * 0.15 }), withTiming(-20, { duration: duration * 0.15 }), withTiming(
|
|
352
|
+
translateX: delayFunction(delay, withSequence(withTiming(-10, { duration: duration * 0.15 }), withTiming(10, { duration: duration * 0.15 }), withTiming(-20, { duration: duration * 0.15 }), withTiming(values.windowWidth, {
|
|
355
353
|
duration: duration * 0.55,
|
|
356
354
|
}))),
|
|
357
355
|
},
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import { Dimensions } from 'react-native';
|
|
2
1
|
import { withSequence, withTiming } from '../../animation';
|
|
3
2
|
import { ComplexAnimationBuilder } from '../animationBuilder';
|
|
4
|
-
const { width } = Dimensions.get('window');
|
|
5
3
|
export class LightSpeedInRight extends ComplexAnimationBuilder {
|
|
6
4
|
constructor() {
|
|
7
5
|
super(...arguments);
|
|
@@ -12,7 +10,7 @@ export class LightSpeedInRight extends ComplexAnimationBuilder {
|
|
|
12
10
|
const duration = this.getDuration();
|
|
13
11
|
const callback = this.callbackV;
|
|
14
12
|
const initialValues = this.initialValues;
|
|
15
|
-
return () => {
|
|
13
|
+
return (values) => {
|
|
16
14
|
'worklet';
|
|
17
15
|
return {
|
|
18
16
|
animations: {
|
|
@@ -26,7 +24,7 @@ export class LightSpeedInRight extends ComplexAnimationBuilder {
|
|
|
26
24
|
},
|
|
27
25
|
],
|
|
28
26
|
},
|
|
29
|
-
initialValues: Object.assign({ opacity: 0, transform: [{ translateX:
|
|
27
|
+
initialValues: Object.assign({ opacity: 0, transform: [{ translateX: values.windowWidth }, { skewX: '-45deg' }] }, initialValues),
|
|
30
28
|
callback: callback,
|
|
31
29
|
};
|
|
32
30
|
};
|
|
@@ -46,7 +44,7 @@ export class LightSpeedInLeft extends ComplexAnimationBuilder {
|
|
|
46
44
|
const duration = this.getDuration();
|
|
47
45
|
const callback = this.callbackV;
|
|
48
46
|
const initialValues = this.initialValues;
|
|
49
|
-
return () => {
|
|
47
|
+
return (values) => {
|
|
50
48
|
'worklet';
|
|
51
49
|
return {
|
|
52
50
|
animations: {
|
|
@@ -60,7 +58,7 @@ export class LightSpeedInLeft extends ComplexAnimationBuilder {
|
|
|
60
58
|
},
|
|
61
59
|
],
|
|
62
60
|
},
|
|
63
|
-
initialValues: Object.assign({ opacity: 0, transform: [{ translateX: -
|
|
61
|
+
initialValues: Object.assign({ opacity: 0, transform: [{ translateX: -values.windowWidth }, { skewX: '45deg' }] }, initialValues),
|
|
64
62
|
callback: callback,
|
|
65
63
|
};
|
|
66
64
|
};
|
|
@@ -79,14 +77,14 @@ export class LightSpeedOutRight extends ComplexAnimationBuilder {
|
|
|
79
77
|
const delay = this.getDelay();
|
|
80
78
|
const callback = this.callbackV;
|
|
81
79
|
const initialValues = this.initialValues;
|
|
82
|
-
return () => {
|
|
80
|
+
return (values) => {
|
|
83
81
|
'worklet';
|
|
84
82
|
return {
|
|
85
83
|
animations: {
|
|
86
84
|
opacity: delayFunction(delay, animation(0, config)),
|
|
87
85
|
transform: [
|
|
88
86
|
{
|
|
89
|
-
translateX: delayFunction(delay, animation(
|
|
87
|
+
translateX: delayFunction(delay, animation(values.windowWidth, config)),
|
|
90
88
|
},
|
|
91
89
|
{
|
|
92
90
|
skewX: delayFunction(delay, animation('-45deg', config)),
|
|
@@ -112,14 +110,14 @@ export class LightSpeedOutLeft extends ComplexAnimationBuilder {
|
|
|
112
110
|
const delay = this.getDelay();
|
|
113
111
|
const callback = this.callbackV;
|
|
114
112
|
const initialValues = this.initialValues;
|
|
115
|
-
return () => {
|
|
113
|
+
return (values) => {
|
|
116
114
|
'worklet';
|
|
117
115
|
return {
|
|
118
116
|
animations: {
|
|
119
117
|
opacity: delayFunction(delay, animation(0, config)),
|
|
120
118
|
transform: [
|
|
121
119
|
{
|
|
122
|
-
translateX: delayFunction(delay, animation(-
|
|
120
|
+
translateX: delayFunction(delay, animation(-values.windowWidth, config)),
|
|
123
121
|
},
|
|
124
122
|
{
|
|
125
123
|
skewX: delayFunction(delay, animation('45deg', config)),
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import { Dimensions } from 'react-native';
|
|
2
1
|
import { ComplexAnimationBuilder } from '../animationBuilder';
|
|
3
|
-
const { width } = Dimensions.get('window');
|
|
4
2
|
export class RollInLeft extends ComplexAnimationBuilder {
|
|
5
3
|
constructor() {
|
|
6
4
|
super(...arguments);
|
|
@@ -10,7 +8,7 @@ export class RollInLeft extends ComplexAnimationBuilder {
|
|
|
10
8
|
const delay = this.getDelay();
|
|
11
9
|
const callback = this.callbackV;
|
|
12
10
|
const initialValues = this.initialValues;
|
|
13
|
-
return () => {
|
|
11
|
+
return (values) => {
|
|
14
12
|
'worklet';
|
|
15
13
|
return {
|
|
16
14
|
animations: {
|
|
@@ -19,7 +17,10 @@ export class RollInLeft extends ComplexAnimationBuilder {
|
|
|
19
17
|
{ rotate: delayFunction(delay, animation('0deg', config)) },
|
|
20
18
|
],
|
|
21
19
|
},
|
|
22
|
-
initialValues: Object.assign({ transform: [
|
|
20
|
+
initialValues: Object.assign({ transform: [
|
|
21
|
+
{ translateX: -values.windowWidth },
|
|
22
|
+
{ rotate: '-180deg' },
|
|
23
|
+
] }, initialValues),
|
|
23
24
|
callback: callback,
|
|
24
25
|
};
|
|
25
26
|
};
|
|
@@ -38,7 +39,7 @@ export class RollInRight extends ComplexAnimationBuilder {
|
|
|
38
39
|
const delay = this.getDelay();
|
|
39
40
|
const callback = this.callbackV;
|
|
40
41
|
const initialValues = this.initialValues;
|
|
41
|
-
return () => {
|
|
42
|
+
return (values) => {
|
|
42
43
|
'worklet';
|
|
43
44
|
return {
|
|
44
45
|
animations: {
|
|
@@ -47,7 +48,7 @@ export class RollInRight extends ComplexAnimationBuilder {
|
|
|
47
48
|
{ rotate: delayFunction(delay, animation('0deg', config)) },
|
|
48
49
|
],
|
|
49
50
|
},
|
|
50
|
-
initialValues: Object.assign({ transform: [{ translateX:
|
|
51
|
+
initialValues: Object.assign({ transform: [{ translateX: values.windowWidth }, { rotate: '180deg' }] }, initialValues),
|
|
51
52
|
callback: callback,
|
|
52
53
|
};
|
|
53
54
|
};
|
|
@@ -66,12 +67,14 @@ export class RollOutLeft extends ComplexAnimationBuilder {
|
|
|
66
67
|
const delay = this.getDelay();
|
|
67
68
|
const callback = this.callbackV;
|
|
68
69
|
const initialValues = this.initialValues;
|
|
69
|
-
return () => {
|
|
70
|
+
return (values) => {
|
|
70
71
|
'worklet';
|
|
71
72
|
return {
|
|
72
73
|
animations: {
|
|
73
74
|
transform: [
|
|
74
|
-
{
|
|
75
|
+
{
|
|
76
|
+
translateX: delayFunction(delay, animation(-values.windowWidth, config)),
|
|
77
|
+
},
|
|
75
78
|
{ rotate: delayFunction(delay, animation('-180deg', config)) },
|
|
76
79
|
],
|
|
77
80
|
},
|
|
@@ -94,12 +97,14 @@ export class RollOutRight extends ComplexAnimationBuilder {
|
|
|
94
97
|
const delay = this.getDelay();
|
|
95
98
|
const callback = this.callbackV;
|
|
96
99
|
const initialValues = this.initialValues;
|
|
97
|
-
return () => {
|
|
100
|
+
return (values) => {
|
|
98
101
|
'worklet';
|
|
99
102
|
return {
|
|
100
103
|
animations: {
|
|
101
104
|
transform: [
|
|
102
|
-
{
|
|
105
|
+
{
|
|
106
|
+
translateX: delayFunction(delay, animation(values.windowWidth, config)),
|
|
107
|
+
},
|
|
103
108
|
{ rotate: delayFunction(delay, animation('180deg', config)) },
|
|
104
109
|
],
|
|
105
110
|
},
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import { Dimensions } from 'react-native';
|
|
2
1
|
import { ComplexAnimationBuilder } from '../animationBuilder';
|
|
3
|
-
const { width, height } = Dimensions.get('window');
|
|
4
2
|
export class SlideInRight extends ComplexAnimationBuilder {
|
|
5
3
|
constructor() {
|
|
6
4
|
super(...arguments);
|
|
@@ -16,7 +14,7 @@ export class SlideInRight extends ComplexAnimationBuilder {
|
|
|
16
14
|
animations: {
|
|
17
15
|
originX: delayFunction(delay, animation(values.targetOriginX, config)),
|
|
18
16
|
},
|
|
19
|
-
initialValues: Object.assign({ originX: values.targetOriginX +
|
|
17
|
+
initialValues: Object.assign({ originX: values.targetOriginX + values.windowWidth }, initialValues),
|
|
20
18
|
callback: callback,
|
|
21
19
|
};
|
|
22
20
|
};
|
|
@@ -41,7 +39,7 @@ export class SlideInLeft extends ComplexAnimationBuilder {
|
|
|
41
39
|
animations: {
|
|
42
40
|
originX: delayFunction(delay, animation(values.targetOriginX, config)),
|
|
43
41
|
},
|
|
44
|
-
initialValues: Object.assign({ originX: values.targetOriginX -
|
|
42
|
+
initialValues: Object.assign({ originX: values.targetOriginX - values.windowWidth }, initialValues),
|
|
45
43
|
callback: callback,
|
|
46
44
|
};
|
|
47
45
|
};
|
|
@@ -64,7 +62,7 @@ export class SlideOutRight extends ComplexAnimationBuilder {
|
|
|
64
62
|
'worklet';
|
|
65
63
|
return {
|
|
66
64
|
animations: {
|
|
67
|
-
originX: delayFunction(delay, animation(Math.max(values.currentOriginX +
|
|
65
|
+
originX: delayFunction(delay, animation(Math.max(values.currentOriginX + values.windowWidth, values.windowWidth), config)),
|
|
68
66
|
},
|
|
69
67
|
initialValues: Object.assign({ originX: values.currentOriginX }, initialValues),
|
|
70
68
|
callback: callback,
|
|
@@ -89,7 +87,7 @@ export class SlideOutLeft extends ComplexAnimationBuilder {
|
|
|
89
87
|
'worklet';
|
|
90
88
|
return {
|
|
91
89
|
animations: {
|
|
92
|
-
originX: delayFunction(delay, animation(Math.min(values.currentOriginX -
|
|
90
|
+
originX: delayFunction(delay, animation(Math.min(values.currentOriginX - values.windowWidth, -values.windowWidth), config)),
|
|
93
91
|
},
|
|
94
92
|
initialValues: Object.assign({ originX: values.currentOriginX }, initialValues),
|
|
95
93
|
callback: callback,
|
|
@@ -116,7 +114,7 @@ export class SlideInUp extends ComplexAnimationBuilder {
|
|
|
116
114
|
animations: {
|
|
117
115
|
originY: delayFunction(delay, animation(values.targetOriginY, config)),
|
|
118
116
|
},
|
|
119
|
-
initialValues: Object.assign({ originY: -
|
|
117
|
+
initialValues: Object.assign({ originY: -values.windowHeight }, initialValues),
|
|
120
118
|
callback: callback,
|
|
121
119
|
};
|
|
122
120
|
};
|
|
@@ -141,7 +139,7 @@ export class SlideInDown extends ComplexAnimationBuilder {
|
|
|
141
139
|
animations: {
|
|
142
140
|
originY: delayFunction(delay, animation(values.targetOriginY, config)),
|
|
143
141
|
},
|
|
144
|
-
initialValues: Object.assign({ originY: values.targetOriginY +
|
|
142
|
+
initialValues: Object.assign({ originY: values.targetOriginY + values.windowHeight }, initialValues),
|
|
145
143
|
callback: callback,
|
|
146
144
|
};
|
|
147
145
|
};
|
|
@@ -164,7 +162,7 @@ export class SlideOutUp extends ComplexAnimationBuilder {
|
|
|
164
162
|
'worklet';
|
|
165
163
|
return {
|
|
166
164
|
animations: {
|
|
167
|
-
originY: delayFunction(delay, animation(Math.min(values.currentOriginY -
|
|
165
|
+
originY: delayFunction(delay, animation(Math.min(values.currentOriginY - values.windowHeight, -values.windowHeight), config)),
|
|
168
166
|
},
|
|
169
167
|
initialValues: Object.assign({ originY: values.currentOriginY }, initialValues),
|
|
170
168
|
callback: callback,
|
|
@@ -189,7 +187,7 @@ export class SlideOutDown extends ComplexAnimationBuilder {
|
|
|
189
187
|
'worklet';
|
|
190
188
|
return {
|
|
191
189
|
animations: {
|
|
192
|
-
originY: delayFunction(delay, animation(Math.max(values.currentOriginY +
|
|
190
|
+
originY: delayFunction(delay, animation(Math.max(values.currentOriginY + values.windowHeight, values.windowHeight), config)),
|
|
193
191
|
},
|
|
194
192
|
initialValues: Object.assign({ originY: values.currentOriginY }, initialValues),
|
|
195
193
|
callback: callback,
|