react-native-worklets 0.0.1-alpha → 0.1.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/worklets/AnimationFrameQueue/AnimationFrameBatchinator.cpp +71 -0
- package/Common/cpp/worklets/AnimationFrameQueue/AnimationFrameBatchinator.h +38 -0
- package/Common/cpp/worklets/NativeModules/WorkletsModuleProxy.cpp +131 -0
- package/Common/cpp/worklets/NativeModules/WorkletsModuleProxy.h +82 -0
- package/Common/cpp/worklets/NativeModules/WorkletsModuleProxySpec.cpp +72 -0
- package/Common/cpp/worklets/NativeModules/WorkletsModuleProxySpec.h +44 -0
- package/Common/cpp/worklets/Registries/EventHandlerRegistry.cpp +94 -0
- package/Common/cpp/worklets/Registries/EventHandlerRegistry.h +49 -0
- package/Common/cpp/worklets/Registries/WorkletRuntimeRegistry.cpp +8 -0
- package/Common/cpp/worklets/Registries/WorkletRuntimeRegistry.h +39 -0
- package/Common/cpp/worklets/SharedItems/Shareables.cpp +326 -0
- package/Common/cpp/worklets/SharedItems/Shareables.h +345 -0
- package/Common/cpp/worklets/Tools/AsyncQueue.cpp +52 -0
- package/Common/cpp/worklets/Tools/AsyncQueue.h +35 -0
- package/Common/cpp/worklets/Tools/Defs.h +10 -0
- package/Common/cpp/worklets/Tools/JSISerializer.cpp +342 -0
- package/Common/cpp/worklets/Tools/JSISerializer.h +47 -0
- package/Common/cpp/worklets/Tools/JSLogger.cpp +16 -0
- package/Common/cpp/worklets/Tools/JSLogger.h +20 -0
- package/Common/cpp/worklets/Tools/JSScheduler.cpp +10 -0
- package/Common/cpp/worklets/Tools/JSScheduler.h +29 -0
- package/Common/cpp/worklets/Tools/PlatformLogger.h +16 -0
- package/Common/cpp/worklets/Tools/SingleInstanceChecker.h +72 -0
- package/Common/cpp/worklets/Tools/ThreadSafeQueue.h +49 -0
- package/Common/cpp/worklets/Tools/UIScheduler.cpp +19 -0
- package/Common/cpp/worklets/Tools/UIScheduler.h +22 -0
- package/Common/cpp/worklets/Tools/WorkletEventHandler.cpp +29 -0
- package/Common/cpp/worklets/Tools/WorkletEventHandler.h +41 -0
- package/Common/cpp/worklets/Tools/WorkletsJSIUtils.cpp +26 -0
- package/Common/cpp/worklets/Tools/WorkletsJSIUtils.h +199 -0
- package/Common/cpp/worklets/WorkletRuntime/RNRuntimeWorkletDecorator.cpp +20 -0
- package/Common/cpp/worklets/WorkletRuntime/RNRuntimeWorkletDecorator.h +19 -0
- package/Common/cpp/worklets/WorkletRuntime/RuntimeInitialization.md +191 -0
- package/Common/cpp/worklets/WorkletRuntime/UIRuntimeDecorator.cpp +19 -0
- package/Common/cpp/worklets/WorkletRuntime/UIRuntimeDecorator.h +16 -0
- package/Common/cpp/worklets/WorkletRuntime/WorkletHermesRuntime.cpp +108 -0
- package/Common/cpp/worklets/WorkletRuntime/WorkletHermesRuntime.h +127 -0
- package/Common/cpp/worklets/WorkletRuntime/WorkletRuntime.cpp +183 -0
- package/Common/cpp/worklets/WorkletRuntime/WorkletRuntime.h +90 -0
- package/Common/cpp/worklets/WorkletRuntime/WorkletRuntimeCollector.h +36 -0
- package/Common/cpp/worklets/WorkletRuntime/WorkletRuntimeDecorator.cpp +179 -0
- package/Common/cpp/worklets/WorkletRuntime/WorkletRuntimeDecorator.h +22 -0
- package/LICENSE +20 -0
- package/README.md +27 -0
- package/RNWorklets.podspec +70 -0
- package/android/CMakeLists.txt +56 -0
- package/android/build.gradle +313 -0
- package/android/gradle.properties +5 -0
- package/android/proguard-rules.pro +3 -0
- package/android/spotless.gradle +9 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/cpp/worklets/CMakeLists.txt +85 -0
- package/android/src/main/cpp/worklets/android/AndroidUIScheduler.cpp +63 -0
- package/android/src/main/cpp/worklets/android/AndroidUIScheduler.h +41 -0
- package/android/src/main/cpp/worklets/android/AnimationFrameCallback.h +32 -0
- package/android/src/main/cpp/worklets/android/PlatformLogger.cpp +29 -0
- package/android/src/main/cpp/worklets/android/WorkletsModule.cpp +83 -0
- package/android/src/main/cpp/worklets/android/WorkletsModule.h +63 -0
- package/android/src/main/cpp/worklets/android/WorkletsOnLoad.cpp +13 -0
- package/android/src/main/java/com/swmansion/worklets/AndroidUIScheduler.java +60 -0
- package/android/src/main/java/com/swmansion/worklets/AnimationFrameQueue/AnimationFrameCallback.java +20 -0
- package/android/src/main/java/com/swmansion/worklets/AnimationFrameQueue/AnimationFrameQueue.java +113 -0
- package/android/src/main/java/com/swmansion/worklets/JSCallInvokerResolver.java +27 -0
- package/android/src/main/java/com/swmansion/worklets/WorkletsMessageQueueThread.java +16 -0
- package/android/src/main/java/com/swmansion/worklets/WorkletsMessageQueueThreadBase.java +72 -0
- package/android/src/main/java/com/swmansion/worklets/WorkletsModule.java +106 -0
- package/android/src/main/java/com/swmansion/worklets/WorkletsPackage.java +49 -0
- package/android/src/paper/com/swmansion/worklets/NativeWorkletsModuleSpec.java +26 -0
- package/apple/worklets/apple/AnimationFrameQueue.h +15 -0
- package/apple/worklets/apple/AnimationFrameQueue.mm +81 -0
- package/apple/worklets/apple/AssertJavaScriptQueue.h +14 -0
- package/apple/worklets/apple/AssertTurboModuleManagerQueue.h +16 -0
- package/apple/worklets/apple/IOSUIScheduler.h +14 -0
- package/apple/worklets/apple/IOSUIScheduler.mm +24 -0
- package/apple/worklets/apple/PlatformLogger.mm +31 -0
- package/apple/worklets/apple/SlowAnimations.h +8 -0
- package/apple/worklets/apple/SlowAnimations.mm +47 -0
- package/apple/worklets/apple/WorkletsDisplayLink.h +21 -0
- package/apple/worklets/apple/WorkletsMessageThread.h +16 -0
- package/apple/worklets/apple/WorkletsMessageThread.mm +32 -0
- package/apple/worklets/apple/WorkletsModule.h +10 -0
- package/apple/worklets/apple/WorkletsModule.mm +85 -0
- package/lib/module/PlatformChecker.js +35 -0
- package/lib/module/PlatformChecker.js.map +1 -0
- package/lib/module/WorkletsError.js +13 -0
- package/lib/module/WorkletsError.js.map +1 -0
- package/lib/module/WorkletsModule/JSWorklets.js +36 -0
- package/lib/module/WorkletsModule/JSWorklets.js.map +1 -0
- package/lib/module/WorkletsModule/NativeWorklets.js +39 -0
- package/lib/module/WorkletsModule/NativeWorklets.js.map +1 -0
- package/lib/module/WorkletsModule/index.js +4 -0
- package/lib/module/WorkletsModule/index.js.map +1 -0
- package/lib/module/WorkletsModule/workletsModuleInstance.js +7 -0
- package/lib/module/WorkletsModule/workletsModuleInstance.js.map +1 -0
- package/lib/module/WorkletsModule/workletsModuleInstance.web.js +5 -0
- package/lib/module/WorkletsModule/workletsModuleInstance.web.js.map +1 -0
- package/lib/module/WorkletsModule/workletsModuleProxy.js +4 -0
- package/lib/module/WorkletsModule/workletsModuleProxy.js.map +1 -0
- package/lib/module/animationFrameQueue/mockedRequestAnimationFrame.js +10 -0
- package/lib/module/animationFrameQueue/mockedRequestAnimationFrame.js.map +1 -0
- package/lib/module/animationFrameQueue/requestAnimationFrame.js +36 -0
- package/lib/module/animationFrameQueue/requestAnimationFrame.js.map +1 -0
- package/lib/module/errors.js +78 -0
- package/lib/module/errors.js.map +1 -0
- package/lib/module/index.js +17 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/initializers.js +158 -0
- package/lib/module/initializers.js.map +1 -0
- package/lib/module/logger/LogBox.js +15 -0
- package/lib/module/logger/LogBox.js.map +1 -0
- package/lib/module/logger/index.js +5 -0
- package/lib/module/logger/index.js.map +1 -0
- package/lib/module/logger/logger.js +137 -0
- package/lib/module/logger/logger.js.map +1 -0
- package/lib/module/privateGlobals.d.js +8 -0
- package/lib/module/privateGlobals.d.js.map +1 -0
- package/lib/module/runtimes.js +63 -0
- package/lib/module/runtimes.js.map +1 -0
- package/lib/module/shareableMappingCache.js +39 -0
- package/lib/module/shareableMappingCache.js.map +1 -0
- package/lib/module/shareables.js +417 -0
- package/lib/module/shareables.js.map +1 -0
- package/lib/module/specs/NativeWorkletsModule.js +5 -0
- package/lib/module/specs/NativeWorkletsModule.js.map +1 -0
- package/lib/module/specs/index.js +5 -0
- package/lib/module/specs/index.js.map +1 -0
- package/lib/module/threads.js +204 -0
- package/lib/module/threads.js.map +1 -0
- package/lib/module/valueUnpacker.js +83 -0
- package/lib/module/valueUnpacker.js.map +1 -0
- package/lib/module/workletFunction.js +37 -0
- package/lib/module/workletFunction.js.map +1 -0
- package/lib/module/workletTypes.js +12 -0
- package/lib/module/workletTypes.js.map +1 -0
- package/lib/typescript/PlatformChecker.d.ts +7 -0
- package/lib/typescript/PlatformChecker.d.ts.map +1 -0
- package/lib/typescript/WorkletsError.d.ts +3 -0
- package/lib/typescript/WorkletsError.d.ts.map +1 -0
- package/lib/typescript/WorkletsModule/JSWorklets.d.ts +3 -0
- package/lib/typescript/WorkletsModule/JSWorklets.d.ts.map +1 -0
- package/lib/typescript/WorkletsModule/NativeWorklets.d.ts +5 -0
- package/lib/typescript/WorkletsModule/NativeWorklets.d.ts.map +1 -0
- package/lib/typescript/WorkletsModule/index.d.ts +3 -0
- package/lib/typescript/WorkletsModule/index.d.ts.map +1 -0
- package/lib/typescript/WorkletsModule/workletsModuleInstance.d.ts +2 -0
- package/lib/typescript/WorkletsModule/workletsModuleInstance.d.ts.map +1 -0
- package/lib/typescript/WorkletsModule/workletsModuleInstance.web.d.ts +2 -0
- package/lib/typescript/WorkletsModule/workletsModuleInstance.web.d.ts.map +1 -0
- package/lib/typescript/WorkletsModule/workletsModuleProxy.d.ts +12 -0
- package/lib/typescript/WorkletsModule/workletsModuleProxy.d.ts.map +1 -0
- package/lib/typescript/animationFrameQueue/mockedRequestAnimationFrame.d.ts +6 -0
- package/lib/typescript/animationFrameQueue/mockedRequestAnimationFrame.d.ts.map +1 -0
- package/lib/typescript/animationFrameQueue/requestAnimationFrame.d.ts +2 -0
- package/lib/typescript/animationFrameQueue/requestAnimationFrame.d.ts.map +1 -0
- package/lib/typescript/errors.d.ts +19 -0
- package/lib/typescript/errors.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +13 -0
- package/lib/typescript/index.d.ts.map +1 -0
- package/lib/typescript/initializers.d.ts +6 -0
- package/lib/typescript/initializers.d.ts.map +1 -0
- package/lib/typescript/logger/LogBox.d.ts +32 -0
- package/lib/typescript/logger/LogBox.d.ts.map +1 -0
- package/lib/typescript/logger/index.d.ts +3 -0
- package/lib/typescript/logger/index.d.ts.map +1 -0
- package/lib/typescript/logger/logger.d.ts +52 -0
- package/lib/typescript/logger/logger.d.ts.map +1 -0
- package/lib/typescript/runtimes.d.ts +16 -0
- package/lib/typescript/runtimes.d.ts.map +1 -0
- package/lib/typescript/shareableMappingCache.d.ts +16 -0
- package/lib/typescript/shareableMappingCache.d.ts.map +1 -0
- package/lib/typescript/shareables.d.ts +15 -0
- package/lib/typescript/shareables.d.ts.map +1 -0
- package/lib/typescript/specs/NativeWorkletsModule.d.ts +7 -0
- package/lib/typescript/specs/NativeWorkletsModule.d.ts.map +1 -0
- package/lib/typescript/specs/index.d.ts +3 -0
- package/lib/typescript/specs/index.d.ts.map +1 -0
- package/lib/typescript/threads.d.ts +49 -0
- package/lib/typescript/threads.d.ts.map +1 -0
- package/lib/typescript/valueUnpacker.d.ts +2 -0
- package/lib/typescript/valueUnpacker.d.ts.map +1 -0
- package/lib/typescript/workletFunction.d.ts +27 -0
- package/lib/typescript/workletFunction.d.ts.map +1 -0
- package/lib/typescript/workletTypes.d.ts +49 -0
- package/lib/typescript/workletTypes.d.ts.map +1 -0
- package/package.json +106 -8
- package/plugin/index.js +3 -0
- package/scripts/worklets_utils.rb +53 -0
- package/src/PlatformChecker.ts +43 -0
- package/src/WorkletsError.ts +13 -0
- package/src/WorkletsModule/JSWorklets.ts +57 -0
- package/src/WorkletsModule/NativeWorklets.ts +68 -0
- package/src/WorkletsModule/index.ts +7 -0
- package/src/WorkletsModule/workletsModuleInstance.ts +9 -0
- package/src/WorkletsModule/workletsModuleInstance.web.ts +5 -0
- package/src/WorkletsModule/workletsModuleProxy.ts +30 -0
- package/src/animationFrameQueue/mockedRequestAnimationFrame.ts +11 -0
- package/src/animationFrameQueue/requestAnimationFrame.ts +41 -0
- package/src/errors.ts +103 -0
- package/src/index.ts +42 -0
- package/src/initializers.ts +175 -0
- package/src/logger/LogBox.ts +55 -0
- package/src/logger/index.ts +3 -0
- package/src/logger/logger.ts +155 -0
- package/src/privateGlobals.d.ts +41 -0
- package/src/runtimes.ts +92 -0
- package/src/shareableMappingCache.ts +44 -0
- package/src/shareables.ts +577 -0
- package/src/specs/NativeWorkletsModule.ts +9 -0
- package/src/specs/index.ts +5 -0
- package/src/threads.ts +275 -0
- package/src/valueUnpacker.ts +110 -0
- package/src/workletFunction.ts +47 -0
- package/src/workletTypes.ts +76 -0
- package/Animated.js +0 -13
- package/AnimatedEvent.js +0 -167
- package/AnimatedImplementation.js +0 -666
- package/CoreAnimated.js +0 -43
- package/Easing.js +0 -236
- package/NativeAnimatedHelper.js +0 -226
- package/SpringConfig.js +0 -79
- package/animations/Animation.js +0 -36
- package/animations/DecayAnimation.js +0 -70
- package/animations/SpringAnimation.js +0 -125
- package/animations/TimingAnimation.js +0 -70
- package/bezier.js +0 -128
- package/createAnimatedComponent.js +0 -188
- package/nodes/AnimatedBlock.js +0 -19
- package/nodes/AnimatedClock.js +0 -76
- package/nodes/AnimatedCond.js +0 -23
- package/nodes/AnimatedDetach.js +0 -15
- package/nodes/AnimatedInterpolation.js +0 -338
- package/nodes/AnimatedNode.js +0 -97
- package/nodes/AnimatedOnChange.js +0 -28
- package/nodes/AnimatedOp.js +0 -17
- package/nodes/AnimatedProps.js +0 -154
- package/nodes/AnimatedSet.js +0 -19
- package/nodes/AnimatedStartClock.js +0 -21
- package/nodes/AnimatedStopClock.js +0 -21
- package/nodes/AnimatedStyle.js +0 -89
- package/nodes/AnimatedTracking.js +0 -36
- package/nodes/AnimatedTransform.js +0 -93
- package/nodes/AnimatedValue.js +0 -271
- package/nodes/AnimatedWithInput.js +0 -21
- package/nodes/SpringNode.js +0 -106
- package/nodes/TimingStep.js +0 -44
- package/utils.js +0 -28
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
import AnimatedValue from '../nodes/AnimatedValue';
|
|
2
|
-
import Animation from './Animation';
|
|
3
|
-
import SpringConfig from '../SpringConfig';
|
|
4
|
-
import SpringNode from '../nodes/SpringNode';
|
|
5
|
-
import AnimatedOnChange from '../nodes/AnimatedOnChange';
|
|
6
|
-
import AnimatedDetach from '../nodes/AnimatedDetach';
|
|
7
|
-
import AnimatedOp from '../nodes/AnimatedOp';
|
|
8
|
-
|
|
9
|
-
import { clock } from '../nodes/AnimatedClock';
|
|
10
|
-
|
|
11
|
-
import invariant from 'fbjs/lib/invariant';
|
|
12
|
-
import { shouldUseNativeDriver } from '../NativeAnimatedHelper';
|
|
13
|
-
|
|
14
|
-
function withDefault(value, defaultValue) {
|
|
15
|
-
if (value === undefined || value === null) {
|
|
16
|
-
return defaultValue;
|
|
17
|
-
}
|
|
18
|
-
return value;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export default class SpringAnimation extends Animation {
|
|
22
|
-
constructor(config) {
|
|
23
|
-
super();
|
|
24
|
-
|
|
25
|
-
this._overshootClamping = withDefault(config.overshootClamping, false);
|
|
26
|
-
this._restDisplacementThreshold = withDefault(
|
|
27
|
-
config.restDisplacementThreshold,
|
|
28
|
-
0.001
|
|
29
|
-
);
|
|
30
|
-
this._restSpeedThreshold = withDefault(config.restSpeedThreshold, 0.001);
|
|
31
|
-
this._initialVelocity = withDefault(config.velocity, 0);
|
|
32
|
-
this._lastVelocity = withDefault(config.velocity, 0);
|
|
33
|
-
this._toValue = config.toValue;
|
|
34
|
-
this._delay = withDefault(config.delay, 0);
|
|
35
|
-
this._useNativeDriver = shouldUseNativeDriver(config);
|
|
36
|
-
this.__isInteraction =
|
|
37
|
-
config.isInteraction !== undefined ? config.isInteraction : true;
|
|
38
|
-
this.__iterations = config.iterations !== undefined ? config.iterations : 1;
|
|
39
|
-
|
|
40
|
-
if (
|
|
41
|
-
config.stiffness !== undefined ||
|
|
42
|
-
config.damping !== undefined ||
|
|
43
|
-
config.mass !== undefined
|
|
44
|
-
) {
|
|
45
|
-
invariant(
|
|
46
|
-
config.bounciness === undefined &&
|
|
47
|
-
config.speed === undefined &&
|
|
48
|
-
config.tension === undefined &&
|
|
49
|
-
config.friction === undefined,
|
|
50
|
-
'You can define one of bounciness/speed, tension/friction, or stiffness/damping/mass, but not more than one'
|
|
51
|
-
);
|
|
52
|
-
this._stiffness = withDefault(config.stiffness, 100);
|
|
53
|
-
this._damping = withDefault(config.damping, 10);
|
|
54
|
-
this._mass = withDefault(config.mass, 1);
|
|
55
|
-
} else if (config.bounciness !== undefined || config.speed !== undefined) {
|
|
56
|
-
// Convert the origami bounciness/speed values to stiffness/damping
|
|
57
|
-
// We assume mass is 1.
|
|
58
|
-
invariant(
|
|
59
|
-
config.tension === undefined &&
|
|
60
|
-
config.friction === undefined &&
|
|
61
|
-
config.stiffness === undefined &&
|
|
62
|
-
config.damping === undefined &&
|
|
63
|
-
config.mass === undefined,
|
|
64
|
-
'You can define one of bounciness/speed, tension/friction, or stiffness/damping/mass, but not more than one'
|
|
65
|
-
);
|
|
66
|
-
const springConfig = SpringConfig.fromBouncinessAndSpeed(
|
|
67
|
-
withDefault(config.bounciness, 8),
|
|
68
|
-
withDefault(config.speed, 12)
|
|
69
|
-
);
|
|
70
|
-
this._stiffness = springConfig.stiffness;
|
|
71
|
-
this._damping = springConfig.damping;
|
|
72
|
-
this._mass = 1;
|
|
73
|
-
} else {
|
|
74
|
-
// Convert the origami tension/friction values to stiffness/damping
|
|
75
|
-
// We assume mass is 1.
|
|
76
|
-
const springConfig = SpringConfig.fromOrigamiTensionAndFriction(
|
|
77
|
-
withDefault(config.tension, 40),
|
|
78
|
-
withDefault(config.friction, 7)
|
|
79
|
-
);
|
|
80
|
-
this._stiffness = springConfig.stiffness;
|
|
81
|
-
this._damping = springConfig.damping;
|
|
82
|
-
this._mass = 1;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
invariant(this._stiffness > 0, 'Stiffness value must be greater than 0');
|
|
86
|
-
invariant(this._damping > 0, 'Damping value must be greater than 0');
|
|
87
|
-
invariant(this._mass > 0, 'Mass value must be greater than 0');
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
start(value) {
|
|
91
|
-
this._finished = new AnimatedValue(0);
|
|
92
|
-
const state = {
|
|
93
|
-
finished: this._finished,
|
|
94
|
-
velocity: this._initialVelocity,
|
|
95
|
-
position: value,
|
|
96
|
-
time: 0,
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
const config = {
|
|
100
|
-
damping: this._damping,
|
|
101
|
-
mass: this._mass,
|
|
102
|
-
stiffness: this._stiffness,
|
|
103
|
-
toValue: this._toValue,
|
|
104
|
-
overshootClamping: this._overshootClamping,
|
|
105
|
-
restSpeedThreshold: this._restSpeedThreshold,
|
|
106
|
-
restDisplacementThreshold: this._restDisplacementThreshold,
|
|
107
|
-
};
|
|
108
|
-
|
|
109
|
-
const step = new SpringNode(clock, state, config);
|
|
110
|
-
const detach = new AnimatedDetach(step);
|
|
111
|
-
const clb = finished => {
|
|
112
|
-
console.log('FINISHED', finished);
|
|
113
|
-
};
|
|
114
|
-
const call = new AnimatedOp([this._finished], ([finished]) =>
|
|
115
|
-
clb(finished)
|
|
116
|
-
);
|
|
117
|
-
const block = new AnimatedOp([detach, call], () => {});
|
|
118
|
-
new AnimatedOnChange(this._finished, block).__attach();
|
|
119
|
-
step.__attach();
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
stop() {
|
|
123
|
-
this._finished && this._finished.setValue(1);
|
|
124
|
-
}
|
|
125
|
-
}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import AnimatedValue from '../nodes/AnimatedValue';
|
|
2
|
-
import TimingStep from '../nodes/TimingStep';
|
|
3
|
-
import Animation from './Animation';
|
|
4
|
-
|
|
5
|
-
import { clock } from '../nodes/AnimatedClock';
|
|
6
|
-
import AnimatedOnChange from '../nodes/AnimatedOnChange';
|
|
7
|
-
import AnimatedDetach from '../nodes/AnimatedDetach';
|
|
8
|
-
|
|
9
|
-
import { proxyAnimatedObject } from '../utils';
|
|
10
|
-
import { shouldUseNativeDriver } from '../NativeAnimatedHelper';
|
|
11
|
-
|
|
12
|
-
let _easeInOut;
|
|
13
|
-
function easeInOut() {
|
|
14
|
-
if (!_easeInOut) {
|
|
15
|
-
const Easing = require('Easing');
|
|
16
|
-
_easeInOut = Easing.inOut(Easing.ease);
|
|
17
|
-
}
|
|
18
|
-
return _easeInOut;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export default class TimingAnimation extends Animation {
|
|
22
|
-
_startTime;
|
|
23
|
-
_fromValue;
|
|
24
|
-
_toValue;
|
|
25
|
-
_duration;
|
|
26
|
-
_delay;
|
|
27
|
-
_easing;
|
|
28
|
-
_onUpdate;
|
|
29
|
-
_animationFrame;
|
|
30
|
-
_timeout;
|
|
31
|
-
_useNativeDriver;
|
|
32
|
-
|
|
33
|
-
_finished;
|
|
34
|
-
|
|
35
|
-
constructor(config) {
|
|
36
|
-
super();
|
|
37
|
-
this._config = { ...config };
|
|
38
|
-
this._toValue = config.toValue;
|
|
39
|
-
this._easing = config.easing !== undefined ? config.easing : easeInOut();
|
|
40
|
-
this._duration = config.duration !== undefined ? config.duration : 500;
|
|
41
|
-
this._delay = config.delay !== undefined ? config.delay : 0;
|
|
42
|
-
this.__iterations = config.iterations !== undefined ? config.iterations : 1;
|
|
43
|
-
this.__isInteraction =
|
|
44
|
-
config.isInteraction !== undefined ? config.isInteraction : true;
|
|
45
|
-
this._useNativeDriver = shouldUseNativeDriver(config);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
start(value) {
|
|
49
|
-
this._finished = new AnimatedValue(0);
|
|
50
|
-
const state = proxyAnimatedObject({
|
|
51
|
-
finished: this._finished,
|
|
52
|
-
position: value,
|
|
53
|
-
time: 0,
|
|
54
|
-
frameTime: 0,
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
const config = proxyAnimatedObject({
|
|
58
|
-
duration: this._duration,
|
|
59
|
-
toValue: this._toValue,
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
const step = new TimingStep(clock, state, config, this._easing);
|
|
63
|
-
new AnimatedOnChange(this._finished, new AnimatedDetach(step)).__attach();
|
|
64
|
-
step.__attach();
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
stop() {
|
|
68
|
-
this._finished && this._finished.setValue(1);
|
|
69
|
-
}
|
|
70
|
-
}
|
package/bezier.js
DELETED
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
// These values are established by empiricism with tests (tradeoff: performance VS precision)
|
|
2
|
-
var NEWTON_ITERATIONS = 4;
|
|
3
|
-
var NEWTON_MIN_SLOPE = 0.001;
|
|
4
|
-
var SUBDIVISION_PRECISION = 0.0000001;
|
|
5
|
-
var SUBDIVISION_MAX_ITERATIONS = 10;
|
|
6
|
-
|
|
7
|
-
var kSplineTableSize = 11;
|
|
8
|
-
var kSampleStepSize = 1.0 / (kSplineTableSize - 1.0);
|
|
9
|
-
|
|
10
|
-
var float32ArraySupported = typeof Float32Array === 'function';
|
|
11
|
-
|
|
12
|
-
function A(aA1, aA2) {
|
|
13
|
-
return 1.0 - 3.0 * aA2 + 3.0 * aA1;
|
|
14
|
-
}
|
|
15
|
-
function B(aA1, aA2) {
|
|
16
|
-
return 3.0 * aA2 - 6.0 * aA1;
|
|
17
|
-
}
|
|
18
|
-
function C(aA1) {
|
|
19
|
-
return 3.0 * aA1;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
// Returns x(t) given t, x1, and x2, or y(t) given t, y1, and y2.
|
|
23
|
-
function calcBezier(aT, aA1, aA2) {
|
|
24
|
-
return ((A(aA1, aA2) * aT + B(aA1, aA2)) * aT + C(aA1)) * aT;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
// Returns dx/dt given t, x1, and x2, or dy/dt given t, y1, and y2.
|
|
28
|
-
function getSlope(aT, aA1, aA2) {
|
|
29
|
-
return 3.0 * A(aA1, aA2) * aT * aT + 2.0 * B(aA1, aA2) * aT + C(aA1);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
function binarySubdivide(aX, aA, aB, mX1, mX2) {
|
|
33
|
-
var currentX,
|
|
34
|
-
currentT,
|
|
35
|
-
i = 0;
|
|
36
|
-
do {
|
|
37
|
-
currentT = aA + (aB - aA) / 2.0;
|
|
38
|
-
currentX = calcBezier(currentT, mX1, mX2) - aX;
|
|
39
|
-
if (currentX > 0.0) {
|
|
40
|
-
aB = currentT;
|
|
41
|
-
} else {
|
|
42
|
-
aA = currentT;
|
|
43
|
-
}
|
|
44
|
-
} while (
|
|
45
|
-
Math.abs(currentX) > SUBDIVISION_PRECISION &&
|
|
46
|
-
++i < SUBDIVISION_MAX_ITERATIONS
|
|
47
|
-
);
|
|
48
|
-
return currentT;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
function newtonRaphsonIterate(aX, aGuessT, mX1, mX2) {
|
|
52
|
-
for (var i = 0; i < NEWTON_ITERATIONS; ++i) {
|
|
53
|
-
var currentSlope = getSlope(aGuessT, mX1, mX2);
|
|
54
|
-
if (currentSlope === 0.0) {
|
|
55
|
-
return aGuessT;
|
|
56
|
-
}
|
|
57
|
-
var currentX = calcBezier(aGuessT, mX1, mX2) - aX;
|
|
58
|
-
aGuessT -= currentX / currentSlope;
|
|
59
|
-
}
|
|
60
|
-
return aGuessT;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
export default function bezier(mX1, mY1, mX2, mY2) {
|
|
64
|
-
if (!(0 <= mX1 && mX1 <= 1 && 0 <= mX2 && mX2 <= 1)) {
|
|
65
|
-
// eslint-disable-line yoda
|
|
66
|
-
throw new Error('bezier x values must be in [0, 1] range');
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
// Precompute samples table
|
|
70
|
-
var sampleValues = float32ArraySupported
|
|
71
|
-
? new Float32Array(kSplineTableSize)
|
|
72
|
-
: new Array(kSplineTableSize);
|
|
73
|
-
if (mX1 !== mY1 || mX2 !== mY2) {
|
|
74
|
-
for (var i = 0; i < kSplineTableSize; ++i) {
|
|
75
|
-
sampleValues[i] = calcBezier(i * kSampleStepSize, mX1, mX2);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
function getTForX(aX) {
|
|
80
|
-
var intervalStart = 0.0;
|
|
81
|
-
var currentSample = 1;
|
|
82
|
-
var lastSample = kSplineTableSize - 1;
|
|
83
|
-
|
|
84
|
-
for (
|
|
85
|
-
;
|
|
86
|
-
currentSample !== lastSample && sampleValues[currentSample] <= aX;
|
|
87
|
-
++currentSample
|
|
88
|
-
) {
|
|
89
|
-
intervalStart += kSampleStepSize;
|
|
90
|
-
}
|
|
91
|
-
--currentSample;
|
|
92
|
-
|
|
93
|
-
// Interpolate to provide an initial guess for t
|
|
94
|
-
var dist =
|
|
95
|
-
(aX - sampleValues[currentSample]) /
|
|
96
|
-
(sampleValues[currentSample + 1] - sampleValues[currentSample]);
|
|
97
|
-
var guessForT = intervalStart + dist * kSampleStepSize;
|
|
98
|
-
|
|
99
|
-
var initialSlope = getSlope(guessForT, mX1, mX2);
|
|
100
|
-
if (initialSlope >= NEWTON_MIN_SLOPE) {
|
|
101
|
-
return newtonRaphsonIterate(aX, guessForT, mX1, mX2);
|
|
102
|
-
} else if (initialSlope === 0.0) {
|
|
103
|
-
return guessForT;
|
|
104
|
-
} else {
|
|
105
|
-
return binarySubdivide(
|
|
106
|
-
aX,
|
|
107
|
-
intervalStart,
|
|
108
|
-
intervalStart + kSampleStepSize,
|
|
109
|
-
mX1,
|
|
110
|
-
mX2
|
|
111
|
-
);
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
return function BezierEasing(x) {
|
|
116
|
-
if (mX1 === mY1 && mX2 === mY2) {
|
|
117
|
-
return x; // linear
|
|
118
|
-
}
|
|
119
|
-
// Because JavaScript number are imprecise, we should guarantee the extremes are right.
|
|
120
|
-
if (x === 0) {
|
|
121
|
-
return 0;
|
|
122
|
-
}
|
|
123
|
-
if (x === 1) {
|
|
124
|
-
return 1;
|
|
125
|
-
}
|
|
126
|
-
return calcBezier(getTForX(x), mY1, mY2);
|
|
127
|
-
};
|
|
128
|
-
}
|
|
@@ -1,188 +0,0 @@
|
|
|
1
|
-
import { AnimatedEvent } from './AnimatedEvent';
|
|
2
|
-
import AnimatedProps from './nodes/AnimatedProps';
|
|
3
|
-
import React from 'React';
|
|
4
|
-
import ViewStylePropTypes from 'ViewStylePropTypes';
|
|
5
|
-
|
|
6
|
-
import invariant from 'fbjs/lib/invariant';
|
|
7
|
-
|
|
8
|
-
export default function createAnimatedComponent(Component) {
|
|
9
|
-
invariant(
|
|
10
|
-
typeof Component === 'stringy' ||
|
|
11
|
-
(Component.prototype && Component.prototype.isReactComponent),
|
|
12
|
-
'`createAnimatedComponent` does not support stateless functional components; ' +
|
|
13
|
-
'use a class component instead.'
|
|
14
|
-
);
|
|
15
|
-
|
|
16
|
-
class AnimatedComponent extends React.Component {
|
|
17
|
-
_invokeAnimatedPropsCallbackOnMount = false;
|
|
18
|
-
|
|
19
|
-
_eventDetachers = [];
|
|
20
|
-
|
|
21
|
-
static __skipSetNativeProps_FOR_TESTS_ONLY = false;
|
|
22
|
-
|
|
23
|
-
constructor(props) {
|
|
24
|
-
super(props);
|
|
25
|
-
this._setComponentRef = this._setComponentRef.bind(this);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
componentWillUnmount() {
|
|
29
|
-
this._propsAnimated && this._propsAnimated.__detach();
|
|
30
|
-
this._detachNativeEvents();
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
setNativeProps(props) {
|
|
34
|
-
this._component.setNativeProps(props);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
componentWillMount() {
|
|
38
|
-
this._attachProps(this.props);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
componentDidMount() {
|
|
42
|
-
if (this._invokeAnimatedPropsCallbackOnMount) {
|
|
43
|
-
this._invokeAnimatedPropsCallbackOnMount = false;
|
|
44
|
-
this._animatedPropsCallback();
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
this._propsAnimated.setNativeView(this._component);
|
|
48
|
-
this._attachNativeEvents();
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
_attachNativeEvents() {
|
|
52
|
-
// Make sure to get the scrollable node for components that implement
|
|
53
|
-
// `ScrollResponder.Mixin`.
|
|
54
|
-
const scrollableNode = this._component.getScrollableNode
|
|
55
|
-
? this._component.getScrollableNode()
|
|
56
|
-
: this._component;
|
|
57
|
-
|
|
58
|
-
for (const key in this.props) {
|
|
59
|
-
const prop = this.props[key];
|
|
60
|
-
if (prop instanceof AnimatedEvent && prop.__isNative) {
|
|
61
|
-
prop.__attach(scrollableNode, key);
|
|
62
|
-
this._eventDetachers.push(() => prop.__detach(scrollableNode, key));
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
_detachNativeEvents() {
|
|
68
|
-
this._eventDetachers.forEach(remove => remove());
|
|
69
|
-
this._eventDetachers = [];
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
// The system is best designed when setNativeProps is implemented. It is
|
|
73
|
-
// able to avoid re-rendering and directly set the attributes that changed.
|
|
74
|
-
// However, setNativeProps can only be implemented on leaf native
|
|
75
|
-
// components. If you want to animate a composite component, you need to
|
|
76
|
-
// re-render it. In this case, we have a fallback that uses forceUpdate.
|
|
77
|
-
_animatedPropsCallback = () => {
|
|
78
|
-
if (this._component == null) {
|
|
79
|
-
// AnimatedProps is created in will-mount because it's used in render.
|
|
80
|
-
// But this callback may be invoked before mount in async mode,
|
|
81
|
-
// In which case we should defer the setNativeProps() call.
|
|
82
|
-
// React may throw away uncommitted work in async mode,
|
|
83
|
-
// So a deferred call won't always be invoked.
|
|
84
|
-
this._invokeAnimatedPropsCallbackOnMount = true;
|
|
85
|
-
} else if (
|
|
86
|
-
AnimatedComponent.__skipSetNativeProps_FOR_TESTS_ONLY ||
|
|
87
|
-
typeof this._component.setNativeProps !== 'function'
|
|
88
|
-
) {
|
|
89
|
-
this.forceUpdate();
|
|
90
|
-
} else if (!this._propsAnimated.__isNative) {
|
|
91
|
-
this._component.setNativeProps(this._propsAnimated.__getValue());
|
|
92
|
-
} else {
|
|
93
|
-
throw new Error(
|
|
94
|
-
'Attempting to run JS driven animation on animated ' +
|
|
95
|
-
'node that has been moved to "native" earlier by starting an ' +
|
|
96
|
-
'animation with `useNativeDriver: true`'
|
|
97
|
-
);
|
|
98
|
-
}
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
_attachProps(nextProps) {
|
|
102
|
-
const oldPropsAnimated = this._propsAnimated;
|
|
103
|
-
|
|
104
|
-
this._propsAnimated = new AnimatedProps(
|
|
105
|
-
nextProps,
|
|
106
|
-
this._animatedPropsCallback
|
|
107
|
-
);
|
|
108
|
-
|
|
109
|
-
// When you call detach, it removes the element from the parent list
|
|
110
|
-
// of children. If it goes to 0, then the parent also detaches itself
|
|
111
|
-
// and so on.
|
|
112
|
-
// An optimization is to attach the new elements and THEN detach the old
|
|
113
|
-
// ones instead of detaching and THEN attaching.
|
|
114
|
-
// This way the intermediate state isn't to go to 0 and trigger
|
|
115
|
-
// this expensive recursive detaching to then re-attach everything on
|
|
116
|
-
// the very next operation.
|
|
117
|
-
oldPropsAnimated && oldPropsAnimated.__detach();
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
componentWillReceiveProps(newProps) {
|
|
121
|
-
this._attachProps(newProps);
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
componentDidUpdate(prevProps) {
|
|
125
|
-
if (this._component !== this._prevComponent) {
|
|
126
|
-
this._propsAnimated.setNativeView(this._component);
|
|
127
|
-
}
|
|
128
|
-
if (this._component !== this._prevComponent || prevProps !== this.props) {
|
|
129
|
-
this._detachNativeEvents();
|
|
130
|
-
this._attachNativeEvents();
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
render() {
|
|
135
|
-
const props = this._propsAnimated.__getProps();
|
|
136
|
-
return (
|
|
137
|
-
<Component
|
|
138
|
-
{...props}
|
|
139
|
-
ref={this._setComponentRef}
|
|
140
|
-
// The native driver updates views directly through the UI thread so we
|
|
141
|
-
// have to make sure the view doesn't get optimized away because it cannot
|
|
142
|
-
// go through the NativeViewHierarchyManager since it operates on the shadow
|
|
143
|
-
// thread.
|
|
144
|
-
collapsable={
|
|
145
|
-
this._propsAnimated.__isNative ? false : props.collapsable
|
|
146
|
-
}
|
|
147
|
-
/>
|
|
148
|
-
);
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
_setComponentRef(c) {
|
|
152
|
-
this._prevComponent = this._component;
|
|
153
|
-
this._component = c;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
// A third party library can use getNode()
|
|
157
|
-
// to get the node reference of the decorated component
|
|
158
|
-
getNode() {
|
|
159
|
-
return this._component;
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
const propTypes = Component.propTypes;
|
|
164
|
-
|
|
165
|
-
AnimatedComponent.propTypes = {
|
|
166
|
-
style: function(props, propName, componentName) {
|
|
167
|
-
if (!propTypes) {
|
|
168
|
-
return;
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
for (const key in ViewStylePropTypes) {
|
|
172
|
-
if (!propTypes[key] && props[key] !== undefined) {
|
|
173
|
-
console.warn(
|
|
174
|
-
'You are setting the style `{ ' +
|
|
175
|
-
key +
|
|
176
|
-
': ... }` as a prop. You ' +
|
|
177
|
-
'should nest it in a style object. ' +
|
|
178
|
-
'E.g. `{ style: { ' +
|
|
179
|
-
key +
|
|
180
|
-
': ... } }`'
|
|
181
|
-
);
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
},
|
|
185
|
-
};
|
|
186
|
-
|
|
187
|
-
return AnimatedComponent;
|
|
188
|
-
}
|
package/nodes/AnimatedBlock.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import AnimatedWithInput from './AnimatedWithInput';
|
|
2
|
-
import { val } from '../utils';
|
|
3
|
-
|
|
4
|
-
export default class AnimatedBlock extends AnimatedWithInput {
|
|
5
|
-
_array;
|
|
6
|
-
|
|
7
|
-
constructor(array) {
|
|
8
|
-
super(array);
|
|
9
|
-
this._array = array;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
__onEvaluate() {
|
|
13
|
-
let result;
|
|
14
|
-
this._array.forEach(node => {
|
|
15
|
-
result = val(node);
|
|
16
|
-
});
|
|
17
|
-
return result;
|
|
18
|
-
}
|
|
19
|
-
}
|
package/nodes/AnimatedClock.js
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import AnimatedValue from './AnimatedValue';
|
|
2
|
-
import { val } from '../utils';
|
|
3
|
-
|
|
4
|
-
class AnimatedMainClock extends AnimatedValue {
|
|
5
|
-
_frameCallback;
|
|
6
|
-
|
|
7
|
-
constructor() {
|
|
8
|
-
super(0);
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
_runFrame = () => {
|
|
12
|
-
this._updateValue(+new Date());
|
|
13
|
-
if (this.__children.length > 0) {
|
|
14
|
-
this._frameCallback = requestAnimationFrame(this._runFrame);
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
__attach() {
|
|
19
|
-
super.__attach();
|
|
20
|
-
if (!this._frameCallback) {
|
|
21
|
-
this._frameCallback = requestAnimationFrame(this._runFrame);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
__detach() {
|
|
26
|
-
if (this._frameCallback) {
|
|
27
|
-
cancelAnimationFrame(this._frameCallback);
|
|
28
|
-
this._frameCallback = null;
|
|
29
|
-
}
|
|
30
|
-
super.__detach();
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
const mainClock = new AnimatedMainClock();
|
|
35
|
-
|
|
36
|
-
export default class AnimatedClock extends AnimatedValue {
|
|
37
|
-
_started;
|
|
38
|
-
_attached;
|
|
39
|
-
|
|
40
|
-
__onEvaluate() {
|
|
41
|
-
return val(mainClock);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
__attach() {
|
|
45
|
-
super.__attach();
|
|
46
|
-
if (this._started && !this._attached) {
|
|
47
|
-
mainClock.__addChild(this);
|
|
48
|
-
}
|
|
49
|
-
this._attached = true;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
__detach() {
|
|
53
|
-
if (this._started && this._attached) {
|
|
54
|
-
mainClock.__removeChild(this);
|
|
55
|
-
}
|
|
56
|
-
this._attached = false;
|
|
57
|
-
super.__detach();
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
start() {
|
|
61
|
-
if (!this._started && this._attached) {
|
|
62
|
-
mainClock.__addChild(this);
|
|
63
|
-
}
|
|
64
|
-
this._started = true;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
stop() {
|
|
68
|
-
if (this._started && this._attached) {
|
|
69
|
-
mainClock.__removeChild(this);
|
|
70
|
-
}
|
|
71
|
-
this._started = false;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
const clock = mainClock;
|
|
76
|
-
export { clock };
|
package/nodes/AnimatedCond.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { val } from '../utils';
|
|
2
|
-
import AnimatedWithInput from './AnimatedWithInput';
|
|
3
|
-
|
|
4
|
-
export default class AnimatedCond extends AnimatedWithInput {
|
|
5
|
-
_condition;
|
|
6
|
-
_ifBlock;
|
|
7
|
-
_elseBlock;
|
|
8
|
-
|
|
9
|
-
constructor(condition, ifBlock, elseBlock) {
|
|
10
|
-
super([condition, ifBlock, elseBlock]);
|
|
11
|
-
this._condition = condition;
|
|
12
|
-
this._ifBlock = ifBlock;
|
|
13
|
-
this._elseBlock = elseBlock;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
__onEvaluate() {
|
|
17
|
-
if (val(this._condition)) {
|
|
18
|
-
return val(this._ifBlock);
|
|
19
|
-
} else {
|
|
20
|
-
return this._elseBlock ? val(this._elseBlock) : undefined;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}
|
package/nodes/AnimatedDetach.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import AnimatedNode from './AnimatedNode';
|
|
2
|
-
|
|
3
|
-
export default class AnimatedDetach extends AnimatedNode {
|
|
4
|
-
_nodeToDetach;
|
|
5
|
-
|
|
6
|
-
constructor(nodeToDetach) {
|
|
7
|
-
super();
|
|
8
|
-
this._nodeToDetach = nodeToDetach;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
__onEvaluate() {
|
|
12
|
-
this._nodeToDetach.__detach();
|
|
13
|
-
return 0;
|
|
14
|
-
}
|
|
15
|
-
}
|