react-native-reanimated 2.14.4 → 2.16.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/Registries/EventHandlerRegistry.cpp +8 -2
- package/Common/cpp/Tools/SingleInstanceChecker.h +10 -2
- package/android/build.gradle +4 -4
- package/android/src/main/java/com/swmansion/reanimated/NodesManager.java +6 -7
- package/ios/REANodesManager.m +23 -4
- package/package.json +6 -3
- package/src/reanimated2/hook/useAnimatedReaction.ts +9 -5
- package/src/reanimated2/hook/useAnimatedStyle.ts +14 -3
- package/src/reanimated2/hook/useDerivedValue.ts +8 -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/dependencies-accessors/gc.properties +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/fileChanges/last-build.bin +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/7.5.1/gc.properties +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/cache.properties +0 -2
- package/android/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
- package/android/.gradle/file-system.probe +0 -0
- package/android/.gradle/vcs-1/gc.properties +0 -0
- 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/lib/Animated.js +0 -9
- package/lib/ConfigHelper.js +0 -145
- package/lib/ReanimatedEventEmitter.js +0 -3
- package/lib/ReanimatedModule.js +0 -2
- package/lib/ReanimatedModule.macos.js +0 -2
- package/lib/ReanimatedModule.native.js +0 -12
- package/lib/ReanimatedModule.windows.js +0 -2
- package/lib/ReanimatedModuleCompat.js +0 -66
- package/lib/__mocks__/ReanimatedEventEmitter.js +0 -8
- package/lib/__mocks__/ReanimatedModule.native.js +0 -11
- package/lib/createAnimatedComponent.js +0 -518
- package/lib/index.js +0 -14
- package/lib/index.web.js +0 -6
- package/lib/reanimated1/Easing.js +0 -231
- package/lib/reanimated1/SpringConfig.js +0 -79
- package/lib/reanimated1/Transitioning.js +0 -158
- package/lib/reanimated1/animations/Animation.js +0 -32
- package/lib/reanimated1/animations/SpringUtils.js +0 -199
- package/lib/reanimated1/animations/backwardCompatibleAnimWrapper.js +0 -117
- package/lib/reanimated1/animations/decay.js +0 -54
- package/lib/reanimated1/animations/spring.js +0 -198
- package/lib/reanimated1/animations/timing.js +0 -74
- package/lib/reanimated1/base.js +0 -13
- package/lib/reanimated1/core/AnimatedAlways.js +0 -33
- package/lib/reanimated1/core/AnimatedBezier.js +0 -150
- package/lib/reanimated1/core/AnimatedBlock.js +0 -52
- package/lib/reanimated1/core/AnimatedCall.js +0 -55
- package/lib/reanimated1/core/AnimatedCallFunc.js +0 -72
- package/lib/reanimated1/core/AnimatedClock.js +0 -90
- package/lib/reanimated1/core/AnimatedClockTest.js +0 -22
- package/lib/reanimated1/core/AnimatedCode.js +0 -32
- package/lib/reanimated1/core/AnimatedConcat.js +0 -32
- package/lib/reanimated1/core/AnimatedCond.js +0 -57
- package/lib/reanimated1/core/AnimatedDebug.js +0 -62
- package/lib/reanimated1/core/AnimatedEvent.js +0 -126
- package/lib/reanimated1/core/AnimatedFunction.js +0 -55
- package/lib/reanimated1/core/AnimatedNode.js +0 -223
- package/lib/reanimated1/core/AnimatedOperator.js +0 -103
- package/lib/reanimated1/core/AnimatedParam.js +0 -88
- package/lib/reanimated1/core/AnimatedProps.js +0 -108
- package/lib/reanimated1/core/AnimatedSet.js +0 -38
- package/lib/reanimated1/core/AnimatedStartClock.js +0 -30
- package/lib/reanimated1/core/AnimatedStopClock.js +0 -30
- package/lib/reanimated1/core/AnimatedStyle.js +0 -78
- package/lib/reanimated1/core/AnimatedTransform.js +0 -78
- package/lib/reanimated1/core/AnimatedValue.js +0 -38
- package/lib/reanimated1/core/Core.test.js +0 -30
- package/lib/reanimated1/core/InternalAnimatedValue.js +0 -87
- package/lib/reanimated1/core/__mocks__/AnimatedProps.js +0 -86
- package/lib/reanimated1/core/createEventObjectProxyPolyfill.js +0 -44
- package/lib/reanimated1/derived/__mocks__/evaluateOnce.js +0 -14
- package/lib/reanimated1/derived/acc.js +0 -11
- package/lib/reanimated1/derived/color.js +0 -47
- package/lib/reanimated1/derived/diff.js +0 -16
- package/lib/reanimated1/derived/diffClamp.js +0 -11
- package/lib/reanimated1/derived/evaluateOnce.js +0 -35
- package/lib/reanimated1/derived/index.js +0 -8
- package/lib/reanimated1/derived/interpolate.js +0 -152
- package/lib/reanimated1/derived/interpolateColors.js +0 -62
- package/lib/reanimated1/derived/onChange.js +0 -14
- package/lib/reanimated1/derived/useCode.js +0 -41
- package/lib/reanimated1/index.js +0 -53
- package/lib/reanimated1/operators.js +0 -35
- package/lib/reanimated1/useValue.js +0 -10
- package/lib/reanimated1/val.js +0 -3
- package/lib/reanimated2/Bezier.js +0 -126
- package/lib/reanimated2/Colors.js +0 -538
- package/lib/reanimated2/Easing.js +0 -248
- package/lib/reanimated2/NativeMethods.js +0 -94
- package/lib/reanimated2/NativeReanimated/NativeReanimated.js +0 -60
- package/lib/reanimated2/NativeReanimated/index.js +0 -11
- package/lib/reanimated2/PlatformChecker.js +0 -16
- package/lib/reanimated2/PropAdapters.js +0 -55
- package/lib/reanimated2/UpdateProps.js +0 -55
- package/lib/reanimated2/ViewDescriptorsSet.js +0 -75
- package/lib/reanimated2/WorkletEventHandler.js +0 -37
- package/lib/reanimated2/__mocks__/MutableValue.js +0 -13
- package/lib/reanimated2/__mocks__/NativeReanimated.js +0 -20
- package/lib/reanimated2/animation/commonTypes.js +0 -1
- package/lib/reanimated2/animation/decay.js +0 -71
- package/lib/reanimated2/animation/delay.js +0 -64
- package/lib/reanimated2/animation/index.js +0 -8
- package/lib/reanimated2/animation/repeat.js +0 -69
- package/lib/reanimated2/animation/sequence.js +0 -69
- package/lib/reanimated2/animation/spring.js +0 -103
- package/lib/reanimated2/animation/styleAnimation.js +0 -174
- package/lib/reanimated2/animation/timing.js +0 -64
- package/lib/reanimated2/animation/util.js +0 -183
- package/lib/reanimated2/commonTypes.js +0 -8
- package/lib/reanimated2/component/FlatList.js +0 -30
- package/lib/reanimated2/component/Image.js +0 -4
- package/lib/reanimated2/component/ScrollView.js +0 -4
- package/lib/reanimated2/component/Text.js +0 -4
- package/lib/reanimated2/component/View.js +0 -4
- package/lib/reanimated2/core.js +0 -269
- package/lib/reanimated2/frameCallback/FrameCallbackRegistryJS.js +0 -32
- package/lib/reanimated2/frameCallback/FrameCallbackRegistryUI.js +0 -76
- package/lib/reanimated2/globals.d.ts +0 -91
- package/lib/reanimated2/hook/Hooks.js +0 -9
- package/lib/reanimated2/hook/commonTypes.js +0 -1
- package/lib/reanimated2/hook/index.js +0 -12
- package/lib/reanimated2/hook/useAnimatedGestureHandler.js +0 -49
- package/lib/reanimated2/hook/useAnimatedKeyboard.js +0 -31
- package/lib/reanimated2/hook/useAnimatedReaction.js +0 -37
- package/lib/reanimated2/hook/useAnimatedRef.js +0 -25
- package/lib/reanimated2/hook/useAnimatedScrollHandler.js +0 -41
- package/lib/reanimated2/hook/useAnimatedSensor.js +0 -66
- package/lib/reanimated2/hook/useAnimatedStyle.js +0 -393
- package/lib/reanimated2/hook/useDerivedValue.js +0 -36
- package/lib/reanimated2/hook/useFrameCallback.js +0 -23
- package/lib/reanimated2/hook/useScrollViewOffset.js +0 -27
- package/lib/reanimated2/hook/useSharedValue.js +0 -17
- package/lib/reanimated2/hook/utils.js +0 -165
- package/lib/reanimated2/index.js +0 -12
- package/lib/reanimated2/interpolateColor.js +0 -157
- package/lib/reanimated2/interpolation.js +0 -127
- package/lib/reanimated2/jestUtils.js +0 -175
- package/lib/reanimated2/js-reanimated/JSReanimated.js +0 -106
- package/lib/reanimated2/js-reanimated/Mapper.js +0 -43
- package/lib/reanimated2/js-reanimated/MapperRegistry.js +0 -101
- package/lib/reanimated2/js-reanimated/MutableValue.js +0 -29
- package/lib/reanimated2/js-reanimated/commonTypes.js +0 -1
- package/lib/reanimated2/js-reanimated/global.js +0 -36
- package/lib/reanimated2/js-reanimated/index.js +0 -35
- package/lib/reanimated2/layoutReanimation/LayoutAnimationRepository.js +0 -67
- package/lib/reanimated2/layoutReanimation/animationBuilder/BaseAnimationBuilder.js +0 -69
- package/lib/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.js +0 -133
- package/lib/reanimated2/layoutReanimation/animationBuilder/Keyframe.js +0 -194
- package/lib/reanimated2/layoutReanimation/animationBuilder/commonTypes.js +0 -1
- package/lib/reanimated2/layoutReanimation/animationBuilder/index.js +0 -3
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Bounce.js +0 -374
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Default.js +0 -36
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Fade.js +0 -275
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Flip.js +0 -385
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js +0 -136
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.js +0 -81
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Roll.js +0 -120
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Rotate.js +0 -273
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Slide.js +0 -201
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Stretch.js +0 -101
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Zoom.js +0 -457
- package/lib/reanimated2/layoutReanimation/defaultAnimations/index.js +0 -10
- package/lib/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.js +0 -90
- package/lib/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.js +0 -132
- package/lib/reanimated2/layoutReanimation/defaultTransitions/FadingTransition.js +0 -37
- package/lib/reanimated2/layoutReanimation/defaultTransitions/JumpingTransition.js +0 -41
- package/lib/reanimated2/layoutReanimation/defaultTransitions/LinearTransition.js +0 -34
- package/lib/reanimated2/layoutReanimation/defaultTransitions/SequencedTransition.js +0 -46
- package/lib/reanimated2/layoutReanimation/defaultTransitions/index.js +0 -6
- package/lib/reanimated2/layoutReanimation/index.js +0 -4
- package/lib/reanimated2/mock.js +0 -75
- package/lib/reanimated2/platform-specific/RNRenderer.js +0 -3
- package/lib/reanimated2/platform-specific/RNRenderer.web.js +0 -3
- package/lib/reanimated2/platform-specific/checkVersion.js +0 -28
- package/lib/reanimated2/platform-specific/checkVersion.web.js +0 -6
- package/lib/reanimated2/utils.js +0 -16
- package/lib/setAndForwardRef.js +0 -19
- package/lib/types/lib/Animated.d.ts +0 -8
- package/lib/types/lib/ConfigHelper.d.ts +0 -12
- package/lib/types/lib/ReanimatedEventEmitter.d.ts +0 -3
- package/lib/types/lib/ReanimatedModule.d.ts +0 -2
- package/lib/types/lib/ReanimatedModule.macos.d.ts +0 -2
- package/lib/types/lib/ReanimatedModule.native.d.ts +0 -2
- package/lib/types/lib/ReanimatedModule.windows.d.ts +0 -2
- package/lib/types/lib/ReanimatedModuleCompat.d.ts +0 -14
- package/lib/types/lib/createAnimatedComponent.d.ts +0 -33
- package/lib/types/lib/index.d.ts +0 -4
- package/lib/types/lib/index.web.d.ts +0 -4
- package/lib/types/lib/reanimated2/Bezier.d.ts +0 -6
- package/lib/types/lib/reanimated2/Colors.d.ts +0 -33
- package/lib/types/lib/reanimated2/Easing.d.ts +0 -172
- package/lib/types/lib/reanimated2/NativeMethods.d.ts +0 -7
- package/lib/types/lib/reanimated2/NativeReanimated/NativeReanimated.d.ts +0 -22
- package/lib/types/lib/reanimated2/NativeReanimated/index.d.ts +0 -3
- package/lib/types/lib/reanimated2/PlatformChecker.d.ts +0 -5
- package/lib/types/lib/reanimated2/PropAdapters.d.ts +0 -4
- package/lib/types/lib/reanimated2/UpdateProps.d.ts +0 -9
- package/lib/types/lib/reanimated2/ViewDescriptorsSet.d.ts +0 -20
- package/lib/types/lib/reanimated2/WorkletEventHandler.d.ts +0 -13
- package/lib/types/lib/reanimated2/__mocks__/MutableValue.d.ts +0 -5
- package/lib/types/lib/reanimated2/__mocks__/NativeReanimated.d.ts +0 -13
- package/lib/types/lib/reanimated2/animation/commonTypes.d.ts +0 -27
- package/lib/types/lib/reanimated2/animation/decay.d.ts +0 -19
- package/lib/types/lib/reanimated2/animation/delay.d.ts +0 -7
- package/lib/types/lib/reanimated2/animation/index.d.ts +0 -9
- package/lib/types/lib/reanimated2/animation/repeat.d.ts +0 -12
- package/lib/types/lib/reanimated2/animation/sequence.d.ts +0 -7
- package/lib/types/lib/reanimated2/animation/spring.d.ts +0 -22
- package/lib/types/lib/reanimated2/animation/styleAnimation.d.ts +0 -7
- package/lib/types/lib/reanimated2/animation/timing.d.ts +0 -21
- package/lib/types/lib/reanimated2/animation/util.d.ts +0 -9
- package/lib/types/lib/reanimated2/commonTypes.d.ts +0 -99
- package/lib/types/lib/reanimated2/component/FlatList.d.ts +0 -9
- package/lib/types/lib/reanimated2/component/Image.d.ts +0 -3
- package/lib/types/lib/reanimated2/component/ScrollView.d.ts +0 -3
- package/lib/types/lib/reanimated2/component/Text.d.ts +0 -3
- package/lib/types/lib/reanimated2/component/View.d.ts +0 -3
- package/lib/types/lib/reanimated2/core.d.ts +0 -24
- package/lib/types/lib/reanimated2/frameCallback/FrameCallbackRegistryJS.d.ts +0 -8
- package/lib/types/lib/reanimated2/frameCallback/FrameCallbackRegistryUI.d.ts +0 -20
- package/lib/types/lib/reanimated2/hook/Hooks.d.ts +0 -5
- package/lib/types/lib/reanimated2/hook/commonTypes.d.ts +0 -14
- package/lib/types/lib/reanimated2/hook/index.d.ts +0 -14
- package/lib/types/lib/reanimated2/hook/useAnimatedGestureHandler.d.ts +0 -35
- package/lib/types/lib/reanimated2/hook/useAnimatedKeyboard.d.ts +0 -2
- package/lib/types/lib/reanimated2/hook/useAnimatedReaction.d.ts +0 -12
- package/lib/types/lib/reanimated2/hook/useAnimatedRef.d.ts +0 -3
- package/lib/types/lib/reanimated2/hook/useAnimatedScrollHandler.d.ts +0 -20
- package/lib/types/lib/reanimated2/hook/useAnimatedSensor.d.ts +0 -18
- package/lib/types/lib/reanimated2/hook/useAnimatedStyle.d.ts +0 -11
- package/lib/types/lib/reanimated2/hook/useDerivedValue.d.ts +0 -4
- package/lib/types/lib/reanimated2/hook/useFrameCallback.d.ts +0 -7
- package/lib/types/lib/reanimated2/hook/useScrollViewOffset.d.ts +0 -4
- package/lib/types/lib/reanimated2/hook/useSharedValue.d.ts +0 -2
- package/lib/types/lib/reanimated2/hook/utils.d.ts +0 -28
- package/lib/types/lib/reanimated2/index.d.ts +0 -12
- package/lib/types/lib/reanimated2/interpolateColor.d.ts +0 -32
- package/lib/types/lib/reanimated2/interpolation.d.ts +0 -14
- package/lib/types/lib/reanimated2/jestUtils.d.ts +0 -12
- package/lib/types/lib/reanimated2/js-reanimated/JSReanimated.d.ts +0 -32
- package/lib/types/lib/reanimated2/js-reanimated/Mapper.d.ts +0 -14
- package/lib/types/lib/reanimated2/js-reanimated/MapperRegistry.d.ts +0 -14
- package/lib/types/lib/reanimated2/js-reanimated/MutableValue.d.ts +0 -14
- package/lib/types/lib/reanimated2/js-reanimated/commonTypes.d.ts +0 -44
- package/lib/types/lib/reanimated2/js-reanimated/global.d.ts +0 -2
- package/lib/types/lib/reanimated2/js-reanimated/index.d.ts +0 -15
- package/lib/types/lib/reanimated2/layoutReanimation/LayoutAnimationRepository.d.ts +0 -1
- package/lib/types/lib/reanimated2/layoutReanimation/animationBuilder/BaseAnimationBuilder.d.ts +0 -22
- package/lib/types/lib/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.d.ts +0 -38
- package/lib/types/lib/reanimated2/layoutReanimation/animationBuilder/Keyframe.d.ts +0 -25
- package/lib/types/lib/reanimated2/layoutReanimation/animationBuilder/commonTypes.d.ts +0 -81
- package/lib/types/lib/reanimated2/layoutReanimation/animationBuilder/index.d.ts +0 -4
- package/lib/types/lib/reanimated2/layoutReanimation/defaultAnimations/Bounce.d.ts +0 -62
- package/lib/types/lib/reanimated2/layoutReanimation/defaultAnimations/Default.d.ts +0 -4
- package/lib/types/lib/reanimated2/layoutReanimation/defaultAnimations/Fade.d.ts +0 -42
- package/lib/types/lib/reanimated2/layoutReanimation/defaultAnimations/Flip.d.ts +0 -50
- package/lib/types/lib/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.d.ts +0 -18
- package/lib/types/lib/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.d.ts +0 -10
- package/lib/types/lib/reanimated2/layoutReanimation/defaultAnimations/Roll.d.ts +0 -18
- package/lib/types/lib/reanimated2/layoutReanimation/defaultAnimations/Rotate.d.ts +0 -34
- package/lib/types/lib/reanimated2/layoutReanimation/defaultAnimations/Slide.d.ts +0 -34
- package/lib/types/lib/reanimated2/layoutReanimation/defaultAnimations/Stretch.d.ts +0 -18
- package/lib/types/lib/reanimated2/layoutReanimation/defaultAnimations/Zoom.d.ts +0 -66
- package/lib/types/lib/reanimated2/layoutReanimation/defaultAnimations/index.d.ts +0 -10
- package/lib/types/lib/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.d.ts +0 -19
- package/lib/types/lib/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.d.ts +0 -13
- package/lib/types/lib/reanimated2/layoutReanimation/defaultTransitions/FadingTransition.d.ts +0 -6
- package/lib/types/lib/reanimated2/layoutReanimation/defaultTransitions/JumpingTransition.d.ts +0 -6
- package/lib/types/lib/reanimated2/layoutReanimation/defaultTransitions/LinearTransition.d.ts +0 -7
- package/lib/types/lib/reanimated2/layoutReanimation/defaultTransitions/SequencedTransition.d.ts +0 -9
- package/lib/types/lib/reanimated2/layoutReanimation/defaultTransitions/index.d.ts +0 -6
- package/lib/types/lib/reanimated2/layoutReanimation/index.d.ts +0 -4
- package/lib/types/lib/reanimated2/mock.d.ts +0 -61
- package/lib/types/lib/reanimated2/platform-specific/RNRenderer.d.ts +0 -1
- package/lib/types/lib/reanimated2/platform-specific/RNRenderer.web.d.ts +0 -0
- package/lib/types/lib/reanimated2/platform-specific/checkVersion.d.ts +0 -4
- package/lib/types/lib/reanimated2/platform-specific/checkVersion.web.d.ts +0 -5
- package/lib/types/lib/reanimated2/utils.d.ts +0 -11
- package/lib/types/lib/setAndForwardRef.d.ts +0 -40
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
export default class MapperRegistry {
|
|
2
|
-
constructor(module) {
|
|
3
|
-
this.sortedMappers = [];
|
|
4
|
-
this.mappers = new Map();
|
|
5
|
-
this.updatedSinceLastExecute = false;
|
|
6
|
-
this._module = module;
|
|
7
|
-
}
|
|
8
|
-
startMapper(mapper) {
|
|
9
|
-
this.mappers.set(mapper.id, mapper);
|
|
10
|
-
this.updatedSinceLastExecute = true;
|
|
11
|
-
return mapper.id;
|
|
12
|
-
}
|
|
13
|
-
stopMapper(id) {
|
|
14
|
-
this.mappers.delete(id);
|
|
15
|
-
this.updatedSinceLastExecute = true;
|
|
16
|
-
}
|
|
17
|
-
execute() {
|
|
18
|
-
if (this.updatedSinceLastExecute) {
|
|
19
|
-
this.updateOrder();
|
|
20
|
-
this.updatedSinceLastExecute = false;
|
|
21
|
-
}
|
|
22
|
-
for (let i = 0, len = this.sortedMappers.length; i < len; ++i) {
|
|
23
|
-
const mapper = this.sortedMappers[i];
|
|
24
|
-
if (mapper.dirty) {
|
|
25
|
-
mapper.execute();
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
updateOrder() {
|
|
30
|
-
const nodes = [...this.mappers.values()].map((mapper) => new Node(mapper));
|
|
31
|
-
const mappersById = {};
|
|
32
|
-
this.mappers.forEach((mapper) => {
|
|
33
|
-
mappersById[mapper.id] = mapper;
|
|
34
|
-
});
|
|
35
|
-
// create a graph from array of nodes
|
|
36
|
-
for (let i = 0, nodesLen = nodes.length; i < nodesLen; ++i) {
|
|
37
|
-
const node = nodes[i];
|
|
38
|
-
if (node.mapper.outputs.length === 0) {
|
|
39
|
-
continue;
|
|
40
|
-
}
|
|
41
|
-
for (let j = 0; j < nodesLen; ++j) {
|
|
42
|
-
const restNode = nodes[j];
|
|
43
|
-
if (i === j || restNode.mapper.inputs.length === 0) {
|
|
44
|
-
continue;
|
|
45
|
-
}
|
|
46
|
-
for (let outi = 0, outputsLen = node.mapper.outputs.length; outi < outputsLen; ++outi) {
|
|
47
|
-
for (let resti = 0, restLen = restNode.mapper.inputs.length; resti < restLen; ++resti) {
|
|
48
|
-
if (node.mapper.outputs[outi]._id ===
|
|
49
|
-
restNode.mapper.inputs[resti]._id) {
|
|
50
|
-
node.children.push(restNode);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
const post = {};
|
|
57
|
-
let postCounter = 1;
|
|
58
|
-
const dfs = (node) => {
|
|
59
|
-
const index = nodes.indexOf(node);
|
|
60
|
-
if (index === -1) {
|
|
61
|
-
// this node has already been handled
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
++postCounter;
|
|
65
|
-
nodes.splice(index, 1);
|
|
66
|
-
if (node.children.length === 0 && nodes.length > 0) {
|
|
67
|
-
post[node.mapper.id] = postCounter++;
|
|
68
|
-
dfs(nodes[0]);
|
|
69
|
-
return;
|
|
70
|
-
}
|
|
71
|
-
for (let i = 0, len = node.children.length; i < len; ++i) {
|
|
72
|
-
dfs(node.children[i]);
|
|
73
|
-
}
|
|
74
|
-
post[node.mapper.id] = postCounter++;
|
|
75
|
-
};
|
|
76
|
-
while (nodes.length)
|
|
77
|
-
dfs(nodes[0]);
|
|
78
|
-
const postArray = Object.keys(post).map((key) => {
|
|
79
|
-
const num = parseInt(key);
|
|
80
|
-
return [num, post[num]];
|
|
81
|
-
});
|
|
82
|
-
postArray.sort((a, b) => {
|
|
83
|
-
return b[1] - a[1];
|
|
84
|
-
});
|
|
85
|
-
// clear sorted mappers
|
|
86
|
-
this.sortedMappers = [];
|
|
87
|
-
for (let i = 0, len = postArray.length; i < len; ++i) {
|
|
88
|
-
const [id] = postArray[i];
|
|
89
|
-
this.sortedMappers.push(mappersById[id]);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
get needRunOnRender() {
|
|
93
|
-
return this.updatedSinceLastExecute;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
class Node {
|
|
97
|
-
constructor(mapper, children = []) {
|
|
98
|
-
this.mapper = mapper;
|
|
99
|
-
this.children = children;
|
|
100
|
-
}
|
|
101
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
export default class MutableValue {
|
|
2
|
-
constructor(value, setter) {
|
|
3
|
-
this._animation = null;
|
|
4
|
-
this._listeners = [];
|
|
5
|
-
this._id = MutableValue.MUTABLE_ID++;
|
|
6
|
-
this._value = value;
|
|
7
|
-
this._setter = setter;
|
|
8
|
-
}
|
|
9
|
-
get value() {
|
|
10
|
-
return this._value;
|
|
11
|
-
}
|
|
12
|
-
set value(nextValue) {
|
|
13
|
-
this._setter(nextValue);
|
|
14
|
-
}
|
|
15
|
-
// this changes the value finally and is supposed to be called from this._setter
|
|
16
|
-
_setValue(newValue) {
|
|
17
|
-
this._value = newValue;
|
|
18
|
-
this._triggerListener();
|
|
19
|
-
}
|
|
20
|
-
addListener(listener) {
|
|
21
|
-
this._listeners.push(listener);
|
|
22
|
-
}
|
|
23
|
-
_triggerListener() {
|
|
24
|
-
for (let i = 0, len = this._listeners.length; i < len; ++i) {
|
|
25
|
-
this._listeners[i]();
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
MutableValue.MUTABLE_ID = 1;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
// In order to keep bundle size down, we treat this file as a polyfill for Web.
|
|
2
|
-
import { shouldBeUseWeb } from '../PlatformChecker';
|
|
3
|
-
const initializeGlobalsForWeb = () => {
|
|
4
|
-
if (shouldBeUseWeb()) {
|
|
5
|
-
global._frameTimestamp = null;
|
|
6
|
-
global._setGlobalConsole = (_val) => {
|
|
7
|
-
// noop
|
|
8
|
-
};
|
|
9
|
-
global._measure = () => {
|
|
10
|
-
console.warn("[Reanimated] You can't use `measure` with Chrome Debugger or with web version");
|
|
11
|
-
return {
|
|
12
|
-
x: 0,
|
|
13
|
-
y: 0,
|
|
14
|
-
width: 0,
|
|
15
|
-
height: 0,
|
|
16
|
-
pageX: 0,
|
|
17
|
-
pageY: 0,
|
|
18
|
-
};
|
|
19
|
-
};
|
|
20
|
-
global._scrollTo = () => {
|
|
21
|
-
console.warn("[Reanimated] You can't use `scrollTo` with Chrome Debugger or with web version");
|
|
22
|
-
};
|
|
23
|
-
global._setGestureState = () => {
|
|
24
|
-
console.warn("[Reanimated] You can't use `setGestureState` with Chrome Debugger or with web version");
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
return true;
|
|
28
|
-
};
|
|
29
|
-
/*
|
|
30
|
-
If a file doesn't export anything, tree shaking doesn't pack
|
|
31
|
-
it into the JS bundle. In effect, the code inside of this file
|
|
32
|
-
will never execute. That is why we wrapped initialization code
|
|
33
|
-
into a function, and we call this one during creating
|
|
34
|
-
the module export object.
|
|
35
|
-
*/
|
|
36
|
-
export default initializeGlobalsForWeb();
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import JSReanimated from './JSReanimated';
|
|
2
|
-
const reanimatedJS = new JSReanimated();
|
|
3
|
-
export const _updatePropsJS = (updates, viewRef) => {
|
|
4
|
-
if (viewRef._component) {
|
|
5
|
-
const component = viewRef._component;
|
|
6
|
-
const [rawStyles] = Object.keys(updates).reduce((acc, key) => {
|
|
7
|
-
const value = updates[key];
|
|
8
|
-
const index = typeof value === 'function' ? 1 : 0;
|
|
9
|
-
acc[index][key] = value;
|
|
10
|
-
return acc;
|
|
11
|
-
}, [{}, {}]);
|
|
12
|
-
if (typeof component.setNativeProps === 'function') {
|
|
13
|
-
setNativeProps(component, rawStyles);
|
|
14
|
-
}
|
|
15
|
-
else if (Object.keys(component.props).length > 0) {
|
|
16
|
-
Object.keys(component.props).forEach((key) => {
|
|
17
|
-
if (!rawStyles[key]) {
|
|
18
|
-
return;
|
|
19
|
-
}
|
|
20
|
-
const dashedKey = key.replace(/[A-Z]/g, (m) => '-' + m.toLowerCase());
|
|
21
|
-
component._touchableNode.setAttribute(dashedKey, rawStyles[key]);
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
else {
|
|
25
|
-
console.warn('It is not possible to manipulate component');
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
const setNativeProps = (component, style) => {
|
|
30
|
-
const previousStyle = component.previousStyle ? component.previousStyle : {};
|
|
31
|
-
const currentStyle = Object.assign(Object.assign({}, previousStyle), style);
|
|
32
|
-
component.previousStyle = currentStyle;
|
|
33
|
-
component.setNativeProps({ style: currentStyle });
|
|
34
|
-
};
|
|
35
|
-
export default reanimatedJS;
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
/* global _stopObservingProgress, _startObservingProgress */
|
|
2
|
-
import { runOnUI } from '../core';
|
|
3
|
-
import { withStyleAnimation } from '../animation/styleAnimation';
|
|
4
|
-
import { ColorProperties } from '../UpdateProps';
|
|
5
|
-
import { processColor } from '../Colors';
|
|
6
|
-
runOnUI(() => {
|
|
7
|
-
'worklet';
|
|
8
|
-
const configs = Object.create(null);
|
|
9
|
-
const enteringAnimationForTag = {};
|
|
10
|
-
global.LayoutAnimationRepository = {
|
|
11
|
-
configs,
|
|
12
|
-
registerConfig(tag, config) {
|
|
13
|
-
configs[tag] = config;
|
|
14
|
-
enteringAnimationForTag[tag] = null;
|
|
15
|
-
},
|
|
16
|
-
removeConfig(tag) {
|
|
17
|
-
delete configs[tag];
|
|
18
|
-
delete enteringAnimationForTag[tag];
|
|
19
|
-
},
|
|
20
|
-
startAnimationForTag(tag, type, yogaValues) {
|
|
21
|
-
if (configs[tag] == null) {
|
|
22
|
-
return; // :(
|
|
23
|
-
}
|
|
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
|
-
}
|
|
40
|
-
const sv = configs[tag].sv;
|
|
41
|
-
_stopObservingProgress(tag, false);
|
|
42
|
-
_startObservingProgress(tag, sv);
|
|
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);
|
|
52
|
-
_stopObservingProgress(tag, false);
|
|
53
|
-
const animation = withStyleAnimation(currentAnimation);
|
|
54
|
-
animation.callback = (finished) => {
|
|
55
|
-
if (finished) {
|
|
56
|
-
_stopObservingProgress(tag, finished);
|
|
57
|
-
}
|
|
58
|
-
style.callback && style.callback(finished);
|
|
59
|
-
};
|
|
60
|
-
if (backupColor) {
|
|
61
|
-
configs[tag].sv._value = Object.assign(Object.assign({}, configs[tag].sv.value), backupColor);
|
|
62
|
-
}
|
|
63
|
-
configs[tag].sv.value = animation;
|
|
64
|
-
_startObservingProgress(tag, sv);
|
|
65
|
-
},
|
|
66
|
-
};
|
|
67
|
-
})();
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { withDelay } from '../../animation';
|
|
2
|
-
export class BaseAnimationBuilder {
|
|
3
|
-
constructor() {
|
|
4
|
-
this.randomizeDelay = false;
|
|
5
|
-
this.build = () => {
|
|
6
|
-
throw Error('Unimplemented method in child class.');
|
|
7
|
-
};
|
|
8
|
-
}
|
|
9
|
-
static duration(durationMs) {
|
|
10
|
-
const instance = this.createInstance();
|
|
11
|
-
return instance.duration(durationMs);
|
|
12
|
-
}
|
|
13
|
-
duration(durationMs) {
|
|
14
|
-
this.durationV = durationMs;
|
|
15
|
-
return this;
|
|
16
|
-
}
|
|
17
|
-
static delay(delayMs) {
|
|
18
|
-
const instance = this.createInstance();
|
|
19
|
-
return instance.delay(delayMs);
|
|
20
|
-
}
|
|
21
|
-
delay(delayMs) {
|
|
22
|
-
this.delayV = delayMs;
|
|
23
|
-
return this;
|
|
24
|
-
}
|
|
25
|
-
static withCallback(callback) {
|
|
26
|
-
const instance = this.createInstance();
|
|
27
|
-
return instance.withCallback(callback);
|
|
28
|
-
}
|
|
29
|
-
withCallback(callback) {
|
|
30
|
-
this.callbackV = callback;
|
|
31
|
-
return this;
|
|
32
|
-
}
|
|
33
|
-
// 300ms is the default animation duration. If any animation has different default has to override this method.
|
|
34
|
-
static getDuration() {
|
|
35
|
-
return 300;
|
|
36
|
-
}
|
|
37
|
-
getDuration() {
|
|
38
|
-
var _a;
|
|
39
|
-
return (_a = this.durationV) !== null && _a !== void 0 ? _a : 300;
|
|
40
|
-
}
|
|
41
|
-
static randomDelay() {
|
|
42
|
-
const instance = this.createInstance();
|
|
43
|
-
return instance.randomDelay();
|
|
44
|
-
}
|
|
45
|
-
randomDelay() {
|
|
46
|
-
this.randomizeDelay = true;
|
|
47
|
-
return this;
|
|
48
|
-
}
|
|
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;
|
|
55
|
-
}
|
|
56
|
-
getDelayFunction() {
|
|
57
|
-
const isDelayProvided = this.randomizeDelay || this.delayV;
|
|
58
|
-
return isDelayProvided
|
|
59
|
-
? withDelay
|
|
60
|
-
: (_, animation) => {
|
|
61
|
-
'worklet';
|
|
62
|
-
return animation;
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
static build() {
|
|
66
|
-
const instance = this.createInstance();
|
|
67
|
-
return instance.build();
|
|
68
|
-
}
|
|
69
|
-
}
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
import { withTiming, withSpring } from '../../animation';
|
|
2
|
-
import { BaseAnimationBuilder } from './BaseAnimationBuilder';
|
|
3
|
-
export class ComplexAnimationBuilder extends BaseAnimationBuilder {
|
|
4
|
-
static easing(easingFunction) {
|
|
5
|
-
const instance = this.createInstance();
|
|
6
|
-
return instance.easing(easingFunction);
|
|
7
|
-
}
|
|
8
|
-
easing(easingFunction) {
|
|
9
|
-
this.easingV = easingFunction;
|
|
10
|
-
return this;
|
|
11
|
-
}
|
|
12
|
-
static rotate(degree) {
|
|
13
|
-
const instance = this.createInstance();
|
|
14
|
-
return instance.rotate(degree);
|
|
15
|
-
}
|
|
16
|
-
rotate(degree) {
|
|
17
|
-
this.rotateV = degree;
|
|
18
|
-
return this;
|
|
19
|
-
}
|
|
20
|
-
static springify() {
|
|
21
|
-
const instance = this.createInstance();
|
|
22
|
-
return instance.springify();
|
|
23
|
-
}
|
|
24
|
-
springify() {
|
|
25
|
-
this.type = withSpring;
|
|
26
|
-
return this;
|
|
27
|
-
}
|
|
28
|
-
static damping(damping) {
|
|
29
|
-
const instance = this.createInstance();
|
|
30
|
-
return instance.damping(damping);
|
|
31
|
-
}
|
|
32
|
-
damping(damping) {
|
|
33
|
-
this.dampingV = damping;
|
|
34
|
-
return this;
|
|
35
|
-
}
|
|
36
|
-
static mass(mass) {
|
|
37
|
-
const instance = this.createInstance();
|
|
38
|
-
return instance.mass(mass);
|
|
39
|
-
}
|
|
40
|
-
mass(mass) {
|
|
41
|
-
this.massV = mass;
|
|
42
|
-
return this;
|
|
43
|
-
}
|
|
44
|
-
static stiffness(stiffness) {
|
|
45
|
-
const instance = this.createInstance();
|
|
46
|
-
return instance.stiffness(stiffness);
|
|
47
|
-
}
|
|
48
|
-
stiffness(stiffness) {
|
|
49
|
-
this.stiffnessV = stiffness;
|
|
50
|
-
return this;
|
|
51
|
-
}
|
|
52
|
-
static overshootClamping(overshootClamping) {
|
|
53
|
-
const instance = this.createInstance();
|
|
54
|
-
return instance.overshootClamping(overshootClamping);
|
|
55
|
-
}
|
|
56
|
-
overshootClamping(overshootClamping) {
|
|
57
|
-
this.overshootClampingV = overshootClamping;
|
|
58
|
-
return this;
|
|
59
|
-
}
|
|
60
|
-
static restDisplacementThreshold(restDisplacementThreshold) {
|
|
61
|
-
const instance = this.createInstance();
|
|
62
|
-
return instance.restDisplacementThreshold(restDisplacementThreshold);
|
|
63
|
-
}
|
|
64
|
-
restDisplacementThreshold(restDisplacementThreshold) {
|
|
65
|
-
this.restDisplacementThresholdV = restDisplacementThreshold;
|
|
66
|
-
return this;
|
|
67
|
-
}
|
|
68
|
-
static restSpeedThreshold(restSpeedThreshold) {
|
|
69
|
-
const instance = this.createInstance();
|
|
70
|
-
return instance.restSpeedThreshold(restSpeedThreshold);
|
|
71
|
-
}
|
|
72
|
-
restSpeedThreshold(restSpeedThreshold) {
|
|
73
|
-
this.restSpeedThresholdV = restSpeedThreshold;
|
|
74
|
-
return this;
|
|
75
|
-
}
|
|
76
|
-
static withInitialValues(values) {
|
|
77
|
-
const instance = this.createInstance();
|
|
78
|
-
return instance.withInitialValues(values);
|
|
79
|
-
}
|
|
80
|
-
withInitialValues(values) {
|
|
81
|
-
this.initialValues = values;
|
|
82
|
-
return this;
|
|
83
|
-
}
|
|
84
|
-
getAnimationAndConfig() {
|
|
85
|
-
const duration = this.durationV;
|
|
86
|
-
const easing = this.easingV;
|
|
87
|
-
const rotate = this.rotateV;
|
|
88
|
-
const type = this.type ? this.type : withTiming;
|
|
89
|
-
const damping = this.dampingV;
|
|
90
|
-
const mass = this.massV;
|
|
91
|
-
const stiffness = this.stiffnessV;
|
|
92
|
-
const overshootClamping = this.overshootClampingV;
|
|
93
|
-
const restDisplacementThreshold = this.restDisplacementThresholdV;
|
|
94
|
-
const restSpeedThreshold = this.restSpeedThresholdV;
|
|
95
|
-
const animation = type;
|
|
96
|
-
const config = {};
|
|
97
|
-
if (type === withTiming) {
|
|
98
|
-
if (easing) {
|
|
99
|
-
config.easing = easing;
|
|
100
|
-
}
|
|
101
|
-
if (duration) {
|
|
102
|
-
config.duration = duration;
|
|
103
|
-
}
|
|
104
|
-
if (rotate) {
|
|
105
|
-
config.rotate = rotate;
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
else {
|
|
109
|
-
if (damping) {
|
|
110
|
-
config.damping = damping;
|
|
111
|
-
}
|
|
112
|
-
if (mass) {
|
|
113
|
-
config.mass = mass;
|
|
114
|
-
}
|
|
115
|
-
if (stiffness) {
|
|
116
|
-
config.stiffness = stiffness;
|
|
117
|
-
}
|
|
118
|
-
if (overshootClamping) {
|
|
119
|
-
config.overshootClamping = overshootClamping;
|
|
120
|
-
}
|
|
121
|
-
if (restDisplacementThreshold) {
|
|
122
|
-
config.restDisplacementThreshold = restDisplacementThreshold;
|
|
123
|
-
}
|
|
124
|
-
if (restSpeedThreshold) {
|
|
125
|
-
config.restSpeedThreshold = restSpeedThreshold;
|
|
126
|
-
}
|
|
127
|
-
if (rotate) {
|
|
128
|
-
config.rotate = rotate;
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
return [animation, config];
|
|
132
|
-
}
|
|
133
|
-
}
|
|
@@ -1,194 +0,0 @@
|
|
|
1
|
-
import { Easing } from '../../Easing';
|
|
2
|
-
import { withDelay, withSequence, withTiming } from '../../animation';
|
|
3
|
-
export class Keyframe {
|
|
4
|
-
/*
|
|
5
|
-
Keyframe definition should be passed in the constructor as the map
|
|
6
|
-
which keys are between range 0 - 100 (%) and correspond to the point in the animation progress.
|
|
7
|
-
*/
|
|
8
|
-
constructor(definitions) {
|
|
9
|
-
this.build = () => {
|
|
10
|
-
const delay = this.delayV;
|
|
11
|
-
const delayFunction = this.getDelayFunction();
|
|
12
|
-
const { keyframes, initialValues } = this.parseDefinitions();
|
|
13
|
-
const callback = this.callbackV;
|
|
14
|
-
return (_targetValues) => {
|
|
15
|
-
'worklet';
|
|
16
|
-
const animations = {};
|
|
17
|
-
/*
|
|
18
|
-
For each style property, an animations sequence is created that corresponds with its key points.
|
|
19
|
-
Transform style properties require special handling because of their nested structure.
|
|
20
|
-
*/
|
|
21
|
-
const addAnimation = (key) => {
|
|
22
|
-
var _a;
|
|
23
|
-
const keyframePoints = keyframes[key];
|
|
24
|
-
// in case if property was only passed as initial value
|
|
25
|
-
if (keyframePoints.length === 0)
|
|
26
|
-
return;
|
|
27
|
-
const animation = delayFunction(delay, keyframePoints.length === 1
|
|
28
|
-
? withTiming(keyframePoints[0].value, {
|
|
29
|
-
duration: keyframePoints[0].duration,
|
|
30
|
-
easing: keyframePoints[0].easing
|
|
31
|
-
? keyframePoints[0].easing
|
|
32
|
-
: Easing.linear,
|
|
33
|
-
})
|
|
34
|
-
: withSequence.apply(this, keyframePoints.map((keyframePoint) => withTiming(keyframePoint.value, {
|
|
35
|
-
duration: keyframePoint.duration,
|
|
36
|
-
easing: keyframePoint.easing
|
|
37
|
-
? keyframePoint.easing
|
|
38
|
-
: Easing.linear,
|
|
39
|
-
}))));
|
|
40
|
-
if (key.includes('transform')) {
|
|
41
|
-
if (!('transform' in animations)) {
|
|
42
|
-
animations.transform = [];
|
|
43
|
-
}
|
|
44
|
-
(_a = animations.transform) === null || _a === void 0 ? void 0 : _a.push({
|
|
45
|
-
[key.split(':')[1]]: animation,
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
else {
|
|
49
|
-
animations[key] = animation;
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
Object.keys(initialValues).forEach((key) => {
|
|
53
|
-
if (key.includes('transform')) {
|
|
54
|
-
initialValues[key].forEach((transformProp, index) => {
|
|
55
|
-
Object.keys(transformProp).forEach((transformPropKey) => {
|
|
56
|
-
addAnimation(index.toString() + '_transform:' + transformPropKey);
|
|
57
|
-
});
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
else {
|
|
61
|
-
addAnimation(key);
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
|
-
return {
|
|
65
|
-
animations: animations,
|
|
66
|
-
initialValues: initialValues,
|
|
67
|
-
callback: callback,
|
|
68
|
-
};
|
|
69
|
-
};
|
|
70
|
-
};
|
|
71
|
-
this.definitions = definitions;
|
|
72
|
-
}
|
|
73
|
-
parseDefinitions() {
|
|
74
|
-
/*
|
|
75
|
-
Each style property contain an array with all their key points:
|
|
76
|
-
value, duration of transition to that value, and optional easing function (defaults to Linear)
|
|
77
|
-
*/
|
|
78
|
-
const parsedKeyframes = {};
|
|
79
|
-
/*
|
|
80
|
-
Parsing keyframes 'from' and 'to'.
|
|
81
|
-
*/
|
|
82
|
-
if (this.definitions.from) {
|
|
83
|
-
if (this.definitions['0']) {
|
|
84
|
-
throw Error("You cannot provide both keyframe 0 and 'from' as they both specified initial values");
|
|
85
|
-
}
|
|
86
|
-
this.definitions['0'] = this.definitions.from;
|
|
87
|
-
delete this.definitions.from;
|
|
88
|
-
}
|
|
89
|
-
if (this.definitions.to) {
|
|
90
|
-
if (this.definitions['100']) {
|
|
91
|
-
throw Error("You cannot provide both keyframe 100 and 'to' as they both specified values at the end of the animation.");
|
|
92
|
-
}
|
|
93
|
-
this.definitions['100'] = this.definitions.to;
|
|
94
|
-
delete this.definitions.to;
|
|
95
|
-
}
|
|
96
|
-
/*
|
|
97
|
-
One of the assumptions is that keyframe 0 is required to properly set initial values.
|
|
98
|
-
Every other keyframe should contain properties from the set provided as initial values.
|
|
99
|
-
*/
|
|
100
|
-
if (!this.definitions['0']) {
|
|
101
|
-
throw Error("Please provide 0, or 'from' keyframe with initial state of your object.");
|
|
102
|
-
}
|
|
103
|
-
const initialValues = this.definitions['0'];
|
|
104
|
-
/*
|
|
105
|
-
Initialize parsedKeyframes for properties provided in initial keyframe
|
|
106
|
-
*/
|
|
107
|
-
Object.keys(initialValues).forEach((styleProp) => {
|
|
108
|
-
var _a;
|
|
109
|
-
if (styleProp === 'transform') {
|
|
110
|
-
(_a = initialValues[styleProp]) === null || _a === void 0 ? void 0 : _a.forEach((transformStyle, index) => {
|
|
111
|
-
Object.keys(transformStyle).forEach((transformProp) => {
|
|
112
|
-
parsedKeyframes[index.toString() + '_transform:' + transformProp] =
|
|
113
|
-
[];
|
|
114
|
-
});
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
else {
|
|
118
|
-
parsedKeyframes[styleProp] = [];
|
|
119
|
-
}
|
|
120
|
-
});
|
|
121
|
-
const duration = this.durationV ? this.durationV : 500;
|
|
122
|
-
const animationKeyPoints = Array.from(Object.keys(this.definitions));
|
|
123
|
-
const getAnimationDuration = (key, currentKeyPoint) => {
|
|
124
|
-
const maxDuration = (currentKeyPoint / 100) * duration;
|
|
125
|
-
const currentDuration = parsedKeyframes[key].reduce((acc, value) => acc + value.duration, 0);
|
|
126
|
-
return maxDuration - currentDuration;
|
|
127
|
-
};
|
|
128
|
-
/*
|
|
129
|
-
Other keyframes can't contain properties that were not specified in initial keyframe.
|
|
130
|
-
*/
|
|
131
|
-
const addKeyPoint = ({ key, value, currentKeyPoint, easing, }) => {
|
|
132
|
-
if (!(key in parsedKeyframes)) {
|
|
133
|
-
throw Error("Keyframe can contain only that set of properties that were provide with initial values (keyframe 0 or 'from')");
|
|
134
|
-
}
|
|
135
|
-
parsedKeyframes[key].push({
|
|
136
|
-
duration: getAnimationDuration(key, currentKeyPoint),
|
|
137
|
-
value: value,
|
|
138
|
-
easing: easing,
|
|
139
|
-
});
|
|
140
|
-
};
|
|
141
|
-
animationKeyPoints
|
|
142
|
-
.filter((value) => parseInt(value) !== 0)
|
|
143
|
-
.sort((a, b) => parseInt(a) - parseInt(b))
|
|
144
|
-
.forEach((keyPoint) => {
|
|
145
|
-
if (parseInt(keyPoint) < 0 || parseInt(keyPoint) > 100) {
|
|
146
|
-
throw Error('Keyframe should be in between range 0 - 100.');
|
|
147
|
-
}
|
|
148
|
-
const keyframe = this.definitions[keyPoint];
|
|
149
|
-
const easing = keyframe.easing;
|
|
150
|
-
delete keyframe.easing;
|
|
151
|
-
const addKeyPointWith = (key, value) => addKeyPoint({
|
|
152
|
-
key,
|
|
153
|
-
value,
|
|
154
|
-
currentKeyPoint: parseInt(keyPoint),
|
|
155
|
-
easing,
|
|
156
|
-
});
|
|
157
|
-
Object.keys(keyframe).forEach((key) => {
|
|
158
|
-
var _a;
|
|
159
|
-
if (key === 'transform') {
|
|
160
|
-
(_a = keyframe[key]) === null || _a === void 0 ? void 0 : _a.forEach((transformStyle, index) => {
|
|
161
|
-
Object.keys(transformStyle).forEach((transformProp) => {
|
|
162
|
-
addKeyPointWith(index.toString() + '_transform:' + transformProp, transformStyle[transformProp]);
|
|
163
|
-
});
|
|
164
|
-
});
|
|
165
|
-
}
|
|
166
|
-
else {
|
|
167
|
-
addKeyPointWith(key, keyframe[key]);
|
|
168
|
-
}
|
|
169
|
-
});
|
|
170
|
-
});
|
|
171
|
-
return { initialValues: initialValues, keyframes: parsedKeyframes };
|
|
172
|
-
}
|
|
173
|
-
duration(durationMs) {
|
|
174
|
-
this.durationV = durationMs;
|
|
175
|
-
return this;
|
|
176
|
-
}
|
|
177
|
-
delay(delayMs) {
|
|
178
|
-
this.delayV = delayMs;
|
|
179
|
-
return this;
|
|
180
|
-
}
|
|
181
|
-
withCallback(callback) {
|
|
182
|
-
this.callbackV = callback;
|
|
183
|
-
return this;
|
|
184
|
-
}
|
|
185
|
-
getDelayFunction() {
|
|
186
|
-
const delay = this.delayV;
|
|
187
|
-
return delay
|
|
188
|
-
? withDelay
|
|
189
|
-
: (_, animation) => {
|
|
190
|
-
'worklet';
|
|
191
|
-
return animation;
|
|
192
|
-
};
|
|
193
|
-
}
|
|
194
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|