This commit is contained in:
Yamozha
2021-04-02 02:24:13 +03:00
parent c23950b545
commit 7256d79e2c
31493 changed files with 3036630 additions and 0 deletions

View File

@ -0,0 +1,181 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _exportNames = {
decay: true,
timing: true,
spring: true,
Easing: true,
Clock: true,
Value: true,
Node: true,
Transition: true,
Transitioning: true,
createTransitioningComponent: true,
SpringUtils: true,
useValue: true
};
Object.defineProperty(exports, "Easing", {
enumerable: true,
get: function get() {
return _Easing.default;
}
});
Object.defineProperty(exports, "Clock", {
enumerable: true,
get: function get() {
return _AnimatedClock.default;
}
});
Object.defineProperty(exports, "Value", {
enumerable: true,
get: function get() {
return _AnimatedValue.default;
}
});
Object.defineProperty(exports, "Node", {
enumerable: true,
get: function get() {
return _AnimatedNode.default;
}
});
Object.defineProperty(exports, "Transition", {
enumerable: true,
get: function get() {
return _Transitioning.Transition;
}
});
Object.defineProperty(exports, "Transitioning", {
enumerable: true,
get: function get() {
return _Transitioning.Transitioning;
}
});
Object.defineProperty(exports, "createTransitioningComponent", {
enumerable: true,
get: function get() {
return _Transitioning.createTransitioningComponent;
}
});
Object.defineProperty(exports, "SpringUtils", {
enumerable: true,
get: function get() {
return _SpringUtils.default;
}
});
Object.defineProperty(exports, "useValue", {
enumerable: true,
get: function get() {
return _useValue.default;
}
});
exports.spring = exports.timing = exports.decay = exports.default = void 0;
var _reactNative = require("react-native");
var _Easing = _interopRequireDefault(require("./Easing"));
var _AnimatedClock = _interopRequireDefault(require("./core/AnimatedClock"));
var _AnimatedValue = _interopRequireDefault(require("./core/AnimatedValue"));
var _AnimatedNode = _interopRequireDefault(require("./core/AnimatedNode"));
var _AnimatedCode = _interopRequireDefault(require("./core/AnimatedCode"));
var base = _interopRequireWildcard(require("./base"));
Object.keys(base).forEach(function (key) {
if (key === "default" || key === "__esModule") return;
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function get() {
return base[key];
}
});
});
var derived = _interopRequireWildcard(require("./derived"));
Object.keys(derived).forEach(function (key) {
if (key === "default" || key === "__esModule") return;
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function get() {
return derived[key];
}
});
});
var _createAnimatedComponent = _interopRequireDefault(require("./createAnimatedComponent"));
var _decay = _interopRequireDefault(require("./animations/decay"));
var _timing = _interopRequireDefault(require("./animations/timing"));
var _spring = _interopRequireDefault(require("./animations/spring"));
var _Animation = _interopRequireDefault(require("./animations/Animation"));
var _ConfigHelper = require("./ConfigHelper");
var _backwardCompatibleAnimWrapper = _interopRequireDefault(require("./animations/backwardCompatibleAnimWrapper"));
var _Transitioning = require("./Transitioning");
var _SpringUtils = _interopRequireDefault(require("./animations/SpringUtils"));
var _useValue = _interopRequireDefault(require("./useValue"));
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
const decayWrapper = (0, _backwardCompatibleAnimWrapper.default)(_decay.default, _Animation.default.decayDefaultState);
exports.decay = decayWrapper;
const timingWrapper = (0, _backwardCompatibleAnimWrapper.default)(_timing.default, _Animation.default.timingDefaultState);
exports.timing = timingWrapper;
const springWrapper = (0, _backwardCompatibleAnimWrapper.default)(_spring.default, _Animation.default.springDefaultState);
exports.spring = springWrapper;
const Animated = _objectSpread(_objectSpread(_objectSpread({
// components
View: (0, _createAnimatedComponent.default)(_reactNative.View),
Text: (0, _createAnimatedComponent.default)(_reactNative.Text),
Image: (0, _createAnimatedComponent.default)(_reactNative.Image),
ScrollView: (0, _createAnimatedComponent.default)(_reactNative.ScrollView),
Code: _AnimatedCode.default,
createAnimatedComponent: _createAnimatedComponent.default,
// classes
Clock: _AnimatedClock.default,
Value: _AnimatedValue.default,
Node: _AnimatedNode.default
}, base), derived), {}, {
// animations
decay: decayWrapper,
timing: timingWrapper,
spring: springWrapper,
SpringUtils: _SpringUtils.default,
// configuration
addWhitelistedNativeProps: _ConfigHelper.addWhitelistedNativeProps,
addWhitelistedUIProps: _ConfigHelper.addWhitelistedUIProps,
// hooks
useValue: _useValue.default
});
var _default = Animated; // operations
exports.default = _default;
//# sourceMappingURL=Animated.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["Animated.js"],"names":["decayWrapper","decay","Animation","decayDefaultState","timingWrapper","timing","timingDefaultState","springWrapper","spring","springDefaultState","Animated","View","Text","Image","ScrollView","Code","AnimatedCode","createAnimatedComponent","Clock","AnimatedClock","Value","AnimatedValue","Node","AnimatedNode","base","derived","SpringUtils","addWhitelistedNativeProps","addWhitelistedUIProps","useValue"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAmEA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAlEA;;AAmEA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAlEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAIA;;AACA;;AAKA;;AACA;;;;;;;;;;;;;;AAEA,MAAMA,YAAY,GAAG,4CACnBC,cADmB,EAEnBC,mBAAUC,iBAFS,CAArB;;AAIA,MAAMC,aAAa,GAAG,4CACpBC,eADoB,EAEpBH,mBAAUI,kBAFU,CAAtB;;AAIA,MAAMC,aAAa,GAAG,4CACpBC,eADoB,EAEpBN,mBAAUO,kBAFU,CAAtB;;;AAIA,MAAMC,QAAQ;AACZ;AACAC,EAAAA,IAAI,EAAE,sCAAwBA,iBAAxB,CAFM;AAGZC,EAAAA,IAAI,EAAE,sCAAwBA,iBAAxB,CAHM;AAIZC,EAAAA,KAAK,EAAE,sCAAwBA,kBAAxB,CAJK;AAKZC,EAAAA,UAAU,EAAE,sCAAwBA,uBAAxB,CALA;AAMZC,EAAAA,IAAI,EAAEC,qBANM;AAOZC,EAAAA,uBAAuB,EAAvBA,gCAPY;AASZ;AACAC,EAAAA,KAAK,EAAEC,sBAVK;AAWZC,EAAAA,KAAK,EAAEC,sBAXK;AAYZC,EAAAA,IAAI,EAAEC;AAZM,GAeTC,IAfS,GAgBTC,OAhBS;AAkBZ;AACAxB,EAAAA,KAAK,EAAED,YAnBK;AAoBZK,EAAAA,MAAM,EAAED,aApBI;AAqBZI,EAAAA,MAAM,EAAED,aArBI;AAsBZmB,EAAAA,WAAW,EAAXA,oBAtBY;AAwBZ;AACAC,EAAAA,yBAAyB,EAAzBA,uCAzBY;AA0BZC,EAAAA,qBAAqB,EAArBA,mCA1BY;AA4BZ;AACAC,EAAAA,QAAQ,EAARA;AA7BY,EAAd;;eAgCenB,Q,EAEf","sourcesContent":["import { Image, ScrollView, Text, View } from 'react-native';\nimport Easing from './Easing';\nimport AnimatedClock from './core/AnimatedClock';\nimport AnimatedValue from './core/AnimatedValue';\nimport AnimatedNode from './core/AnimatedNode';\nimport AnimatedCode from './core/AnimatedCode';\nimport * as base from './base';\nimport * as derived from './derived';\nimport createAnimatedComponent from './createAnimatedComponent';\nimport decay from './animations/decay';\nimport timing from './animations/timing';\nimport spring from './animations/spring';\nimport Animation from './animations/Animation';\nimport {\n addWhitelistedNativeProps,\n addWhitelistedUIProps,\n} from './ConfigHelper';\nimport backwardCompatibleAnimWrapper from './animations/backwardCompatibleAnimWrapper';\nimport {\n Transition,\n Transitioning,\n createTransitioningComponent,\n} from './Transitioning';\nimport SpringUtils from './animations/SpringUtils';\nimport useValue from './useValue';\n\nconst decayWrapper = backwardCompatibleAnimWrapper(\n decay,\n Animation.decayDefaultState\n);\nconst timingWrapper = backwardCompatibleAnimWrapper(\n timing,\n Animation.timingDefaultState\n);\nconst springWrapper = backwardCompatibleAnimWrapper(\n spring,\n Animation.springDefaultState\n);\nconst Animated = {\n // components\n View: createAnimatedComponent(View),\n Text: createAnimatedComponent(Text),\n Image: createAnimatedComponent(Image),\n ScrollView: createAnimatedComponent(ScrollView),\n Code: AnimatedCode,\n createAnimatedComponent,\n\n // classes\n Clock: AnimatedClock,\n Value: AnimatedValue,\n Node: AnimatedNode,\n\n // operations\n ...base,\n ...derived,\n\n // animations\n decay: decayWrapper,\n timing: timingWrapper,\n spring: springWrapper,\n SpringUtils,\n\n // configuration\n addWhitelistedNativeProps,\n addWhitelistedUIProps,\n\n // hooks\n useValue,\n};\n\nexport default Animated;\n\n// operations\nexport * from './base';\nexport * from './derived';\n\nexport {\n Easing,\n Transitioning,\n Transition,\n createTransitioningComponent,\n // classes\n AnimatedClock as Clock,\n AnimatedValue as Value,\n AnimatedNode as Node,\n // animations\n decayWrapper as decay,\n timingWrapper as timing,\n springWrapper as spring,\n SpringUtils,\n // hooks\n useValue,\n};\n"]}

View File

@ -0,0 +1,142 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.addWhitelistedNativeProps = addWhitelistedNativeProps;
exports.addWhitelistedUIProps = addWhitelistedUIProps;
var _ReanimatedModule = _interopRequireDefault(require("./ReanimatedModule"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
/**
* Styles allowed to be direcly updated in UI thread
*/
let UI_THREAD_PROPS_WHITELIST = {
opacity: true,
transform: true,
/* colors */
backgroundColor: true,
borderRightColor: true,
borderBottomColor: true,
borderColor: true,
borderEndColor: true,
borderLeftColor: true,
borderStartColor: true,
borderTopColor: true,
/* ios styles */
shadowOpacity: true,
shadowRadius: true,
/* legacy android transform properties */
scaleX: true,
scaleY: true,
translateX: true,
translateY: true
};
/**
* Whitelist of view props that can be updated in native thread via UIManagerModule
*/
let NATIVE_THREAD_PROPS_WHITELIST = {
borderBottomWidth: true,
borderEndWidth: true,
borderLeftWidth: true,
borderRightWidth: true,
borderStartWidth: true,
borderTopWidth: true,
borderWidth: true,
bottom: true,
flex: true,
flexGrow: true,
flexShrink: true,
height: true,
left: true,
margin: true,
marginBottom: true,
marginEnd: true,
marginHorizontal: true,
marginLeft: true,
marginRight: true,
marginStart: true,
marginTop: true,
marginVertical: true,
maxHeight: true,
maxWidth: true,
minHeight: true,
minWidth: true,
padding: true,
paddingBottom: true,
paddingEnd: true,
paddingHorizontal: true,
paddingLeft: true,
paddingRight: true,
paddingStart: true,
paddingTop: true,
paddingVertical: true,
right: true,
start: true,
top: true,
width: true,
zIndex: true,
borderBottomEndRadius: true,
borderBottomLeftRadius: true,
borderBottomRightRadius: true,
borderBottomStartRadius: true,
borderRadius: true,
borderTopEndRadius: true,
borderTopLeftRadius: true,
borderTopRightRadius: true,
borderTopStartRadius: true,
opacity: true,
elevation: true,
fontSize: true,
lineHeight: true,
textShadowRadius: true,
letterSpacing: true,
/* strings */
display: true,
backfaceVisibility: true,
overflow: true,
resizeMode: true,
fontStyle: true,
fontWeight: true,
textAlign: true,
textDecorationLine: true,
fontFamily: true,
textAlignVertical: true,
fontVariant: true,
textDecorationStyle: true,
textTransform: true,
writingDirection: true,
/* text color */
color: true
};
function configureProps() {
_ReanimatedModule.default.configureProps(Object.keys(NATIVE_THREAD_PROPS_WHITELIST), Object.keys(UI_THREAD_PROPS_WHITELIST));
}
function addWhitelistedNativeProps(props) {
NATIVE_THREAD_PROPS_WHITELIST = _objectSpread(_objectSpread({}, NATIVE_THREAD_PROPS_WHITELIST), props);
configureProps();
}
function addWhitelistedUIProps(props) {
UI_THREAD_PROPS_WHITELIST = _objectSpread(_objectSpread({}, UI_THREAD_PROPS_WHITELIST), props);
configureProps();
}
configureProps();
//# sourceMappingURL=ConfigHelper.js.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,230 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _base = require("./base");
var _AnimatedBezier = _interopRequireDefault(require("./core/AnimatedBezier"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* The `Easing` module implements common easing functions. This module is used
* by [Animate.timing()](docs/animate.html#timing) to convey physically
* believable motion in animations.
*
* You can find a visualization of some common easing functions at
* http://easings.net/
*
* ### Predefined animations
*
* The `Easing` module provides several predefined animations through the
* following methods:
*
* - [`back`](docs/easing.html#back) provides a simple animation where the
* object goes slightly back before moving forward
* - [`bounce`](docs/easing.html#bounce) provides a bouncing animation
* - [`ease`](docs/easing.html#ease) provides a simple inertial animation
* - [`elastic`](docs/easing.html#elastic) provides a simple spring interaction
*
* ### Standard functions
*
* Three standard easing functions are provided:
*
* - [`linear`](docs/easing.html#linear)
* - [`quad`](docs/easing.html#quad)
* - [`cubic`](docs/easing.html#cubic)
*
* The [`poly`](docs/easing.html#poly) function can be used to implement
* quartic, quintic, and other higher power functions.
*
* ### Additional functions
*
* Additional mathematical functions are provided by the following methods:
*
* - [`bezier`](docs/easing.html#bezier) provides a cubic bezier curve
* - [`circle`](docs/easing.html#circle) provides a circular function
* - [`sin`](docs/easing.html#sin) provides a sinusoidal function
* - [`exp`](docs/easing.html#exp) provides an exponential function
*
* The following helpers are used to modify other easing functions.
*
* - [`in`](docs/easing.html#in) runs an easing function forwards
* - [`inOut`](docs/easing.html#inout) makes any easing function symmetrical
* - [`out`](docs/easing.html#out) runs an easing function backwards
*/
class Easing {
/**
* A linear function, `f(t) = t`. Position correlates to elapsed time one to
* one.
*
* http://cubic-bezier.com/#0,0,1,1
*/
static linear(t) {
return t;
}
/**
* A simple inertial interaction, similar to an object slowly accelerating to
* speed.
*
* http://cubic-bezier.com/#.42,0,1,1
*/
static ease(t) {
return new _AnimatedBezier.default(t, 0.42, 0, 1, 1);
}
/**
* A quadratic function, `f(t) = t * t`. Position equals the square of elapsed
* time.
*
* http://easings.net/#easeInQuad
*/
static quad(t) {
return (0, _base.multiply)(t, t);
}
/**
* A cubic function, `f(t) = t * t * t`. Position equals the cube of elapsed
* time.
*
* http://easings.net/#easeInCubic
*/
static cubic(t) {
return (0, _base.multiply)(t, t, t);
}
/**
* A power function. Position is equal to the Nth power of elapsed time.
*
* n = 4: http://easings.net/#easeInQuart
* n = 5: http://easings.net/#easeInQuint
*/
static poly(n) {
return t => (0, _base.pow)(t, n);
}
/**
* A sinusoidal function.
*
* http://easings.net/#easeInSine
*/
static sin(t) {
return (0, _base.sub)(1, (0, _base.cos)((0, _base.multiply)(t, Math.PI, 0.5)));
}
/**
* A circular function.
*
* http://easings.net/#easeInCirc
*/
static circle(t) {
return (0, _base.sub)(1, (0, _base.sqrt)((0, _base.sub)(1, (0, _base.multiply)(t, t))));
}
/**
* An exponential function.
*
* http://easings.net/#easeInExpo
*/
static exp(t) {
return (0, _base.pow)(2, (0, _base.multiply)(10, (0, _base.sub)(t, 1)));
}
/**
* A simple elastic interaction, similar to a spring oscillating back and
* forth.
*
* Default bounciness is 1, which overshoots a little bit once. 0 bounciness
* doesn't overshoot at all, and bounciness of N > 1 will overshoot about N
* times.
*
* http://easings.net/#easeInElastic
*/
static elastic(bounciness = 1) {
const p = bounciness * Math.PI;
return t => (0, _base.sub)(1, (0, _base.multiply)((0, _base.pow)((0, _base.cos)((0, _base.multiply)(t, Math.PI, 0.5)), 3), (0, _base.cos)((0, _base.multiply)(t, p))));
}
/**
* Use with `Animated.parallel()` to create a simple effect where the object
* animates back slightly as the animation starts.
*
* Wolfram Plot:
*
* - http://tiny.cc/back_default (s = 1.70158, default)
*/
static back(s) {
if (s === undefined) {
s = 1.70158;
}
return t => (0, _base.multiply)(t, t, (0, _base.sub)((0, _base.multiply)((0, _base.add)(s, 1), t), s));
}
/**
* Provides a simple bouncing effect.
*
* http://easings.net/#easeInBounce
*/
static bounce(t) {
const sq = v => (0, _base.multiply)(7.5625, v, v);
return (0, _base.cond)((0, _base.lessThan)(t, 1 / 2.75), sq(t), (0, _base.cond)((0, _base.lessThan)(t, 2 / 2.75), (0, _base.add)(0.75, sq((0, _base.sub)(t, 1.5 / 2.75))), (0, _base.cond)((0, _base.lessThan)(t, 2.5 / 2.76), (0, _base.add)(0.9375, sq((0, _base.sub)(t, 2.25 / 2.75))), (0, _base.add)(0.984375, sq((0, _base.sub)(t, 2.625 / 2.75))))));
}
/**
* Provides a cubic bezier curve, equivalent to CSS Transitions'
* `transition-timing-function`.
*
* A useful tool to visualize cubic bezier curves can be found at
* http://cubic-bezier.com/
*/
static bezier(x1, y1, x2, y2) {
return t => new _AnimatedBezier.default(t, x1, y1, x2, y2);
}
/**
* Runs an easing function forwards.
*/
static in(easing) {
return easing;
}
/**
* Runs an easing function backwards.
*/
static out(easing) {
return t => (0, _base.sub)(1, easing((0, _base.sub)(1, t)));
}
/**
* Makes any easing function symmetrical. The easing function will run
* forwards for half of the duration, then backwards for the rest of the
* duration.
*/
static inOut(easing) {
return t => (0, _base.cond)((0, _base.lessThan)(t, 0.5), (0, _base.divide)(easing((0, _base.multiply)(t, 2)), 2), (0, _base.sub)(1, (0, _base.divide)(easing((0, _base.multiply)((0, _base.sub)(1, t), 2)), 2)));
}
}
exports.default = Easing;
//# sourceMappingURL=Easing.js.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,17 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _ReanimatedModule = _interopRequireDefault(require("./ReanimatedModule"));
var _reactNative = require("react-native");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _default = new _reactNative.NativeEventEmitter(_ReanimatedModule.default);
exports.default = _default;
//# sourceMappingURL=ReanimatedEventEmitter.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["ReanimatedEventEmitter.js"],"names":["NativeEventEmitter","ReanimatedModule"],"mappings":";;;;;;;AAAA;;AACA;;;;eAEe,IAAIA,+BAAJ,CAAuBC,yBAAvB,C","sourcesContent":["import ReanimatedModule from './ReanimatedModule';\nimport { NativeEventEmitter } from 'react-native';\n\nexport default new NativeEventEmitter(ReanimatedModule);\n"]}

View File

@ -0,0 +1,14 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _ReanimatedModuleCompat = _interopRequireDefault(require("./ReanimatedModuleCompat"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _default = _ReanimatedModuleCompat.default;
exports.default = _default;
//# sourceMappingURL=ReanimatedModule.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["ReanimatedModule.js"],"names":["ReanimatedModuleCompat"],"mappings":";;;;;;;AAAA;;;;eAEeA,+B","sourcesContent":["import ReanimatedModuleCompat from './ReanimatedModuleCompat';\n\nexport default ReanimatedModuleCompat;\n"]}

View File

@ -0,0 +1,14 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _ReanimatedModuleCompat = _interopRequireDefault(require("./ReanimatedModuleCompat"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _default = _ReanimatedModuleCompat.default;
exports.default = _default;
//# sourceMappingURL=ReanimatedModule.macos.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["ReanimatedModule.macos.js"],"names":["ReanimatedModuleCompat"],"mappings":";;;;;;;AAAA;;;;eAEeA,+B","sourcesContent":["import ReanimatedModuleCompat from './ReanimatedModuleCompat';\n\nexport default ReanimatedModuleCompat;\n"]}

View File

@ -0,0 +1,15 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _reactNative = require("react-native");
const {
ReanimatedModule
} = _reactNative.NativeModules;
var _default = ReanimatedModule;
exports.default = _default;
//# sourceMappingURL=ReanimatedModule.native.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["ReanimatedModule.native.js"],"names":["ReanimatedModule","NativeModules"],"mappings":";;;;;;;AAAA;;AAEA,MAAM;AAAEA,EAAAA;AAAF,IAAuBC,0BAA7B;eAEeD,gB","sourcesContent":["import { NativeModules } from 'react-native';\n\nconst { ReanimatedModule } = NativeModules;\n\nexport default ReanimatedModule;\n"]}

View File

@ -0,0 +1,14 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _ReanimatedModuleCompat = _interopRequireDefault(require("./ReanimatedModuleCompat"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _default = _ReanimatedModuleCompat.default;
exports.default = _default;
//# sourceMappingURL=ReanimatedModule.windows.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["ReanimatedModule.windows.js"],"names":["ReanimatedModuleCompat"],"mappings":";;;;;;;AAAA;;;;eAEeA,+B","sourcesContent":["import ReanimatedModuleCompat from './ReanimatedModuleCompat';\n\nexport default ReanimatedModuleCompat;\n"]}

View File

@ -0,0 +1,35 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _default = {
async disconnectNodeFromView() {// noop
},
async attachEvent(viewTag, eventName, nodeID) {// noop
},
async detachEvent(viewTag, eventName, nodeID) {// noop
},
async createNode(nodeID, config) {// noop
},
async dropNode(nodeID) {// noop
},
async configureProps() {// noop
},
async disconnectNodes() {// noop
},
async animateNextTransition() {
console.warn('Reanimated: animateNextTransition is unimplemented on current platform');
}
};
exports.default = _default;
//# sourceMappingURL=ReanimatedModuleCompat.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["ReanimatedModuleCompat.js"],"names":["disconnectNodeFromView","attachEvent","viewTag","eventName","nodeID","detachEvent","createNode","config","dropNode","configureProps","disconnectNodes","animateNextTransition","console","warn"],"mappings":";;;;;;eAAe;AACb,QAAMA,sBAAN,GAA+B,CAC7B;AACD,GAHY;;AAIb,QAAMC,WAAN,CAAkBC,OAAlB,EAA2BC,SAA3B,EAAsCC,MAAtC,EAA8C,CAC5C;AACD,GANY;;AAOb,QAAMC,WAAN,CAAkBH,OAAlB,EAA2BC,SAA3B,EAAsCC,MAAtC,EAA8C,CAC5C;AACD,GATY;;AAUb,QAAME,UAAN,CAAiBF,MAAjB,EAAyBG,MAAzB,EAAiC,CAC/B;AACD,GAZY;;AAab,QAAMC,QAAN,CAAeJ,MAAf,EAAuB,CACrB;AACD,GAfY;;AAgBb,QAAMK,cAAN,GAAuB,CACrB;AACD,GAlBY;;AAmBb,QAAMC,eAAN,GAAwB,CACtB;AACD,GArBY;;AAsBb,QAAMC,qBAAN,GAA8B;AAC5BC,IAAAA,OAAO,CAACC,IAAR,CAAa,wEAAb;AACD;;AAxBY,C","sourcesContent":["export default {\n async disconnectNodeFromView() {\n // noop\n },\n async attachEvent(viewTag, eventName, nodeID) {\n // noop\n },\n async detachEvent(viewTag, eventName, nodeID) {\n // noop\n },\n async createNode(nodeID, config) {\n // noop\n },\n async dropNode(nodeID) {\n // noop\n },\n async configureProps() {\n // noop\n },\n async disconnectNodes() {\n // noop\n },\n async animateNextTransition() {\n console.warn('Reanimated: animateNextTransition is unimplemented on current platform');\n },\n};\n"]}

View File

@ -0,0 +1,72 @@
"use strict";
function stiffnessFromOrigamiValue(oValue) {
return (oValue - 30) * 3.62 + 194;
}
function dampingFromOrigamiValue(oValue) {
return (oValue - 8) * 3 + 25;
}
function fromOrigamiTensionAndFriction(tension, friction) {
return {
stiffness: stiffnessFromOrigamiValue(tension),
damping: dampingFromOrigamiValue(friction)
};
}
function fromBouncinessAndSpeed(bounciness, speed) {
function normalize(value, startValue, endValue) {
return (value - startValue) / (endValue - startValue);
}
function projectNormal(n, start, end) {
return start + n * (end - start);
}
function linearInterpolation(t, start, end) {
return t * end + (1 - t) * start;
}
function quadraticOutInterpolation(t, start, end) {
return linearInterpolation(2 * t - t * t, start, end);
}
function b3Friction1(x) {
return 0.0007 * Math.pow(x, 3) - 0.031 * Math.pow(x, 2) + 0.64 * x + 1.28;
}
function b3Friction2(x) {
return 0.000044 * Math.pow(x, 3) - 0.006 * Math.pow(x, 2) + 0.36 * x + 2;
}
function b3Friction3(x) {
return 0.00000045 * Math.pow(x, 3) - 0.000332 * Math.pow(x, 2) + 0.1078 * x + 5.84;
}
function b3Nobounce(tension) {
if (tension <= 18) {
return b3Friction1(tension);
} else if (tension > 18 && tension <= 44) {
return b3Friction2(tension);
} else {
return b3Friction3(tension);
}
}
var b = normalize(bounciness / 1.7, 0, 20);
b = projectNormal(b, 0, 0.8);
var s = normalize(speed / 1.7, 0, 20);
var bouncyTension = projectNormal(s, 0.5, 200);
var bouncyFriction = quadraticOutInterpolation(b, b3Nobounce(bouncyTension), 0.01);
return {
stiffness: stiffnessFromOrigamiValue(bouncyTension),
damping: dampingFromOrigamiValue(bouncyFriction)
};
}
module.exports = {
fromOrigamiTensionAndFriction,
fromBouncinessAndSpeed
};
//# sourceMappingURL=SpringConfig.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["SpringConfig.js"],"names":["stiffnessFromOrigamiValue","oValue","dampingFromOrigamiValue","fromOrigamiTensionAndFriction","tension","friction","stiffness","damping","fromBouncinessAndSpeed","bounciness","speed","normalize","value","startValue","endValue","projectNormal","n","start","end","linearInterpolation","t","quadraticOutInterpolation","b3Friction1","x","Math","pow","b3Friction2","b3Friction3","b3Nobounce","b","s","bouncyTension","bouncyFriction","module","exports"],"mappings":";;AAAA,SAASA,yBAAT,CAAmCC,MAAnC,EAA2C;AACzC,SAAO,CAACA,MAAM,GAAG,EAAV,IAAgB,IAAhB,GAAuB,GAA9B;AACD;;AAED,SAASC,uBAAT,CAAiCD,MAAjC,EAAyC;AACvC,SAAO,CAACA,MAAM,GAAG,CAAV,IAAe,CAAf,GAAmB,EAA1B;AACD;;AAED,SAASE,6BAAT,CAAuCC,OAAvC,EAAgDC,QAAhD,EAA0D;AACxD,SAAO;AACLC,IAAAA,SAAS,EAAEN,yBAAyB,CAACI,OAAD,CAD/B;AAELG,IAAAA,OAAO,EAAEL,uBAAuB,CAACG,QAAD;AAF3B,GAAP;AAID;;AAED,SAASG,sBAAT,CAAgCC,UAAhC,EAA4CC,KAA5C,EAAmD;AACjD,WAASC,SAAT,CAAmBC,KAAnB,EAA0BC,UAA1B,EAAsCC,QAAtC,EAAgD;AAC9C,WAAO,CAACF,KAAK,GAAGC,UAAT,KAAwBC,QAAQ,GAAGD,UAAnC,CAAP;AACD;;AAED,WAASE,aAAT,CAAuBC,CAAvB,EAA0BC,KAA1B,EAAiCC,GAAjC,EAAsC;AACpC,WAAOD,KAAK,GAAGD,CAAC,IAAIE,GAAG,GAAGD,KAAV,CAAhB;AACD;;AAED,WAASE,mBAAT,CAA6BC,CAA7B,EAAgCH,KAAhC,EAAuCC,GAAvC,EAA4C;AAC1C,WAAOE,CAAC,GAAGF,GAAJ,GAAU,CAAC,IAAIE,CAAL,IAAUH,KAA3B;AACD;;AAED,WAASI,yBAAT,CAAmCD,CAAnC,EAAsCH,KAAtC,EAA6CC,GAA7C,EAAkD;AAChD,WAAOC,mBAAmB,CAAC,IAAIC,CAAJ,GAAQA,CAAC,GAAGA,CAAb,EAAgBH,KAAhB,EAAuBC,GAAvB,CAA1B;AACD;;AAED,WAASI,WAAT,CAAqBC,CAArB,EAAwB;AACtB,WAAO,SAASC,IAAI,CAACC,GAAL,CAASF,CAAT,EAAY,CAAZ,CAAT,GAA0B,QAAQC,IAAI,CAACC,GAAL,CAASF,CAAT,EAAY,CAAZ,CAAlC,GAAmD,OAAOA,CAA1D,GAA8D,IAArE;AACD;;AAED,WAASG,WAAT,CAAqBH,CAArB,EAAwB;AACtB,WAAO,WAAWC,IAAI,CAACC,GAAL,CAASF,CAAT,EAAY,CAAZ,CAAX,GAA4B,QAAQC,IAAI,CAACC,GAAL,CAASF,CAAT,EAAY,CAAZ,CAApC,GAAqD,OAAOA,CAA5D,GAAgE,CAAvE;AACD;;AAED,WAASI,WAAT,CAAqBJ,CAArB,EAAwB;AACtB,WACE,aAAaC,IAAI,CAACC,GAAL,CAASF,CAAT,EAAY,CAAZ,CAAb,GACA,WAAWC,IAAI,CAACC,GAAL,CAASF,CAAT,EAAY,CAAZ,CADX,GAEA,SAASA,CAFT,GAGA,IAJF;AAMD;;AAED,WAASK,UAAT,CAAoBxB,OAApB,EAA6B;AAC3B,QAAIA,OAAO,IAAI,EAAf,EAAmB;AACjB,aAAOkB,WAAW,CAAClB,OAAD,CAAlB;AACD,KAFD,MAEO,IAAIA,OAAO,GAAG,EAAV,IAAgBA,OAAO,IAAI,EAA/B,EAAmC;AACxC,aAAOsB,WAAW,CAACtB,OAAD,CAAlB;AACD,KAFM,MAEA;AACL,aAAOuB,WAAW,CAACvB,OAAD,CAAlB;AACD;AACF;;AAED,MAAIyB,CAAC,GAAGlB,SAAS,CAACF,UAAU,GAAG,GAAd,EAAmB,CAAnB,EAAsB,EAAtB,CAAjB;AACAoB,EAAAA,CAAC,GAAGd,aAAa,CAACc,CAAD,EAAI,CAAJ,EAAO,GAAP,CAAjB;AACA,MAAIC,CAAC,GAAGnB,SAAS,CAACD,KAAK,GAAG,GAAT,EAAc,CAAd,EAAiB,EAAjB,CAAjB;AACA,MAAIqB,aAAa,GAAGhB,aAAa,CAACe,CAAD,EAAI,GAAJ,EAAS,GAAT,CAAjC;AACA,MAAIE,cAAc,GAAGX,yBAAyB,CAC5CQ,CAD4C,EAE5CD,UAAU,CAACG,aAAD,CAFkC,EAG5C,IAH4C,CAA9C;AAMA,SAAO;AACLzB,IAAAA,SAAS,EAAEN,yBAAyB,CAAC+B,aAAD,CAD/B;AAELxB,IAAAA,OAAO,EAAEL,uBAAuB,CAAC8B,cAAD;AAF3B,GAAP;AAID;;AAEDC,MAAM,CAACC,OAAP,GAAiB;AACf/B,EAAAA,6BADe;AAEfK,EAAAA;AAFe,CAAjB","sourcesContent":["function stiffnessFromOrigamiValue(oValue) {\n return (oValue - 30) * 3.62 + 194;\n}\n\nfunction dampingFromOrigamiValue(oValue) {\n return (oValue - 8) * 3 + 25;\n}\n\nfunction fromOrigamiTensionAndFriction(tension, friction) {\n return {\n stiffness: stiffnessFromOrigamiValue(tension),\n damping: dampingFromOrigamiValue(friction),\n };\n}\n\nfunction fromBouncinessAndSpeed(bounciness, speed) {\n function normalize(value, startValue, endValue) {\n return (value - startValue) / (endValue - startValue);\n }\n\n function projectNormal(n, start, end) {\n return start + n * (end - start);\n }\n\n function linearInterpolation(t, start, end) {\n return t * end + (1 - t) * start;\n }\n\n function quadraticOutInterpolation(t, start, end) {\n return linearInterpolation(2 * t - t * t, start, end);\n }\n\n function b3Friction1(x) {\n return 0.0007 * Math.pow(x, 3) - 0.031 * Math.pow(x, 2) + 0.64 * x + 1.28;\n }\n\n function b3Friction2(x) {\n return 0.000044 * Math.pow(x, 3) - 0.006 * Math.pow(x, 2) + 0.36 * x + 2;\n }\n\n function b3Friction3(x) {\n return (\n 0.00000045 * Math.pow(x, 3) -\n 0.000332 * Math.pow(x, 2) +\n 0.1078 * x +\n 5.84\n );\n }\n\n function b3Nobounce(tension) {\n if (tension <= 18) {\n return b3Friction1(tension);\n } else if (tension > 18 && tension <= 44) {\n return b3Friction2(tension);\n } else {\n return b3Friction3(tension);\n }\n }\n\n var b = normalize(bounciness / 1.7, 0, 20);\n b = projectNormal(b, 0, 0.8);\n var s = normalize(speed / 1.7, 0, 20);\n var bouncyTension = projectNormal(s, 0.5, 200);\n var bouncyFriction = quadraticOutInterpolation(\n b,\n b3Nobounce(bouncyTension),\n 0.01\n );\n\n return {\n stiffness: stiffnessFromOrigamiValue(bouncyTension),\n damping: dampingFromOrigamiValue(bouncyFriction),\n };\n}\n\nmodule.exports = {\n fromOrigamiTensionAndFriction,\n fromBouncinessAndSpeed,\n};\n"]}

View File

@ -0,0 +1,208 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.createTransitioningComponent = createTransitioningComponent;
exports.Transition = exports.Transitioning = void 0;
var _react = _interopRequireDefault(require("react"));
var _reactNative = require("react-native");
var _ReanimatedModule = _interopRequireDefault(require("./ReanimatedModule"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
const TransitioningContext = _react.default.createContext();
function configFromProps(type, props) {
const config = {
type
};
if ('durationMs' in props) {
config.durationMs = props.durationMs;
}
if ('interpolation' in props) {
config.interpolation = props.interpolation;
}
if ('type' in props) {
config.animation = props.type;
}
if ('delayMs' in props) {
config.delayMs = props.delayMs;
}
if ('propagation' in props) {
config.propagation = props.propagation;
}
return config;
}
/**
* The below wrapper is used to support legacy context API with Context.Consumer
* render prop. We need it as we want to access `context` from within
* `componentDidMount` callback. If we decided to drop support for older
* react native we could rewrite it using hooks or `static contextType` API.
*/
function wrapTransitioningContext(Comp) {
return props => {
return /*#__PURE__*/_react.default.createElement(TransitioningContext.Consumer, null, context => /*#__PURE__*/_react.default.createElement(Comp, _extends({
context: context
}, props)));
};
}
class In extends _react.default.Component {
componentDidMount() {
this.props.context.push(configFromProps('in', this.props));
}
render() {
return this.props.children || null;
}
}
class Change extends _react.default.Component {
componentDidMount() {
this.props.context.push(configFromProps('change', this.props));
}
render() {
return this.props.children || null;
}
}
class Out extends _react.default.Component {
componentDidMount() {
this.props.context.push(configFromProps('out', this.props));
}
render() {
return this.props.children || null;
}
}
class Together extends _react.default.Component {
constructor(...args) {
super(...args);
_defineProperty(this, "transitions", []);
}
componentDidMount() {
const config = configFromProps('group', this.props);
config.transitions = this.transitions;
this.props.context.push(config);
}
render() {
return /*#__PURE__*/_react.default.createElement(TransitioningContext.Provider, {
value: this.transitions
}, this.props.children);
}
}
class Sequence extends _react.default.Component {
constructor(...args) {
super(...args);
_defineProperty(this, "transitions", []);
}
componentDidMount() {
const config = configFromProps('group', this.props);
config.sequence = true;
config.transitions = this.transitions;
this.props.context.push(config);
}
render() {
return /*#__PURE__*/_react.default.createElement(TransitioningContext.Provider, {
value: this.transitions
}, this.props.children);
}
}
function createTransitioningComponent(Component) {
class Wrapped extends _react.default.Component {
constructor(...args) {
super(...args);
_defineProperty(this, "propTypes", Component.propTypes);
_defineProperty(this, "transitions", []);
_defineProperty(this, "viewRef", _react.default.createRef());
}
componentDidMount() {
if (this.props.animateMount) {
this.animateNextTransition();
}
}
setNativeProps(props) {
this.viewRef.current.setNativeProps(props);
}
animateNextTransition() {
const viewTag = (0, _reactNative.findNodeHandle)(this.viewRef.current);
_ReanimatedModule.default.animateNextTransition(viewTag, {
transitions: this.transitions
});
}
render() {
const _this$props = this.props,
{
transition
} = _this$props,
rest = _objectWithoutProperties(_this$props, ["transition"]);
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(TransitioningContext.Provider, {
value: this.transitions
}, transition), /*#__PURE__*/_react.default.createElement(Component, _extends({}, rest, {
ref: this.viewRef,
collapsable: false
})));
}
}
return Wrapped;
}
const Transitioning = {
View: createTransitioningComponent(_reactNative.View)
};
exports.Transitioning = Transitioning;
const Transition = {
Sequence: wrapTransitioningContext(Sequence),
Together: wrapTransitioningContext(Together),
In: wrapTransitioningContext(In),
Out: wrapTransitioningContext(Out),
Change: wrapTransitioningContext(Change)
};
exports.Transition = Transition;
//# sourceMappingURL=Transitioning.js.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,12 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _default = {
addListener: () => {},
removeAllListeners: () => {}
};
exports.default = _default;
//# sourceMappingURL=ReanimatedEventEmitter.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["ReanimatedEventEmitter.js"],"names":["addListener","removeAllListeners"],"mappings":";;;;;;eAAe;AACbA,EAAAA,WAAW,EAAE,MAAM,CAAE,CADR;AAEbC,EAAAA,kBAAkB,EAAE,MAAM,CAAE;AAFf,C","sourcesContent":["export default {\n addListener: () => {},\n removeAllListeners: () => {},\n};\n"]}

View File

@ -0,0 +1,15 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _default = {
configureProps: () => {},
connectNodes: () => {},
getValue: () => 0,
disconnectNodes: () => {},
createNode: () => {}
};
exports.default = _default;
//# sourceMappingURL=ReanimatedModule.native.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["ReanimatedModule.native.js"],"names":["configureProps","connectNodes","getValue","disconnectNodes","createNode"],"mappings":";;;;;;eAAe;AACbA,EAAAA,cAAc,EAAE,MAAM,CAAE,CADX;AAEbC,EAAAA,YAAY,EAAE,MAAM,CAAE,CAFT;AAGbC,EAAAA,QAAQ,EAAE,MAAM,CAHH;AAIbC,EAAAA,eAAe,EAAE,MAAM,CAAE,CAJZ;AAKbC,EAAAA,UAAU,EAAE,MAAM,CAAE;AALP,C","sourcesContent":["export default {\n configureProps: () => {},\n connectNodes: () => {},\n getValue: () => 0,\n disconnectNodes: () => {},\n createNode: () => {},\n};\n"]}

View File

@ -0,0 +1,44 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _InternalAnimatedValue = _interopRequireDefault(require("../core/InternalAnimatedValue"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
class Animation {
static springDefaultState() {
return {
position: new _InternalAnimatedValue.default(0),
finished: new _InternalAnimatedValue.default(0),
velocity: new _InternalAnimatedValue.default(0),
time: new _InternalAnimatedValue.default(0)
};
}
static decayDefaultState() {
return {
position: new _InternalAnimatedValue.default(0),
finished: new _InternalAnimatedValue.default(0),
velocity: new _InternalAnimatedValue.default(0),
time: new _InternalAnimatedValue.default(0)
};
}
static timingDefaultState() {
return {
position: new _InternalAnimatedValue.default(0),
finished: new _InternalAnimatedValue.default(0),
time: new _InternalAnimatedValue.default(0),
frameTime: new _InternalAnimatedValue.default(0)
};
}
}
var _default = Animation;
exports.default = _default;
//# sourceMappingURL=Animation.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["Animation.js"],"names":["Animation","springDefaultState","position","AnimatedValue","finished","velocity","time","decayDefaultState","timingDefaultState","frameTime"],"mappings":";;;;;;;AAAA;;;;AAEA,MAAMA,SAAN,CAAgB;AACd,SAAOC,kBAAP,GAA4B;AAC1B,WAAO;AACLC,MAAAA,QAAQ,EAAE,IAAIC,8BAAJ,CAAkB,CAAlB,CADL;AAELC,MAAAA,QAAQ,EAAE,IAAID,8BAAJ,CAAkB,CAAlB,CAFL;AAGLE,MAAAA,QAAQ,EAAE,IAAIF,8BAAJ,CAAkB,CAAlB,CAHL;AAILG,MAAAA,IAAI,EAAE,IAAIH,8BAAJ,CAAkB,CAAlB;AAJD,KAAP;AAMD;;AAED,SAAOI,iBAAP,GAA2B;AACzB,WAAO;AACLL,MAAAA,QAAQ,EAAE,IAAIC,8BAAJ,CAAkB,CAAlB,CADL;AAELC,MAAAA,QAAQ,EAAE,IAAID,8BAAJ,CAAkB,CAAlB,CAFL;AAGLE,MAAAA,QAAQ,EAAE,IAAIF,8BAAJ,CAAkB,CAAlB,CAHL;AAILG,MAAAA,IAAI,EAAE,IAAIH,8BAAJ,CAAkB,CAAlB;AAJD,KAAP;AAMD;;AAED,SAAOK,kBAAP,GAA4B;AAC1B,WAAO;AACLN,MAAAA,QAAQ,EAAE,IAAIC,8BAAJ,CAAkB,CAAlB,CADL;AAELC,MAAAA,QAAQ,EAAE,IAAID,8BAAJ,CAAkB,CAAlB,CAFL;AAGLG,MAAAA,IAAI,EAAE,IAAIH,8BAAJ,CAAkB,CAAlB,CAHD;AAILM,MAAAA,SAAS,EAAE,IAAIN,8BAAJ,CAAkB,CAAlB;AAJN,KAAP;AAMD;;AA1Ba;;eA6BDH,S","sourcesContent":["import AnimatedValue from '../core/InternalAnimatedValue';\n\nclass Animation {\n static springDefaultState() {\n return {\n position: new AnimatedValue(0),\n finished: new AnimatedValue(0),\n velocity: new AnimatedValue(0),\n time: new AnimatedValue(0),\n };\n }\n\n static decayDefaultState() {\n return {\n position: new AnimatedValue(0),\n finished: new AnimatedValue(0),\n velocity: new AnimatedValue(0),\n time: new AnimatedValue(0),\n };\n }\n\n static timingDefaultState() {\n return {\n position: new AnimatedValue(0),\n finished: new AnimatedValue(0),\n time: new AnimatedValue(0),\n frameTime: new AnimatedValue(0),\n };\n }\n}\n\nexport default Animation;\n"]}

View File

@ -0,0 +1,179 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _base = require("./../base");
var _InternalAnimatedValue = _interopRequireDefault(require("./../core/InternalAnimatedValue"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
function stiffnessFromOrigamiValue(oValue) {
return (oValue - 30) * 3.62 + 194;
}
function dampingFromOrigamiValue(oValue) {
return (oValue - 8) * 3 + 25;
}
function stiffnessFromOrigamiNode(oValue) {
return (0, _base.add)((0, _base.multiply)((0, _base.sub)(oValue, 30), 3.62), 194);
}
function dampingFromOrigamiNode(oValue) {
return (0, _base.add)((0, _base.multiply)((0, _base.sub)(oValue, 8), 3), 25);
}
function makeConfigFromOrigamiTensionAndFriction(prevConfig) {
const {
tension,
friction
} = prevConfig,
rest = _objectWithoutProperties(prevConfig, ["tension", "friction"]);
return _objectSpread(_objectSpread({}, rest), {}, {
stiffness: typeof tension === 'number' ? stiffnessFromOrigamiValue(tension) : stiffnessFromOrigamiNode(tension),
damping: typeof friction === 'number' ? dampingFromOrigamiValue(friction) : dampingFromOrigamiNode(friction)
});
}
function makeConfigFromBouncinessAndSpeed(prevConfig) {
const {
bounciness,
speed
} = prevConfig,
rest = _objectWithoutProperties(prevConfig, ["bounciness", "speed"]);
if (typeof bounciness === 'number' && typeof speed === 'number') {
return fromBouncinessAndSpeedNumbers(bounciness, speed, rest);
}
return fromBouncinessAndSpeedNodes(bounciness, speed, rest);
}
function fromBouncinessAndSpeedNodes(bounciness, speed, rest) {
function normalize(value, startValue, endValue) {
return (0, _base.divide)((0, _base.sub)(value, startValue), (0, _base.sub)(endValue, startValue));
}
function projectNormal(n, start, end) {
return (0, _base.add)(start, (0, _base.multiply)(n, (0, _base.sub)(end, start)));
}
function linearInterpolation(t, start, end) {
return (0, _base.add)((0, _base.multiply)(t, end), (0, _base.multiply)((0, _base.sub)(1, t), start));
}
function quadraticOutInterpolation(t, start, end) {
return linearInterpolation((0, _base.sub)((0, _base.multiply)(2, t), (0, _base.multiply)(t, t)), start, end);
}
function b3Friction1(x) {
return (0, _base.add)((0, _base.sub)((0, _base.multiply)(0.0007, (0, _base.pow)(x, 3)), (0, _base.multiply)(0.031, (0, _base.pow)(x, 2))), (0, _base.multiply)(0.64, x), 1.28);
}
function b3Friction2(x) {
return (0, _base.add)((0, _base.sub)((0, _base.multiply)(0.000044, (0, _base.pow)(x, 3)), (0, _base.multiply)(0.006, (0, _base.pow)(x, 2))), (0, _base.multiply)(0.36, x), 2);
}
function b3Friction3(x) {
return (0, _base.add)((0, _base.sub)((0, _base.multiply)(0.00000045, (0, _base.pow)(x, 3)), (0, _base.multiply)(0.000332, (0, _base.pow)(x, 2))), (0, _base.multiply)(0.1078, x), 5.84);
}
function b3Nobounce(tension) {
return (0, _base.cond)((0, _base.lessOrEq)(tension, 18), b3Friction1(tension), (0, _base.cond)((0, _base.and)((0, _base.greaterThan)(tension, 18), (0, _base.lessOrEq)(tension, 44)), b3Friction2(tension), b3Friction3(tension)));
}
let b = normalize((0, _base.divide)(bounciness, 1.7), 0, 20);
b = projectNormal(b, 0, 0.8);
const s = normalize((0, _base.divide)(speed, 1.7), 0, 20);
const bouncyTension = projectNormal(s, 0.5, 200);
const bouncyFriction = quadraticOutInterpolation(b, b3Nobounce(bouncyTension), 0.01);
return _objectSpread(_objectSpread({}, rest), {}, {
stiffness: stiffnessFromOrigamiNode(bouncyTension),
damping: dampingFromOrigamiNode(bouncyFriction)
});
}
function fromBouncinessAndSpeedNumbers(bounciness, speed, rest) {
function normalize(value, startValue, endValue) {
return (value - startValue) / (endValue - startValue);
}
function projectNormal(n, start, end) {
return start + n * (end - start);
}
function linearInterpolation(t, start, end) {
return t * end + (1 - t) * start;
}
function quadraticOutInterpolation(t, start, end) {
return linearInterpolation(2 * t - t * t, start, end);
}
function b3Friction1(x) {
return 0.0007 * Math.pow(x, 3) - 0.031 * Math.pow(x, 2) + 0.64 * x + 1.28;
}
function b3Friction2(x) {
return 0.000044 * Math.pow(x, 3) - 0.006 * Math.pow(x, 2) + 0.36 * x + 2;
}
function b3Friction3(x) {
return 0.00000045 * Math.pow(x, 3) - 0.000332 * Math.pow(x, 2) + 0.1078 * x + 5.84;
}
function b3Nobounce(tension) {
if (tension <= 18) {
return b3Friction1(tension);
} else if (tension > 18 && tension <= 44) {
return b3Friction2(tension);
} else {
return b3Friction3(tension);
}
}
let b = normalize(bounciness / 1.7, 0, 20);
b = projectNormal(b, 0, 0.8);
const s = normalize(speed / 1.7, 0, 20);
const bouncyTension = projectNormal(s, 0.5, 200);
const bouncyFriction = quadraticOutInterpolation(b, b3Nobounce(bouncyTension), 0.01);
return _objectSpread(_objectSpread({}, rest), {}, {
stiffness: stiffnessFromOrigamiValue(bouncyTension),
damping: dampingFromOrigamiValue(bouncyFriction)
});
}
function makeDefaultConfig() {
return {
stiffness: new _InternalAnimatedValue.default(100),
mass: new _InternalAnimatedValue.default(1),
damping: new _InternalAnimatedValue.default(10),
overshootClamping: false,
restSpeedThreshold: 0.001,
restDisplacementThreshold: 0.001,
toValue: new _InternalAnimatedValue.default(0)
};
}
var _default = {
makeDefaultConfig,
makeConfigFromBouncinessAndSpeed,
makeConfigFromOrigamiTensionAndFriction
};
exports.default = _default;
//# sourceMappingURL=SpringUtils.js.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,113 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = backwardsCompatibleAnimWrapper;
var _base = require("../base");
var _AnimatedClock = _interopRequireDefault(require("../core/AnimatedClock"));
var _evaluateOnce = require("../derived/evaluateOnce");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function createOldAnimationObject(node, animationStateDefaults, value, config) {
const newClock = new _AnimatedClock.default();
const currentState = animationStateDefaults();
let alwaysNode;
let isStarted = false;
let isDone = false;
let wasStopped = false;
let animationCallback;
const animation = {
start: currentAnimationCallback => {
animationCallback = currentAnimationCallback;
if (isStarted) {
animationCallback && animationCallback({
finished: false
});
return;
}
if (isDone) {
console.warn('Animation has been finished before'); // inconsistent with React Native
return;
}
if (!value.isNativelyInitialized()) {
return;
}
isStarted = true;
(0, _evaluateOnce.evaluateOnce)((0, _base.set)(currentState.position, value), currentState.position, () => {
alwaysNode = (0, _base.always)((0, _base.set)(value, (0, _base.block)([(0, _base.cond)((0, _base.clockRunning)(newClock), 0, (0, _base.startClock)(newClock)), node(newClock, currentState, config), (0, _base.cond)(currentState.finished, [(0, _base.call)([], () => {
isStarted = false;
if (!wasStopped) {
isDone = true;
}
value.__detachAnimation(animation);
isDone = true;
if (!wasStopped) {
wasStopped = false;
}
}), (0, _base.stopClock)(newClock)]), currentState.position])));
value.__attachAnimation(animation);
alwaysNode.__addChild(value);
});
},
__detach: () => {
animationCallback && animationCallback({
finished: isDone
});
animationCallback = null;
value.__initialized && alwaysNode.__removeChild(value);
},
stop: () => {
if (isDone) {
console.warn('Calling stop has no effect as the animation has already completed');
return;
}
if (!isStarted) {
console.warn("Calling stop has no effect as the animation hasn't been started");
return;
}
wasStopped = true;
(0, _evaluateOnce.evaluateOnce)((0, _base.set)(currentState.finished, 1), currentState.finished);
},
__stopImmediately_testOnly: result => {
animation.stop();
isDone = result;
value.__detachAnimation(animation);
}
};
return animation;
}
/**
* Depending on the arguments list we either return animation node or return an
* animation object that is compatible with the original Animated API
*/
function backwardsCompatibleAnimWrapper(node, animationStateDefaults) {
return (clock, state, config) => {
if (config !== undefined) {
return node(clock, state, config);
}
return createOldAnimationObject(node, animationStateDefaults, clock, state);
};
}
//# sourceMappingURL=backwardCompatibleAnimWrapper.js.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,47 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _base = require("../base");
const VELOCITY_EPS = 5;
function decay(clock, state, config) {
const lastTime = (0, _base.cond)(state.time, state.time, clock);
const deltaTime = (0, _base.sub)(clock, lastTime); // v0 = v / 1000
// v = v0 * powf(deceleration, dt);
// v = v * 1000;
// x0 = x;
// x = x0 + v0 * deceleration * (1 - powf(deceleration, dt)) / (1 - deceleration)
const kv = (0, _base.pow)(config.deceleration, deltaTime);
const kx = (0, _base.divide)((0, _base.multiply)(config.deceleration, (0, _base.sub)(1, kv)), (0, _base.sub)(1, config.deceleration));
const v0 = (0, _base.divide)(state.velocity, 1000);
const v = (0, _base.multiply)(v0, kv, 1000);
const x = (0, _base.add)(state.position, (0, _base.multiply)(v0, kx));
return (0, _base.block)([(0, _base.set)(state.position, x), (0, _base.set)(state.velocity, v), (0, _base.set)(state.time, clock), (0, _base.cond)((0, _base.lessThan)((0, _base.abs)(v), VELOCITY_EPS), (0, _base.set)(state.finished, 1))]);
}
const procDecay = (0, _base.proc)((clock, time, velocity, position, finished, deceleration) => decay(clock, {
time,
velocity,
position,
finished
}, {
deceleration
}));
var _default = (clock, {
time,
velocity,
position,
finished
}, {
deceleration
}) => procDecay(clock, time, velocity, position, finished, deceleration);
exports.default = _default;
//# sourceMappingURL=decay.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["decay.js"],"names":["VELOCITY_EPS","decay","clock","state","config","lastTime","time","deltaTime","kv","deceleration","kx","v0","velocity","v","x","position","finished","procDecay"],"mappings":";;;;;;;AAAA;;AAcA,MAAMA,YAAY,GAAG,CAArB;;AAEA,SAASC,KAAT,CAAeC,KAAf,EAAsBC,KAAtB,EAA6BC,MAA7B,EAAqC;AACnC,QAAMC,QAAQ,GAAG,gBAAKF,KAAK,CAACG,IAAX,EAAiBH,KAAK,CAACG,IAAvB,EAA6BJ,KAA7B,CAAjB;AACA,QAAMK,SAAS,GAAG,eAAIL,KAAJ,EAAWG,QAAX,CAAlB,CAFmC,CAInC;AACA;AACA;AAEA;AACA;;AACA,QAAMG,EAAE,GAAG,eAAIJ,MAAM,CAACK,YAAX,EAAyBF,SAAzB,CAAX;AACA,QAAMG,EAAE,GAAG,kBACT,oBAASN,MAAM,CAACK,YAAhB,EAA8B,eAAI,CAAJ,EAAOD,EAAP,CAA9B,CADS,EAET,eAAI,CAAJ,EAAOJ,MAAM,CAACK,YAAd,CAFS,CAAX;AAIA,QAAME,EAAE,GAAG,kBAAOR,KAAK,CAACS,QAAb,EAAuB,IAAvB,CAAX;AACA,QAAMC,CAAC,GAAG,oBAASF,EAAT,EAAaH,EAAb,EAAiB,IAAjB,CAAV;AACA,QAAMM,CAAC,GAAG,eAAIX,KAAK,CAACY,QAAV,EAAoB,oBAASJ,EAAT,EAAaD,EAAb,CAApB,CAAV;AACA,SAAO,iBAAM,CACX,eAAIP,KAAK,CAACY,QAAV,EAAoBD,CAApB,CADW,EAEX,eAAIX,KAAK,CAACS,QAAV,EAAoBC,CAApB,CAFW,EAGX,eAAIV,KAAK,CAACG,IAAV,EAAgBJ,KAAhB,CAHW,EAIX,gBAAK,oBAAS,eAAIW,CAAJ,CAAT,EAAiBb,YAAjB,CAAL,EAAqC,eAAIG,KAAK,CAACa,QAAV,EAAoB,CAApB,CAArC,CAJW,CAAN,CAAP;AAMD;;AAED,MAAMC,SAAS,GAAG,gBAChB,CAACf,KAAD,EAAQI,IAAR,EAAcM,QAAd,EAAwBG,QAAxB,EAAkCC,QAAlC,EAA4CP,YAA5C,KACER,KAAK,CAACC,KAAD,EAAQ;AAAEI,EAAAA,IAAF;AAAQM,EAAAA,QAAR;AAAkBG,EAAAA,QAAlB;AAA4BC,EAAAA;AAA5B,CAAR,EAAgD;AAAEP,EAAAA;AAAF,CAAhD,CAFS,CAAlB;;eAKe,CACbP,KADa,EAEb;AAAEI,EAAAA,IAAF;AAAQM,EAAAA,QAAR;AAAkBG,EAAAA,QAAlB;AAA4BC,EAAAA;AAA5B,CAFa,EAGb;AAAEP,EAAAA;AAAF,CAHa,KAIVQ,SAAS,CAACf,KAAD,EAAQI,IAAR,EAAcM,QAAd,EAAwBG,QAAxB,EAAkCC,QAAlC,EAA4CP,YAA5C,C","sourcesContent":["import {\n cond,\n sub,\n pow,\n divide,\n multiply,\n add,\n block,\n set,\n lessThan,\n proc,\n abs,\n} from '../base';\n\nconst VELOCITY_EPS = 5;\n\nfunction decay(clock, state, config) {\n const lastTime = cond(state.time, state.time, clock);\n const deltaTime = sub(clock, lastTime);\n\n // v0 = v / 1000\n // v = v0 * powf(deceleration, dt);\n // v = v * 1000;\n\n // x0 = x;\n // x = x0 + v0 * deceleration * (1 - powf(deceleration, dt)) / (1 - deceleration)\n const kv = pow(config.deceleration, deltaTime);\n const kx = divide(\n multiply(config.deceleration, sub(1, kv)),\n sub(1, config.deceleration)\n );\n const v0 = divide(state.velocity, 1000);\n const v = multiply(v0, kv, 1000);\n const x = add(state.position, multiply(v0, kx));\n return block([\n set(state.position, x),\n set(state.velocity, v),\n set(state.time, clock),\n cond(lessThan(abs(v), VELOCITY_EPS), set(state.finished, 1)),\n ]);\n}\n\nconst procDecay = proc(\n (clock, time, velocity, position, finished, deceleration) =>\n decay(clock, { time, velocity, position, finished }, { deceleration })\n);\n\nexport default (\n clock,\n { time, velocity, position, finished },\n { deceleration }\n) => procDecay(clock, time, velocity, position, finished, deceleration);\n"]}

View File

@ -0,0 +1,87 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _base = require("../base");
var _InternalAnimatedValue = _interopRequireDefault(require("../core/InternalAnimatedValue"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const MAX_STEPS_MS = 64;
function spring(clock, state, config) {
const lastTime = (0, _base.cond)(state.time, state.time, clock);
const deltaTime = (0, _base.min)((0, _base.sub)(clock, lastTime), MAX_STEPS_MS);
const c = config.damping;
const m = config.mass;
const k = config.stiffness;
const v0 = (0, _base.multiply)(-1, state.velocity);
const x0 = (0, _base.sub)(config.toValue, state.position);
const zeta = (0, _base.divide)(c, (0, _base.multiply)(2, (0, _base.sqrt)((0, _base.multiply)(k, m)))); // damping ratio
const omega0 = (0, _base.sqrt)((0, _base.divide)(k, m)); // undamped angular frequency of the oscillator (rad/ms)
const omega1 = (0, _base.multiply)(omega0, (0, _base.sqrt)((0, _base.sub)(1, (0, _base.multiply)(zeta, zeta)))); // exponential decay
const t = (0, _base.divide)(deltaTime, 1000); // in seconds
const sin1 = (0, _base.sin)((0, _base.multiply)(omega1, t));
const cos1 = (0, _base.cos)((0, _base.multiply)(omega1, t)); // under damped
const underDampedEnvelope = (0, _base.exp)((0, _base.multiply)(-1, zeta, omega0, t));
const underDampedFrag1 = (0, _base.multiply)(underDampedEnvelope, (0, _base.add)((0, _base.multiply)(sin1, (0, _base.divide)((0, _base.add)(v0, (0, _base.multiply)(zeta, omega0, x0)), omega1)), (0, _base.multiply)(x0, cos1)));
const underDampedPosition = (0, _base.sub)(config.toValue, underDampedFrag1); // This looks crazy -- it's actually just the derivative of the oscillation function
const underDampedVelocity = (0, _base.sub)((0, _base.multiply)(zeta, omega0, underDampedFrag1), (0, _base.multiply)(underDampedEnvelope, (0, _base.sub)((0, _base.multiply)(cos1, (0, _base.add)(v0, (0, _base.multiply)(zeta, omega0, x0))), (0, _base.multiply)(omega1, x0, sin1)))); // critically damped
const criticallyDampedEnvelope = (0, _base.exp)((0, _base.multiply)(-1, omega0, t));
const criticallyDampedPosition = (0, _base.sub)(config.toValue, (0, _base.multiply)(criticallyDampedEnvelope, (0, _base.add)(x0, (0, _base.multiply)((0, _base.add)(v0, (0, _base.multiply)(omega0, x0)), t))));
const criticallyDampedVelocity = (0, _base.multiply)(criticallyDampedEnvelope, (0, _base.add)((0, _base.multiply)(v0, (0, _base.sub)((0, _base.multiply)(t, omega0), 1)), (0, _base.multiply)(t, x0, omega0, omega0))); // conditions for stopping the spring animations
const prevPosition = state.prevPosition ? state.prevPosition : new _InternalAnimatedValue.default(0);
const isOvershooting = (0, _base.cond)((0, _base.and)(config.overshootClamping, (0, _base.neq)(config.stiffness, 0)), (0, _base.cond)((0, _base.lessThan)(prevPosition, config.toValue), (0, _base.greaterThan)(state.position, config.toValue), (0, _base.lessThan)(state.position, config.toValue)));
const isVelocity = (0, _base.lessThan)((0, _base.abs)(state.velocity), config.restSpeedThreshold);
const isDisplacement = (0, _base.or)((0, _base.eq)(config.stiffness, 0), (0, _base.lessThan)((0, _base.abs)((0, _base.sub)(config.toValue, state.position)), config.restDisplacementThreshold));
return (0, _base.block)([(0, _base.set)(prevPosition, state.position), (0, _base.cond)((0, _base.lessThan)(zeta, 1), [(0, _base.set)(state.position, underDampedPosition), (0, _base.set)(state.velocity, underDampedVelocity)], [(0, _base.set)(state.position, criticallyDampedPosition), (0, _base.set)(state.velocity, criticallyDampedVelocity)]), (0, _base.set)(state.time, clock), (0, _base.cond)((0, _base.or)(isOvershooting, (0, _base.and)(isVelocity, isDisplacement)), [(0, _base.cond)((0, _base.neq)(config.stiffness, 0), [(0, _base.set)(state.velocity, 0), (0, _base.set)(state.position, config.toValue)]), (0, _base.set)(state.finished, 1)])]);
}
const procSpring = (0, _base.proc)((finished, velocity, position, time, prevPosition, toValue, damping, mass, stiffness, overshootClamping, restSpeedThreshold, restDisplacementThreshold, clock) => spring(clock, {
finished,
velocity,
position,
time,
// @ts-ignore
prevPosition
}, {
toValue,
damping,
mass,
stiffness,
overshootClamping,
restDisplacementThreshold,
restSpeedThreshold
}));
var _default = (clock, {
finished,
velocity,
position,
time,
// @ts-ignore
prevPosition
}, {
toValue,
damping,
mass,
stiffness,
overshootClamping,
restDisplacementThreshold,
restSpeedThreshold
}) => procSpring(finished, velocity, position, time, prevPosition, toValue, damping, mass, stiffness, overshootClamping, restSpeedThreshold, restDisplacementThreshold, clock);
exports.default = _default;
//# sourceMappingURL=spring.js.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,40 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
var _base = require("../base");
const internalTiming = (0, _base.proc)(function (clock, time, frameTime, position, finished, toValue, duration, nextProgress, progress, newFrameTime) {
const state = {
time,
finished,
frameTime,
position
};
const config = {
duration,
toValue
};
const distanceLeft = (0, _base.sub)(config.toValue, state.position);
const fullDistance = (0, _base.divide)(distanceLeft, (0, _base.sub)(1, progress));
const startPosition = (0, _base.sub)(config.toValue, fullDistance);
const nextPosition = (0, _base.add)(startPosition, (0, _base.multiply)(fullDistance, nextProgress));
return (0, _base.block)([(0, _base.cond)((0, _base.greaterOrEq)(newFrameTime, config.duration), [(0, _base.set)(state.position, config.toValue), (0, _base.set)(state.finished, 1)], (0, _base.set)(state.position, nextPosition)), (0, _base.set)(state.frameTime, newFrameTime), (0, _base.set)(state.time, clock)]);
});
function _default(clock, state, config) {
if (config.duration === 0) {
// when duration is zero we end the timing immediately
return (0, _base.block)([(0, _base.set)(state.position, config.toValue), (0, _base.set)(state.finished, 1)]);
}
const lastTime = (0, _base.cond)(state.time, state.time, clock);
const newFrameTime = (0, _base.add)(state.frameTime, (0, _base.sub)(clock, lastTime));
const nextProgress = config.easing((0, _base.divide)(newFrameTime, config.duration));
const progress = config.easing((0, _base.divide)(state.frameTime, config.duration));
return internalTiming(clock, state.time, state.frameTime, state.position, state.finished, config.toValue, config.duration, nextProgress, progress, newFrameTime);
}
//# sourceMappingURL=timing.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["timing.js"],"names":["internalTiming","clock","time","frameTime","position","finished","toValue","duration","nextProgress","progress","newFrameTime","state","config","distanceLeft","fullDistance","startPosition","nextPosition","lastTime","easing"],"mappings":";;;;;;;AAAA;;AAYA,MAAMA,cAAc,GAAG,gBAAK,UAC1BC,KAD0B,EAE1BC,IAF0B,EAG1BC,SAH0B,EAI1BC,QAJ0B,EAK1BC,QAL0B,EAM1BC,OAN0B,EAO1BC,QAP0B,EAQ1BC,YAR0B,EAS1BC,QAT0B,EAU1BC,YAV0B,EAW1B;AACA,QAAMC,KAAK,GAAG;AACZT,IAAAA,IADY;AAEZG,IAAAA,QAFY;AAGZF,IAAAA,SAHY;AAIZC,IAAAA;AAJY,GAAd;AAOA,QAAMQ,MAAM,GAAG;AACbL,IAAAA,QADa;AAEbD,IAAAA;AAFa,GAAf;AAKA,QAAMO,YAAY,GAAG,eAAID,MAAM,CAACN,OAAX,EAAoBK,KAAK,CAACP,QAA1B,CAArB;AACA,QAAMU,YAAY,GAAG,kBAAOD,YAAP,EAAqB,eAAI,CAAJ,EAAOJ,QAAP,CAArB,CAArB;AACA,QAAMM,aAAa,GAAG,eAAIH,MAAM,CAACN,OAAX,EAAoBQ,YAApB,CAAtB;AACA,QAAME,YAAY,GAAG,eAAID,aAAJ,EAAmB,oBAASD,YAAT,EAAuBN,YAAvB,CAAnB,CAArB;AAEA,SAAO,iBAAM,CACX,gBACE,uBAAYE,YAAZ,EAA0BE,MAAM,CAACL,QAAjC,CADF,EAEE,CAAC,eAAII,KAAK,CAACP,QAAV,EAAoBQ,MAAM,CAACN,OAA3B,CAAD,EAAsC,eAAIK,KAAK,CAACN,QAAV,EAAoB,CAApB,CAAtC,CAFF,EAGE,eAAIM,KAAK,CAACP,QAAV,EAAoBY,YAApB,CAHF,CADW,EAMX,eAAIL,KAAK,CAACR,SAAV,EAAqBO,YAArB,CANW,EAOX,eAAIC,KAAK,CAACT,IAAV,EAAgBD,KAAhB,CAPW,CAAN,CAAP;AASD,CAtCsB,CAAvB;;AAwCe,kBAASA,KAAT,EAAgBU,KAAhB,EAAuBC,MAAvB,EAA+B;AAC5C,MAAIA,MAAM,CAACL,QAAP,KAAoB,CAAxB,EAA2B;AACzB;AACA,WAAO,iBAAM,CAAC,eAAII,KAAK,CAACP,QAAV,EAAoBQ,MAAM,CAACN,OAA3B,CAAD,EAAsC,eAAIK,KAAK,CAACN,QAAV,EAAoB,CAApB,CAAtC,CAAN,CAAP;AACD;;AACD,QAAMY,QAAQ,GAAG,gBAAKN,KAAK,CAACT,IAAX,EAAiBS,KAAK,CAACT,IAAvB,EAA6BD,KAA7B,CAAjB;AACA,QAAMS,YAAY,GAAG,eAAIC,KAAK,CAACR,SAAV,EAAqB,eAAIF,KAAJ,EAAWgB,QAAX,CAArB,CAArB;AACA,QAAMT,YAAY,GAAGI,MAAM,CAACM,MAAP,CAAc,kBAAOR,YAAP,EAAqBE,MAAM,CAACL,QAA5B,CAAd,CAArB;AACA,QAAME,QAAQ,GAAGG,MAAM,CAACM,MAAP,CAAc,kBAAOP,KAAK,CAACR,SAAb,EAAwBS,MAAM,CAACL,QAA/B,CAAd,CAAjB;AACA,SAAOP,cAAc,CACnBC,KADmB,EAEnBU,KAAK,CAACT,IAFa,EAGnBS,KAAK,CAACR,SAHa,EAInBQ,KAAK,CAACP,QAJa,EAKnBO,KAAK,CAACN,QALa,EAMnBO,MAAM,CAACN,OANY,EAOnBM,MAAM,CAACL,QAPY,EAQnBC,YARmB,EASnBC,QATmB,EAUnBC,YAVmB,CAArB;AAYD","sourcesContent":["import {\n cond,\n sub,\n divide,\n multiply,\n add,\n block,\n set,\n greaterOrEq,\n proc,\n} from '../base';\n\nconst internalTiming = proc(function(\n clock,\n time,\n frameTime,\n position,\n finished,\n toValue,\n duration,\n nextProgress,\n progress,\n newFrameTime\n) {\n const state = {\n time,\n finished,\n frameTime,\n position,\n };\n\n const config = {\n duration,\n toValue,\n };\n\n const distanceLeft = sub(config.toValue, state.position);\n const fullDistance = divide(distanceLeft, sub(1, progress));\n const startPosition = sub(config.toValue, fullDistance);\n const nextPosition = add(startPosition, multiply(fullDistance, nextProgress));\n\n return block([\n cond(\n greaterOrEq(newFrameTime, config.duration),\n [set(state.position, config.toValue), set(state.finished, 1)],\n set(state.position, nextPosition)\n ),\n set(state.frameTime, newFrameTime),\n set(state.time, clock),\n ]);\n});\n\nexport default function(clock, state, config) {\n if (config.duration === 0) {\n // when duration is zero we end the timing immediately\n return block([set(state.position, config.toValue), set(state.finished, 1)]);\n }\n const lastTime = cond(state.time, state.time, clock);\n const newFrameTime = add(state.frameTime, sub(clock, lastTime));\n const nextProgress = config.easing(divide(newFrameTime, config.duration));\n const progress = config.easing(divide(state.frameTime, config.duration));\n return internalTiming(\n clock,\n state.time,\n state.frameTime,\n state.position,\n state.finished,\n config.toValue,\n config.duration,\n nextProgress,\n progress,\n newFrameTime\n );\n}\n"]}

View File

@ -0,0 +1,136 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _exportNames = {
cond: true,
set: true,
startClock: true,
stopClock: true,
clockRunning: true,
debug: true,
call: true,
event: true,
always: true,
concat: true,
block: true,
adapt: true,
proc: true
};
Object.defineProperty(exports, "cond", {
enumerable: true,
get: function get() {
return _AnimatedCond.createAnimatedCond;
}
});
Object.defineProperty(exports, "set", {
enumerable: true,
get: function get() {
return _AnimatedSet.createAnimatedSet;
}
});
Object.defineProperty(exports, "startClock", {
enumerable: true,
get: function get() {
return _AnimatedStartClock.createAnimatedStartClock;
}
});
Object.defineProperty(exports, "stopClock", {
enumerable: true,
get: function get() {
return _AnimatedStopClock.createAnimatedStopClock;
}
});
Object.defineProperty(exports, "clockRunning", {
enumerable: true,
get: function get() {
return _AnimatedClockTest.createAnimatedClockTest;
}
});
Object.defineProperty(exports, "debug", {
enumerable: true,
get: function get() {
return _AnimatedDebug.createAnimatedDebug;
}
});
Object.defineProperty(exports, "call", {
enumerable: true,
get: function get() {
return _AnimatedCall.createAnimatedCall;
}
});
Object.defineProperty(exports, "event", {
enumerable: true,
get: function get() {
return _AnimatedEvent.createAnimatedEvent;
}
});
Object.defineProperty(exports, "always", {
enumerable: true,
get: function get() {
return _AnimatedAlways.createAnimatedAlways;
}
});
Object.defineProperty(exports, "concat", {
enumerable: true,
get: function get() {
return _AnimatedConcat.createAnimatedConcat;
}
});
Object.defineProperty(exports, "block", {
enumerable: true,
get: function get() {
return _AnimatedBlock.createAnimatedBlock;
}
});
Object.defineProperty(exports, "adapt", {
enumerable: true,
get: function get() {
return _AnimatedBlock.adapt;
}
});
Object.defineProperty(exports, "proc", {
enumerable: true,
get: function get() {
return _AnimatedFunction.createAnimatedFunction;
}
});
var _AnimatedCond = require("./core/AnimatedCond");
var _AnimatedSet = require("./core/AnimatedSet");
var _AnimatedStartClock = require("./core/AnimatedStartClock");
var _AnimatedStopClock = require("./core/AnimatedStopClock");
var _AnimatedClockTest = require("./core/AnimatedClockTest");
var _AnimatedDebug = require("./core/AnimatedDebug");
var _AnimatedCall = require("./core/AnimatedCall");
var _AnimatedEvent = require("./core/AnimatedEvent");
var _AnimatedAlways = require("./core/AnimatedAlways");
var _AnimatedConcat = require("./core/AnimatedConcat");
var _AnimatedBlock = require("./core/AnimatedBlock");
var _AnimatedFunction = require("./core/AnimatedFunction");
var _operators = require("./operators");
Object.keys(_operators).forEach(function (key) {
if (key === "default" || key === "__esModule") return;
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function get() {
return _operators[key];
}
});
});
//# sourceMappingURL=base.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["base.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AAGA;;AACA;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA","sourcesContent":["export { createAnimatedCond as cond } from './core/AnimatedCond';\nexport { createAnimatedSet as set } from './core/AnimatedSet';\nexport {\n createAnimatedStartClock as startClock,\n} from './core/AnimatedStartClock';\nexport { createAnimatedStopClock as stopClock } from './core/AnimatedStopClock';\nexport {\n createAnimatedClockTest as clockRunning,\n} from './core/AnimatedClockTest';\nexport { createAnimatedDebug as debug } from './core/AnimatedDebug';\nexport { createAnimatedCall as call } from './core/AnimatedCall';\nexport { createAnimatedEvent as event } from './core/AnimatedEvent';\nexport { createAnimatedAlways as always } from './core/AnimatedAlways';\nexport { createAnimatedConcat as concat } from './core/AnimatedConcat';\nexport { createAnimatedBlock as block, adapt } from './core/AnimatedBlock';\nexport { createAnimatedFunction as proc } from './core/AnimatedFunction';\nexport * from './operators';\n"]}

View File

@ -0,0 +1,49 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.createAnimatedAlways = createAnimatedAlways;
var _AnimatedNode = _interopRequireDefault(require("./AnimatedNode"));
var _invariant = _interopRequireDefault(require("fbjs/lib/invariant"));
var _val = require("../val");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
class AnimatedAlways extends _AnimatedNode.default {
constructor(what) {
(0, _invariant.default)(what instanceof _AnimatedNode.default, "Reanimated: Animated.always node argument should be of type AnimatedNode but got ".concat(what));
super({
type: 'always',
what
}, [what]);
_defineProperty(this, "_what", void 0);
this._what = what;
}
toString() {
return "AnimatedAlways, id: ".concat(this.__nodeID);
}
update() {
this.__getValue();
}
__onEvaluate() {
(0, _val.val)(this._what);
return 0;
}
}
function createAnimatedAlways(item) {
return new AnimatedAlways(item);
}
//# sourceMappingURL=AnimatedAlways.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["AnimatedAlways.js"],"names":["AnimatedAlways","AnimatedNode","constructor","what","type","_what","toString","__nodeID","update","__getValue","__onEvaluate","createAnimatedAlways","item"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;;;;;AAEA,MAAMA,cAAN,SAA6BC,qBAA7B,CAA0C;AAGxCC,EAAAA,WAAW,CAACC,IAAD,EAAO;AAChB,4BACEA,IAAI,YAAYF,qBADlB,6FAEsFE,IAFtF;AAIA,UAAM;AAAEC,MAAAA,IAAI,EAAE,QAAR;AAAkBD,MAAAA;AAAlB,KAAN,EAAgC,CAACA,IAAD,CAAhC;;AALgB;;AAMhB,SAAKE,KAAL,GAAaF,IAAb;AACD;;AAEDG,EAAAA,QAAQ,GAAG;AACT,yCAA8B,KAAKC,QAAnC;AACD;;AAEDC,EAAAA,MAAM,GAAG;AACP,SAAKC,UAAL;AACD;;AAEDC,EAAAA,YAAY,GAAG;AACb,kBAAI,KAAKL,KAAT;AACA,WAAO,CAAP;AACD;;AAvBuC;;AA0BnC,SAASM,oBAAT,CAA8BC,IAA9B,EAAoC;AACzC,SAAO,IAAIZ,cAAJ,CAAmBY,IAAnB,CAAP;AACD","sourcesContent":["import AnimatedNode from './AnimatedNode';\nimport invariant from 'fbjs/lib/invariant';\nimport { val } from '../val';\n\nclass AnimatedAlways extends AnimatedNode {\n _what;\n\n constructor(what) {\n invariant(\n what instanceof AnimatedNode,\n `Reanimated: Animated.always node argument should be of type AnimatedNode but got ${what}`\n );\n super({ type: 'always', what }, [what]);\n this._what = what;\n }\n\n toString() {\n return `AnimatedAlways, id: ${this.__nodeID}`;\n }\n\n update() {\n this.__getValue();\n }\n\n __onEvaluate() {\n val(this._what);\n return 0;\n }\n}\n\nexport function createAnimatedAlways(item) {\n return new AnimatedAlways(item);\n}\n"]}

View File

@ -0,0 +1,166 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _val = require("../val");
var _AnimatedNode = _interopRequireDefault(require("./AnimatedNode"));
var _invariant = _interopRequireDefault(require("fbjs/lib/invariant"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
// These values are established by empiricism with tests (tradeoff: performance VS precision)
var NEWTON_ITERATIONS = 4;
var NEWTON_MIN_SLOPE = 0.001;
var SUBDIVISION_PRECISION = 0.0000001;
var SUBDIVISION_MAX_ITERATIONS = 10;
var kSplineTableSize = 11;
var kSampleStepSize = 1.0 / (kSplineTableSize - 1.0);
var float32ArraySupported = typeof Float32Array === 'function';
function A(aA1, aA2) {
return 1.0 - 3.0 * aA2 + 3.0 * aA1;
}
function B(aA1, aA2) {
return 3.0 * aA2 - 6.0 * aA1;
}
function C(aA1) {
return 3.0 * aA1;
} // Returns x(t) given t, x1, and x2, or y(t) given t, y1, and y2.
function calcBezier(aT, aA1, aA2) {
return ((A(aA1, aA2) * aT + B(aA1, aA2)) * aT + C(aA1)) * aT;
} // Returns dx/dt given t, x1, and x2, or dy/dt given t, y1, and y2.
function getSlope(aT, aA1, aA2) {
return 3.0 * A(aA1, aA2) * aT * aT + 2.0 * B(aA1, aA2) * aT + C(aA1);
}
function binarySubdivide(aX, aA, aB, mX1, mX2) {
var currentX = 0;
var currentT = 0;
var i = 0;
do {
currentT = aA + (aB - aA) / 2.0;
currentX = calcBezier(currentT, mX1, mX2) - aX;
if (currentX > 0.0) {
aB = currentT;
} else {
aA = currentT;
}
} while (Math.abs(currentX) > SUBDIVISION_PRECISION && ++i < SUBDIVISION_MAX_ITERATIONS);
return currentT;
}
function newtonRaphsonIterate(aX, aGuessT, mX1, mX2) {
for (var i = 0; i < NEWTON_ITERATIONS; ++i) {
var currentSlope = getSlope(aGuessT, mX1, mX2);
if (currentSlope === 0.0) {
return aGuessT;
}
var currentX = calcBezier(aGuessT, mX1, mX2) - aX;
aGuessT -= currentX / currentSlope;
}
return aGuessT;
}
function bezier(mX1, mY1, mX2, mY2) {
// Precompute samples table
var sampleValues = float32ArraySupported ? new Float32Array(kSplineTableSize) : new Array(kSplineTableSize);
if (mX1 !== mY1 || mX2 !== mY2) {
for (var i = 0; i < kSplineTableSize; ++i) {
sampleValues[i] = calcBezier(i * kSampleStepSize, mX1, mX2);
}
}
function getTForX(aX) {
var intervalStart = 0.0;
var currentSample = 1;
var lastSample = kSplineTableSize - 1;
for (; currentSample !== lastSample && sampleValues[currentSample] <= aX; ++currentSample) {
intervalStart += kSampleStepSize;
}
--currentSample; // Interpolate to provide an initial guess for t
var dist = (aX - sampleValues[currentSample]) / (sampleValues[currentSample + 1] - sampleValues[currentSample]);
var guessForT = intervalStart + dist * kSampleStepSize;
var initialSlope = getSlope(guessForT, mX1, mX2);
if (initialSlope >= NEWTON_MIN_SLOPE) {
return newtonRaphsonIterate(aX, guessForT, mX1, mX2);
} else if (initialSlope === 0.0) {
return guessForT;
} else {
return binarySubdivide(aX, intervalStart, intervalStart + kSampleStepSize, mX1, mX2);
}
}
return function BezierEasing(x) {
if (mX1 === mY1 && mX2 === mY2) {
return x; // linear
} // Because JavaScript number are imprecise, we should guarantee the extremes are right.
if (x === 0) {
return 0;
}
if (x === 1) {
return 1;
}
return calcBezier(getTForX(x), mY1, mY2);
};
}
class AnimatedBezier extends _AnimatedNode.default {
constructor(value, mX1, mY1, mX2, mY2) {
(0, _invariant.default)(value instanceof _AnimatedNode.default, "Reanimated: Bezier node argument should be of type AnimatedNode but got ".concat(value));
super({
type: 'bezier',
mX1,
mY1,
mX2,
mY2,
input: value
}, [value]);
_defineProperty(this, "_value", void 0);
_defineProperty(this, "_bezier", void 0);
this._value = value;
this._bezier = bezier(mX1, mY1, mX2, mY2);
}
toString() {
return "AnimatedBezier, id: ".concat(this.__nodeID);
}
__onEvaluate() {
return this._bezier((0, _val.val)(this._value));
}
}
exports.default = AnimatedBezier;
//# sourceMappingURL=AnimatedBezier.js.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,70 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.createAnimatedBlock = createAnimatedBlock;
exports.adapt = adapt;
var _invariant = _interopRequireDefault(require("fbjs/lib/invariant"));
var _val = require("../val");
var _AnimatedNode = _interopRequireDefault(require("./AnimatedNode"));
var _InternalAnimatedValue = _interopRequireDefault(require("./InternalAnimatedValue"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
class AnimatedBlock extends _AnimatedNode.default {
constructor(array) {
(0, _invariant.default)(array.every(el => el instanceof _AnimatedNode.default), "Reanimated: Animated.block node argument should be an array with elements of type AnimatedNode. One or more of them are not AnimatedNodes");
super({
type: 'block',
block: array
}, array);
_defineProperty(this, "_array", void 0);
this._array = array;
}
toString() {
return "AnimatedBlock, id: ".concat(this.__nodeID);
}
__onEvaluate() {
let result;
this._array.forEach(node => {
result = (0, _val.val)(node);
});
return result;
}
}
function createAnimatedBlock(items) {
return adapt(items);
}
function nodify(v) {
if (typeof v === 'object' && (v === null || v === void 0 ? void 0 : v.__isProxy)) {
if (!v.__val) {
v.__val = new _InternalAnimatedValue.default(0);
}
return v.__val;
} // TODO: cache some typical static values (e.g. 0, 1, -1)
return v instanceof _AnimatedNode.default ? v : _InternalAnimatedValue.default.valueForConstant(v);
}
function adapt(v) {
return Array.isArray(v) ? new AnimatedBlock(v.map(node => adapt(node))) : nodify(v);
}
//# sourceMappingURL=AnimatedBlock.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["AnimatedBlock.js"],"names":["AnimatedBlock","AnimatedNode","constructor","array","every","el","type","block","_array","toString","__nodeID","__onEvaluate","result","forEach","node","createAnimatedBlock","items","adapt","nodify","v","__isProxy","__val","InternalAnimatedValue","valueForConstant","Array","isArray","map"],"mappings":";;;;;;;;AAAA;;AACA;;AACA;;AACA;;;;;;AAEA,MAAMA,aAAN,SAA4BC,qBAA5B,CAAyC;AAGvCC,EAAAA,WAAW,CAACC,KAAD,EAAQ;AACjB,4BACEA,KAAK,CAACC,KAAN,CAAYC,EAAE,IAAIA,EAAE,YAAYJ,qBAAhC,CADF;AAIA,UAAM;AAAEK,MAAAA,IAAI,EAAE,OAAR;AAAiBC,MAAAA,KAAK,EAAEJ;AAAxB,KAAN,EAAuCA,KAAvC;;AALiB;;AAMjB,SAAKK,MAAL,GAAcL,KAAd;AACD;;AAEDM,EAAAA,QAAQ,GAAG;AACT,wCAA6B,KAAKC,QAAlC;AACD;;AAEDC,EAAAA,YAAY,GAAG;AACb,QAAIC,MAAJ;;AACA,SAAKJ,MAAL,CAAYK,OAAZ,CAAoBC,IAAI,IAAI;AAC1BF,MAAAA,MAAM,GAAG,cAAIE,IAAJ,CAAT;AACD,KAFD;;AAGA,WAAOF,MAAP;AACD;;AAtBsC;;AAyBlC,SAASG,mBAAT,CAA6BC,KAA7B,EAAoC;AACzC,SAAOC,KAAK,CAACD,KAAD,CAAZ;AACD;;AAED,SAASE,MAAT,CAAgBC,CAAhB,EAAmB;AACjB,MAAI,OAAOA,CAAP,KAAa,QAAb,KAAyBA,CAAzB,aAAyBA,CAAzB,uBAAyBA,CAAC,CAAEC,SAA5B,CAAJ,EAA2C;AACzC,QAAI,CAACD,CAAC,CAACE,KAAP,EAAc;AACZF,MAAAA,CAAC,CAACE,KAAF,GAAU,IAAIC,8BAAJ,CAA0B,CAA1B,CAAV;AACD;;AACD,WAAOH,CAAC,CAACE,KAAT;AACD,GANgB,CAOjB;;;AACA,SAAOF,CAAC,YAAYlB,qBAAb,GACHkB,CADG,GAEHG,+BAAsBC,gBAAtB,CAAuCJ,CAAvC,CAFJ;AAGD;;AAEM,SAASF,KAAT,CAAeE,CAAf,EAAkB;AACvB,SAAOK,KAAK,CAACC,OAAN,CAAcN,CAAd,IACH,IAAInB,aAAJ,CAAkBmB,CAAC,CAACO,GAAF,CAAMZ,IAAI,IAAIG,KAAK,CAACH,IAAD,CAAnB,CAAlB,CADG,GAEHI,MAAM,CAACC,CAAD,CAFV;AAGD","sourcesContent":["import invariant from 'fbjs/lib/invariant';\nimport { val } from '../val';\nimport AnimatedNode from './AnimatedNode';\nimport InternalAnimatedValue from './InternalAnimatedValue';\n\nclass AnimatedBlock extends AnimatedNode {\n _array;\n\n constructor(array) {\n invariant(\n array.every(el => el instanceof AnimatedNode),\n `Reanimated: Animated.block node argument should be an array with elements of type AnimatedNode. One or more of them are not AnimatedNodes`\n );\n super({ type: 'block', block: array }, array);\n this._array = array;\n }\n\n toString() {\n return `AnimatedBlock, id: ${this.__nodeID}`;\n }\n\n __onEvaluate() {\n let result;\n this._array.forEach(node => {\n result = val(node);\n });\n return result;\n }\n}\n\nexport function createAnimatedBlock(items) {\n return adapt(items);\n}\n\nfunction nodify(v) {\n if (typeof v === 'object' && v?.__isProxy) {\n if (!v.__val) {\n v.__val = new InternalAnimatedValue(0);\n }\n return v.__val;\n }\n // TODO: cache some typical static values (e.g. 0, 1, -1)\n return v instanceof AnimatedNode\n ? v\n : InternalAnimatedValue.valueForConstant(v);\n}\n\nexport function adapt(v) {\n return Array.isArray(v)\n ? new AnimatedBlock(v.map(node => adapt(node)))\n : nodify(v);\n}\n"]}

View File

@ -0,0 +1,78 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.createAnimatedCall = createAnimatedCall;
var _invariant = _interopRequireDefault(require("fbjs/lib/invariant"));
var _ReanimatedEventEmitter = _interopRequireDefault(require("../ReanimatedEventEmitter"));
var _val = require("../val");
var _AnimatedNode = _interopRequireDefault(require("./AnimatedNode"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
const NODE_MAPPING = new Map();
function listener(data) {
const node = NODE_MAPPING.get(data.id);
node && node._callback(data.args);
}
class AnimatedCall extends _AnimatedNode.default {
constructor(args, jsFunction) {
(0, _invariant.default)(args.every(el => el instanceof _AnimatedNode.default), "Reanimated: Animated.call node args should be an array with elements of type AnimatedNode. One or more of them are not AnimatedNodes");
super({
type: 'call',
input: args
}, args);
_defineProperty(this, "_callback", void 0);
_defineProperty(this, "_args", void 0);
this._callback = jsFunction;
this._args = args;
}
toString() {
return "AnimatedCall, id: ".concat(this.__nodeID);
}
__attach() {
super.__attach();
NODE_MAPPING.set(this.__nodeID, this);
if (NODE_MAPPING.size === 1) {
_ReanimatedEventEmitter.default.addListener('onReanimatedCall', listener);
}
}
__detach() {
NODE_MAPPING.delete(this.__nodeID);
if (NODE_MAPPING.size === 0) {
_ReanimatedEventEmitter.default.removeAllListeners('onReanimatedCall');
}
super.__detach();
}
__onEvaluate() {
this._callback(this._args.map(_val.val));
return 0;
}
}
function createAnimatedCall(args, func) {
return new AnimatedCall(args, func);
}
//# sourceMappingURL=AnimatedCall.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["AnimatedCall.js"],"names":["NODE_MAPPING","Map","listener","data","node","get","id","_callback","args","AnimatedCall","AnimatedNode","constructor","jsFunction","every","el","type","input","_args","toString","__nodeID","__attach","set","size","ReanimatedEventEmitter","addListener","__detach","delete","removeAllListeners","__onEvaluate","map","val","createAnimatedCall","func"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;;;;;AAEA,MAAMA,YAAY,GAAG,IAAIC,GAAJ,EAArB;;AAEA,SAASC,QAAT,CAAkBC,IAAlB,EAAwB;AACtB,QAAMC,IAAI,GAAGJ,YAAY,CAACK,GAAb,CAAiBF,IAAI,CAACG,EAAtB,CAAb;AACAF,EAAAA,IAAI,IAAIA,IAAI,CAACG,SAAL,CAAeJ,IAAI,CAACK,IAApB,CAAR;AACD;;AAED,MAAMC,YAAN,SAA2BC,qBAA3B,CAAwC;AAItCC,EAAAA,WAAW,CAACH,IAAD,EAAOI,UAAP,EAAmB;AAC5B,4BACEJ,IAAI,CAACK,KAAL,CAAWC,EAAE,IAAIA,EAAE,YAAYJ,qBAA/B,CADF;AAIA,UAAM;AAAEK,MAAAA,IAAI,EAAE,MAAR;AAAgBC,MAAAA,KAAK,EAAER;AAAvB,KAAN,EAAqCA,IAArC;;AAL4B;;AAAA;;AAM5B,SAAKD,SAAL,GAAiBK,UAAjB;AACA,SAAKK,KAAL,GAAaT,IAAb;AACD;;AAEDU,EAAAA,QAAQ,GAAG;AACT,uCAA4B,KAAKC,QAAjC;AACD;;AAEDC,EAAAA,QAAQ,GAAG;AACT,UAAMA,QAAN;;AACApB,IAAAA,YAAY,CAACqB,GAAb,CAAiB,KAAKF,QAAtB,EAAgC,IAAhC;;AACA,QAAInB,YAAY,CAACsB,IAAb,KAAsB,CAA1B,EAA6B;AAC3BC,sCAAuBC,WAAvB,CAAmC,kBAAnC,EAAuDtB,QAAvD;AACD;AACF;;AAEDuB,EAAAA,QAAQ,GAAG;AACTzB,IAAAA,YAAY,CAAC0B,MAAb,CAAoB,KAAKP,QAAzB;;AACA,QAAInB,YAAY,CAACsB,IAAb,KAAsB,CAA1B,EAA6B;AAC3BC,sCAAuBI,kBAAvB,CAA0C,kBAA1C;AACD;;AACD,UAAMF,QAAN;AACD;;AAEDG,EAAAA,YAAY,GAAG;AACb,SAAKrB,SAAL,CAAe,KAAKU,KAAL,CAAWY,GAAX,CAAeC,QAAf,CAAf;;AACA,WAAO,CAAP;AACD;;AArCqC;;AAwCjC,SAASC,kBAAT,CAA4BvB,IAA5B,EAAkCwB,IAAlC,EAAwC;AAC7C,SAAO,IAAIvB,YAAJ,CAAiBD,IAAjB,EAAuBwB,IAAvB,CAAP;AACD","sourcesContent":["import invariant from 'fbjs/lib/invariant';\nimport ReanimatedEventEmitter from '../ReanimatedEventEmitter';\nimport { val } from '../val';\nimport AnimatedNode from './AnimatedNode';\n\nconst NODE_MAPPING = new Map();\n\nfunction listener(data) {\n const node = NODE_MAPPING.get(data.id);\n node && node._callback(data.args);\n}\n\nclass AnimatedCall extends AnimatedNode {\n _callback;\n _args;\n\n constructor(args, jsFunction) {\n invariant(\n args.every(el => el instanceof AnimatedNode),\n `Reanimated: Animated.call node args should be an array with elements of type AnimatedNode. One or more of them are not AnimatedNodes`\n );\n super({ type: 'call', input: args }, args);\n this._callback = jsFunction;\n this._args = args;\n }\n\n toString() {\n return `AnimatedCall, id: ${this.__nodeID}`;\n }\n\n __attach() {\n super.__attach();\n NODE_MAPPING.set(this.__nodeID, this);\n if (NODE_MAPPING.size === 1) {\n ReanimatedEventEmitter.addListener('onReanimatedCall', listener);\n }\n }\n\n __detach() {\n NODE_MAPPING.delete(this.__nodeID);\n if (NODE_MAPPING.size === 0) {\n ReanimatedEventEmitter.removeAllListeners('onReanimatedCall');\n }\n super.__detach();\n }\n\n __onEvaluate() {\n this._callback(this._args.map(val));\n return 0;\n }\n}\n\nexport function createAnimatedCall(args, func) {\n return new AnimatedCall(args, func);\n}\n"]}

View File

@ -0,0 +1,82 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.createAnimatedCallFunc = createAnimatedCallFunc;
var _AnimatedNode = _interopRequireWildcard(require("./AnimatedNode"));
var _AnimatedBlock = require("./AnimatedBlock");
var _val = require("../val");
var _invariant = _interopRequireDefault(require("fbjs/lib/invariant"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
class AnimatedCallFunc extends _AnimatedNode.default {
constructor(what, args, params) {
(0, _invariant.default)(what instanceof _AnimatedNode.default, "Reanimated: AnimatedCallFunc 'what' argument should be of type AnimatedNode but got ".concat(what));
(0, _invariant.default)(args.every(el => el instanceof _AnimatedNode.default), "Reanimated: every AnimatedCallFunc 'args' argument should be of type AnimatedNode but got ".concat(args));
(0, _invariant.default)(params.every(el => el instanceof _AnimatedNode.default), "Reanimated: every AnimatedCallFunc 'params' argument should be of type AnimatedNode but got ".concat(params));
super({
type: 'callfunc',
what,
args,
params
}, [...args]);
_defineProperty(this, "_previousCallID", void 0);
_defineProperty(this, "_what", void 0);
_defineProperty(this, "_args", void 0);
_defineProperty(this, "_params", void 0);
this._what = what;
this._args = args;
this._params = params;
}
toString() {
return "AnimatedCallFunc, id: ".concat(this.__nodeID);
}
beginContext() {
this._previousCallID = (0, _AnimatedNode.getCallID)();
(0, _AnimatedNode.setCallID)((0, _AnimatedNode.getCallID)() + '/' + this.__nodeID);
this._params.forEach((param, index) => {
param.beginContext(this._args[index], this._previousCallID);
});
}
endContext() {
this._params.forEach((param, index) => {
param.endContext();
});
(0, _AnimatedNode.setCallID)(this._previousCallID);
}
__onEvaluate() {
this.beginContext();
const value = (0, _val.val)(this._what);
this.endContext();
return value;
}
}
function createAnimatedCallFunc(proc, args, params) {
return new AnimatedCallFunc(proc, args.map(p => (0, _AnimatedBlock.adapt)(p)), params);
}
//# sourceMappingURL=AnimatedCallFunc.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["AnimatedCallFunc.js"],"names":["AnimatedCallFunc","AnimatedNode","constructor","what","args","params","every","el","type","_what","_args","_params","toString","__nodeID","beginContext","_previousCallID","forEach","param","index","endContext","__onEvaluate","value","createAnimatedCallFunc","proc","map","p"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;;;;;;;;;AAEA,MAAMA,gBAAN,SAA+BC,qBAA/B,CAA4C;AAK1CC,EAAAA,WAAW,CAACC,IAAD,EAAOC,IAAP,EAAaC,MAAb,EAAqB;AAC9B,4BACEF,IAAI,YAAYF,qBADlB,gGAEyFE,IAFzF;AAIA,4BACEC,IAAI,CAACE,KAAL,CAAWC,EAAE,IAAIA,EAAE,YAAYN,qBAA/B,CADF,sGAE+FG,IAF/F;AAIA,4BACEC,MAAM,CAACC,KAAP,CAAaC,EAAE,IAAIA,EAAE,YAAYN,qBAAjC,CADF,wGAEiGI,MAFjG;AAIA,UACE;AACEG,MAAAA,IAAI,EAAE,UADR;AAEEL,MAAAA,IAFF;AAGEC,MAAAA,IAHF;AAIEC,MAAAA;AAJF,KADF,EAOE,CAAC,GAAGD,IAAJ,CAPF;;AAb8B;;AAAA;;AAAA;;AAAA;;AAsB9B,SAAKK,KAAL,GAAaN,IAAb;AACA,SAAKO,KAAL,GAAaN,IAAb;AACA,SAAKO,OAAL,GAAeN,MAAf;AACD;;AAEDO,EAAAA,QAAQ,GAAG;AACT,2CAAgC,KAAKC,QAArC;AACD;;AAEDC,EAAAA,YAAY,GAAG;AACb,SAAKC,eAAL,GAAuB,8BAAvB;AACA,iCAAU,iCAAc,GAAd,GAAoB,KAAKF,QAAnC;;AAEA,SAAKF,OAAL,CAAaK,OAAb,CAAqB,CAACC,KAAD,EAAQC,KAAR,KAAkB;AACrCD,MAAAA,KAAK,CAACH,YAAN,CAAmB,KAAKJ,KAAL,CAAWQ,KAAX,CAAnB,EAAsC,KAAKH,eAA3C;AACD,KAFD;AAGD;;AAEDI,EAAAA,UAAU,GAAG;AACX,SAAKR,OAAL,CAAaK,OAAb,CAAqB,CAACC,KAAD,EAAQC,KAAR,KAAkB;AACrCD,MAAAA,KAAK,CAACE,UAAN;AACD,KAFD;;AAGA,iCAAU,KAAKJ,eAAf;AACD;;AAEDK,EAAAA,YAAY,GAAG;AACb,SAAKN,YAAL;AACA,UAAMO,KAAK,GAAG,cAAI,KAAKZ,KAAT,CAAd;AACA,SAAKU,UAAL;AACA,WAAOE,KAAP;AACD;;AAzDyC;;AA4DrC,SAASC,sBAAT,CAAgCC,IAAhC,EAAsCnB,IAAtC,EAA4CC,MAA5C,EAAoD;AACzD,SAAO,IAAIL,gBAAJ,CAAqBuB,IAArB,EAA2BnB,IAAI,CAACoB,GAAL,CAASC,CAAC,IAAI,0BAAMA,CAAN,CAAd,CAA3B,EAAoDpB,MAApD,CAAP;AACD","sourcesContent":["import AnimatedNode, { getCallID, setCallID } from './AnimatedNode';\nimport { adapt } from './AnimatedBlock';\nimport { val } from '../val';\nimport invariant from 'fbjs/lib/invariant';\n\nclass AnimatedCallFunc extends AnimatedNode {\n _previousCallID;\n _what;\n _args;\n _params;\n constructor(what, args, params) {\n invariant(\n what instanceof AnimatedNode,\n `Reanimated: AnimatedCallFunc 'what' argument should be of type AnimatedNode but got ${what}`\n );\n invariant(\n args.every(el => el instanceof AnimatedNode),\n `Reanimated: every AnimatedCallFunc 'args' argument should be of type AnimatedNode but got ${args}`\n );\n invariant(\n params.every(el => el instanceof AnimatedNode),\n `Reanimated: every AnimatedCallFunc 'params' argument should be of type AnimatedNode but got ${params}`\n );\n super(\n {\n type: 'callfunc',\n what,\n args,\n params,\n },\n [...args]\n );\n this._what = what;\n this._args = args;\n this._params = params;\n }\n\n toString() {\n return `AnimatedCallFunc, id: ${this.__nodeID}`;\n }\n\n beginContext() {\n this._previousCallID = getCallID();\n setCallID(getCallID() + '/' + this.__nodeID);\n\n this._params.forEach((param, index) => {\n param.beginContext(this._args[index], this._previousCallID);\n });\n }\n\n endContext() {\n this._params.forEach((param, index) => {\n param.endContext();\n });\n setCallID(this._previousCallID);\n }\n\n __onEvaluate() {\n this.beginContext();\n const value = val(this._what);\n this.endContext();\n return value;\n }\n}\n\nexport function createAnimatedCallFunc(proc, args, params) {\n return new AnimatedCallFunc(proc, args.map(p => adapt(p)), params);\n}\n"]}

View File

@ -0,0 +1,122 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _InternalAnimatedValue = _interopRequireDefault(require("./InternalAnimatedValue"));
var _AnimatedNode = _interopRequireDefault(require("./AnimatedNode"));
var _val = require("../val");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
class AnimatedMainClock extends _InternalAnimatedValue.default {
constructor() {
super({
type: 'MAIN_CLOCK'
});
_defineProperty(this, "_frameCallback", void 0);
_defineProperty(this, "_runFrame", () => {
this._updateValue(0);
if (this.__children.length > 0) {
this._frameCallback = requestAnimationFrame(this._runFrame);
}
});
}
__onEvaluate() {
return +new Date();
}
__attach() {
super.__attach();
if (!this._frameCallback) {
this._frameCallback = requestAnimationFrame(this._runFrame);
}
}
__detach() {
if (this._frameCallback) {
cancelAnimationFrame(this._frameCallback);
this._frameCallback = null;
}
super.__detach();
}
}
const mainClock = new AnimatedMainClock();
class AnimatedClock extends _AnimatedNode.default {
constructor() {
super({
type: 'clock'
});
_defineProperty(this, "_started", void 0);
_defineProperty(this, "_attached", void 0);
}
toString() {
return "AnimatedClock, id: ".concat(this.__nodeID);
}
__onEvaluate() {
return (0, _val.val)(mainClock);
}
__attach() {
super.__attach();
if (this._started && !this._attached) {
mainClock.__addChild(this);
}
this._attached = true;
}
__detach() {
if (this._started && this._attached) {
mainClock.__removeChild(this);
}
this._attached = false;
super.__detach();
}
start() {
if (!this._started && this._attached) {
mainClock.__addChild(this);
}
this._started = true;
}
stop() {
if (this._started && this._attached) {
mainClock.__removeChild(this);
}
this._started = false;
}
isStarted() {
return this._started;
}
}
exports.default = AnimatedClock;
//# sourceMappingURL=AnimatedClock.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["AnimatedClock.js"],"names":["AnimatedMainClock","InternalAnimatedValue","constructor","type","_updateValue","__children","length","_frameCallback","requestAnimationFrame","_runFrame","__onEvaluate","Date","__attach","__detach","cancelAnimationFrame","mainClock","AnimatedClock","AnimatedNode","toString","__nodeID","_started","_attached","__addChild","__removeChild","start","stop","isStarted"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;;;;;AAEA,MAAMA,iBAAN,SAAgCC,8BAAhC,CAAsD;AAGpDC,EAAAA,WAAW,GAAG;AACZ,UAAM;AAAEC,MAAAA,IAAI,EAAE;AAAR,KAAN;;AADY;;AAAA,uCAQF,MAAM;AAChB,WAAKC,YAAL,CAAkB,CAAlB;;AACA,UAAI,KAAKC,UAAL,CAAgBC,MAAhB,GAAyB,CAA7B,EAAgC;AAC9B,aAAKC,cAAL,GAAsBC,qBAAqB,CAAC,KAAKC,SAAN,CAA3C;AACD;AACF,KAba;AAEb;;AAEDC,EAAAA,YAAY,GAAG;AACb,WAAO,CAAC,IAAIC,IAAJ,EAAR;AACD;;AASDC,EAAAA,QAAQ,GAAG;AACT,UAAMA,QAAN;;AACA,QAAI,CAAC,KAAKL,cAAV,EAA0B;AACxB,WAAKA,cAAL,GAAsBC,qBAAqB,CAAC,KAAKC,SAAN,CAA3C;AACD;AACF;;AAEDI,EAAAA,QAAQ,GAAG;AACT,QAAI,KAAKN,cAAT,EAAyB;AACvBO,MAAAA,oBAAoB,CAAC,KAAKP,cAAN,CAApB;AACA,WAAKA,cAAL,GAAsB,IAAtB;AACD;;AACD,UAAMM,QAAN;AACD;;AA/BmD;;AAkCtD,MAAME,SAAS,GAAG,IAAIf,iBAAJ,EAAlB;;AAEe,MAAMgB,aAAN,SAA4BC,qBAA5B,CAAyC;AAItDf,EAAAA,WAAW,GAAG;AACZ,UAAM;AAAEC,MAAAA,IAAI,EAAE;AAAR,KAAN;;AADY;;AAAA;AAEb;;AAEDe,EAAAA,QAAQ,GAAG;AACT,wCAA6B,KAAKC,QAAlC;AACD;;AAEDT,EAAAA,YAAY,GAAG;AACb,WAAO,cAAIK,SAAJ,CAAP;AACD;;AAEDH,EAAAA,QAAQ,GAAG;AACT,UAAMA,QAAN;;AACA,QAAI,KAAKQ,QAAL,IAAiB,CAAC,KAAKC,SAA3B,EAAsC;AACpCN,MAAAA,SAAS,CAACO,UAAV,CAAqB,IAArB;AACD;;AACD,SAAKD,SAAL,GAAiB,IAAjB;AACD;;AAEDR,EAAAA,QAAQ,GAAG;AACT,QAAI,KAAKO,QAAL,IAAiB,KAAKC,SAA1B,EAAqC;AACnCN,MAAAA,SAAS,CAACQ,aAAV,CAAwB,IAAxB;AACD;;AACD,SAAKF,SAAL,GAAiB,KAAjB;;AACA,UAAMR,QAAN;AACD;;AAEDW,EAAAA,KAAK,GAAG;AACN,QAAI,CAAC,KAAKJ,QAAN,IAAkB,KAAKC,SAA3B,EAAsC;AACpCN,MAAAA,SAAS,CAACO,UAAV,CAAqB,IAArB;AACD;;AACD,SAAKF,QAAL,GAAgB,IAAhB;AACD;;AAEDK,EAAAA,IAAI,GAAG;AACL,QAAI,KAAKL,QAAL,IAAiB,KAAKC,SAA1B,EAAqC;AACnCN,MAAAA,SAAS,CAACQ,aAAV,CAAwB,IAAxB;AACD;;AACD,SAAKH,QAAL,GAAgB,KAAhB;AACD;;AAEDM,EAAAA,SAAS,GAAG;AACV,WAAO,KAAKN,QAAZ;AACD;;AAhDqD","sourcesContent":["import InternalAnimatedValue from './InternalAnimatedValue';\nimport AnimatedNode from './AnimatedNode';\nimport { val } from '../val';\n\nclass AnimatedMainClock extends InternalAnimatedValue {\n _frameCallback;\n\n constructor() {\n super({ type: 'MAIN_CLOCK' });\n }\n\n __onEvaluate() {\n return +new Date();\n }\n\n _runFrame = () => {\n this._updateValue(0);\n if (this.__children.length > 0) {\n this._frameCallback = requestAnimationFrame(this._runFrame);\n }\n };\n\n __attach() {\n super.__attach();\n if (!this._frameCallback) {\n this._frameCallback = requestAnimationFrame(this._runFrame);\n }\n }\n\n __detach() {\n if (this._frameCallback) {\n cancelAnimationFrame(this._frameCallback);\n this._frameCallback = null;\n }\n super.__detach();\n }\n}\n\nconst mainClock = new AnimatedMainClock();\n\nexport default class AnimatedClock extends AnimatedNode {\n _started;\n _attached;\n\n constructor() {\n super({ type: 'clock' });\n }\n\n toString() {\n return `AnimatedClock, id: ${this.__nodeID}`;\n }\n\n __onEvaluate() {\n return val(mainClock);\n }\n\n __attach() {\n super.__attach();\n if (this._started && !this._attached) {\n mainClock.__addChild(this);\n }\n this._attached = true;\n }\n\n __detach() {\n if (this._started && this._attached) {\n mainClock.__removeChild(this);\n }\n this._attached = false;\n super.__detach();\n }\n\n start() {\n if (!this._started && this._attached) {\n mainClock.__addChild(this);\n }\n this._started = true;\n }\n\n stop() {\n if (this._started && this._attached) {\n mainClock.__removeChild(this);\n }\n this._started = false;\n }\n\n isStarted() {\n return this._started;\n }\n}\n\n"]}

View File

@ -0,0 +1,39 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.createAnimatedClockTest = createAnimatedClockTest;
var _AnimatedNode = _interopRequireDefault(require("./AnimatedNode"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
class AnimatedClockTest extends _AnimatedNode.default {
constructor(clockNode) {
super({
type: 'clockTest',
clock: clockNode
});
_defineProperty(this, "_clockNode", void 0);
this._clockNode = clockNode;
}
toString() {
return "AnimatedClockTest, id: ".concat(this.__nodeID);
}
__onEvaluate() {
return this._clockNode.isStarted() ? 1 : 0;
}
}
function createAnimatedClockTest(clock) {
return new AnimatedClockTest(clock);
}
//# sourceMappingURL=AnimatedClockTest.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["AnimatedClockTest.js"],"names":["AnimatedClockTest","AnimatedNode","constructor","clockNode","type","clock","_clockNode","toString","__nodeID","__onEvaluate","isStarted","createAnimatedClockTest"],"mappings":";;;;;;;AAAA;;;;;;AAEA,MAAMA,iBAAN,SAAgCC,qBAAhC,CAA6C;AAG3CC,EAAAA,WAAW,CAACC,SAAD,EAAY;AACrB,UAAM;AAAEC,MAAAA,IAAI,EAAE,WAAR;AAAqBC,MAAAA,KAAK,EAAEF;AAA5B,KAAN;;AADqB;;AAErB,SAAKG,UAAL,GAAkBH,SAAlB;AACD;;AAEDI,EAAAA,QAAQ,GAAG;AACT,4CAAiC,KAAKC,QAAtC;AACD;;AAEDC,EAAAA,YAAY,GAAG;AACb,WAAO,KAAKH,UAAL,CAAgBI,SAAhB,KAA8B,CAA9B,GAAkC,CAAzC;AACD;;AAd0C;;AAiBtC,SAASC,uBAAT,CAAiCN,KAAjC,EAAwC;AAC7C,SAAO,IAAIL,iBAAJ,CAAsBK,KAAtB,CAAP;AACD","sourcesContent":["import AnimatedNode from './AnimatedNode';\n\nclass AnimatedClockTest extends AnimatedNode {\n _clockNode;\n\n constructor(clockNode) {\n super({ type: 'clockTest', clock: clockNode });\n this._clockNode = clockNode;\n }\n\n toString() {\n return `AnimatedClockTest, id: ${this.__nodeID}`;\n }\n\n __onEvaluate() {\n return this._clockNode.isStarted() ? 1 : 0;\n }\n}\n\nexport function createAnimatedClockTest(clock) {\n return new AnimatedClockTest(clock);\n}\n"]}

View File

@ -0,0 +1,42 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _useCode = _interopRequireDefault(require("../derived/useCode"));
var _AnimatedNode = _interopRequireDefault(require("./AnimatedNode"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function assertNodesNotNull(code, children, exec) {
if (!code) {
const error = !children ? "Got \"".concat(typeof children, "\" type passed to children") : "Got \"".concat(typeof exec, "\" type passed to exec");
throw new Error("<Animated.Code /> expects the 'exec' prop or children to be an animated node or a function returning an animated node. ".concat(error));
}
}
function Code({
exec,
children,
dependencies
}) {
const nodes = children || exec;
let code = null;
if (nodes instanceof _AnimatedNode.default) {
code = () => nodes;
} else if (typeof nodes === 'function') {
code = nodes;
}
assertNodesNotNull(code, children, exec);
(0, _useCode.default)(code, dependencies);
return null;
}
var _default = Code;
exports.default = _default;
//# sourceMappingURL=AnimatedCode.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["AnimatedCode.js"],"names":["assertNodesNotNull","code","children","exec","error","Error","Code","dependencies","nodes","AnimatedNode"],"mappings":";;;;;;;AAAA;;AACA;;;;AAEA,SAASA,kBAAT,CAA4BC,IAA5B,EAAkCC,QAAlC,EAA4CC,IAA5C,EAAkD;AAChD,MAAI,CAACF,IAAL,EAAW;AACT,UAAMG,KAAK,GAAG,CAACF,QAAD,mBACF,OAAOA,QADL,kDAEF,OAAOC,IAFL,2BAAd;AAIA,UAAM,IAAIE,KAAJ,kIACsHD,KADtH,EAAN;AAGD;AACF;;AAED,SAASE,IAAT,CAAc;AAAEH,EAAAA,IAAF;AAAQD,EAAAA,QAAR;AAAkBK,EAAAA;AAAlB,CAAd,EAAgD;AAC9C,QAAMC,KAAK,GAAGN,QAAQ,IAAIC,IAA1B;AAEA,MAAIF,IAAI,GAAG,IAAX;;AACA,MAAIO,KAAK,YAAYC,qBAArB,EAAmC;AACjCR,IAAAA,IAAI,GAAG,MAAMO,KAAb;AACD,GAFD,MAEO,IAAI,OAAOA,KAAP,KAAiB,UAArB,EAAiC;AACtCP,IAAAA,IAAI,GAAGO,KAAP;AACD;;AAEDR,EAAAA,kBAAkB,CAACC,IAAD,EAAOC,QAAP,EAAiBC,IAAjB,CAAlB;AAEA,wBAAQF,IAAR,EAAcM,YAAd;AACA,SAAO,IAAP;AACD;;eAEcD,I","sourcesContent":["import useCode from '../derived/useCode';\nimport AnimatedNode from './AnimatedNode';\n\nfunction assertNodesNotNull(code, children, exec) {\n if (!code) {\n const error = !children\n ? `Got \"${typeof children}\" type passed to children`\n : `Got \"${typeof exec}\" type passed to exec`;\n\n throw new Error(\n `<Animated.Code /> expects the 'exec' prop or children to be an animated node or a function returning an animated node. ${error}`\n );\n }\n}\n\nfunction Code({ exec, children, dependencies }) {\n const nodes = children || exec;\n\n let code = null;\n if (nodes instanceof AnimatedNode) {\n code = () => nodes;\n } else if (typeof nodes === 'function') {\n code = nodes;\n }\n\n assertNodesNotNull(code, children, exec);\n\n useCode(code, dependencies);\n return null;\n}\n\nexport default Code;\n"]}

View File

@ -0,0 +1,41 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.createAnimatedConcat = createAnimatedConcat;
var _invariant = _interopRequireDefault(require("fbjs/lib/invariant"));
var _AnimatedBlock = require("../core/AnimatedBlock");
var _AnimatedNode = _interopRequireDefault(require("./AnimatedNode"));
var _val = require("../val");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
class AnimatedConcat extends _AnimatedNode.default {
constructor(input) {
(0, _invariant.default)(input.every(el => el instanceof _AnimatedNode.default || typeof el === 'number' || typeof el === 'string'), "Reanimated: Animated.concat node arguments should be of type AnimatedNode or String or Number. One or more of them are not of that type. Node: ".concat(input));
super({
type: 'concat',
input
}, input);
this._input = input;
}
__onEvaluate() {
return this._input.reduce((prev, current) => prev + (0, _val.val)(current), '');
}
toString() {
return "AnimatedConcat, id: ".concat(this.__nodeID);
}
}
function createAnimatedConcat(...args) {
return new AnimatedConcat(args.map(_AnimatedBlock.adapt));
}
//# sourceMappingURL=AnimatedConcat.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["AnimatedConcat.js"],"names":["AnimatedConcat","AnimatedNode","constructor","input","every","el","type","_input","__onEvaluate","reduce","prev","current","toString","__nodeID","createAnimatedConcat","args","map","adapt"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;;;AAEA,MAAMA,cAAN,SAA6BC,qBAA7B,CAA0C;AACxCC,EAAAA,WAAW,CAACC,KAAD,EAAQ;AACjB,4BACEA,KAAK,CAACC,KAAN,CACEC,EAAE,IACAA,EAAE,YAAYJ,qBAAd,IACA,OAAOI,EAAP,KAAc,QADd,IAEA,OAAOA,EAAP,KAAc,QAJlB,CADF,2JAOoJF,KAPpJ;AASA,UAAM;AAAEG,MAAAA,IAAI,EAAE,QAAR;AAAkBH,MAAAA;AAAlB,KAAN,EAAiCA,KAAjC;AACA,SAAKI,MAAL,GAAcJ,KAAd;AACD;;AAEDK,EAAAA,YAAY,GAAG;AACb,WAAO,KAAKD,MAAL,CAAYE,MAAZ,CAAmB,CAACC,IAAD,EAAOC,OAAP,KAAmBD,IAAI,GAAG,cAAIC,OAAJ,CAA7C,EAA2D,EAA3D,CAAP;AACD;;AAEDC,EAAAA,QAAQ,GAAG;AACT,yCAA8B,KAAKC,QAAnC;AACD;;AArBuC;;AAwBnC,SAASC,oBAAT,CAA8B,GAAGC,IAAjC,EAAuC;AAC5C,SAAO,IAAIf,cAAJ,CAAmBe,IAAI,CAACC,GAAL,CAASC,oBAAT,CAAnB,CAAP;AACD","sourcesContent":["import invariant from 'fbjs/lib/invariant';\nimport { adapt } from '../core/AnimatedBlock';\nimport AnimatedNode from './AnimatedNode';\nimport { val } from '../val';\n\nclass AnimatedConcat extends AnimatedNode {\n constructor(input) {\n invariant(\n input.every(\n el =>\n el instanceof AnimatedNode ||\n typeof el === 'number' ||\n typeof el === 'string'\n ),\n `Reanimated: Animated.concat node arguments should be of type AnimatedNode or String or Number. One or more of them are not of that type. Node: ${input}`\n );\n super({ type: 'concat', input }, input);\n this._input = input;\n }\n\n __onEvaluate() {\n return this._input.reduce((prev, current) => prev + val(current), '');\n }\n\n toString() {\n return `AnimatedConcat, id: ${this.__nodeID}`;\n }\n}\n\nexport function createAnimatedConcat(...args) {\n return new AnimatedConcat(args.map(adapt));\n}\n"]}

View File

@ -0,0 +1,60 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.createAnimatedCond = createAnimatedCond;
var _invariant = _interopRequireDefault(require("fbjs/lib/invariant"));
var _AnimatedBlock = require("../core/AnimatedBlock");
var _val = require("../val");
var _AnimatedNode = _interopRequireDefault(require("./AnimatedNode"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
class AnimatedCond extends _AnimatedNode.default {
constructor(condition, ifBlock, elseBlock) {
(0, _invariant.default)(condition instanceof _AnimatedNode.default, "Reanimated: Animated.cond node first argument should be of type AnimatedNode but got ".concat(condition));
(0, _invariant.default)(ifBlock instanceof _AnimatedNode.default, "Reanimated: Animated.cond node second argument should be of type AnimatedNode but got ".concat(ifBlock));
(0, _invariant.default)(elseBlock instanceof _AnimatedNode.default || elseBlock === undefined, "Reanimated: Animated.cond node third argument should be of type AnimatedNode or should be undefined but got ".concat(elseBlock));
super({
type: 'cond',
cond: condition,
ifBlock,
elseBlock
}, [condition, ifBlock, elseBlock]);
_defineProperty(this, "_condition", void 0);
_defineProperty(this, "_ifBlock", void 0);
_defineProperty(this, "_elseBlock", void 0);
this._condition = condition;
this._ifBlock = ifBlock;
this._elseBlock = elseBlock;
}
toString() {
return "AnimatedCond, id: ".concat(this.__nodeID);
}
__onEvaluate() {
if ((0, _val.val)(this._condition)) {
return (0, _val.val)(this._ifBlock);
} else {
return this._elseBlock !== undefined ? (0, _val.val)(this._elseBlock) : undefined;
}
}
}
function createAnimatedCond(cond, ifBlock, elseBlock) {
return new AnimatedCond((0, _AnimatedBlock.adapt)(cond), (0, _AnimatedBlock.adapt)(ifBlock), elseBlock === undefined ? undefined : (0, _AnimatedBlock.adapt)(elseBlock));
}
//# sourceMappingURL=AnimatedCond.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["AnimatedCond.js"],"names":["AnimatedCond","AnimatedNode","constructor","condition","ifBlock","elseBlock","undefined","type","cond","_condition","_ifBlock","_elseBlock","toString","__nodeID","__onEvaluate","createAnimatedCond"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;;;;;AAEA,MAAMA,YAAN,SAA2BC,qBAA3B,CAAwC;AAKtCC,EAAAA,WAAW,CAACC,SAAD,EAAYC,OAAZ,EAAqBC,SAArB,EAAgC;AACzC,4BACEF,SAAS,YAAYF,qBADvB,iGAE0FE,SAF1F;AAIA,4BACEC,OAAO,YAAYH,qBADrB,kGAE2FG,OAF3F;AAIA,4BACEC,SAAS,YAAYJ,qBAArB,IAAqCI,SAAS,KAAKC,SADrD,wHAEiHD,SAFjH;AAIA,UACE;AACEE,MAAAA,IAAI,EAAE,MADR;AAEEC,MAAAA,IAAI,EAAEL,SAFR;AAGEC,MAAAA,OAHF;AAIEC,MAAAA;AAJF,KADF,EAOE,CAACF,SAAD,EAAYC,OAAZ,EAAqBC,SAArB,CAPF;;AAbyC;;AAAA;;AAAA;;AAsBzC,SAAKI,UAAL,GAAkBN,SAAlB;AACA,SAAKO,QAAL,GAAgBN,OAAhB;AACA,SAAKO,UAAL,GAAkBN,SAAlB;AACD;;AAEDO,EAAAA,QAAQ,GAAG;AACT,uCAA4B,KAAKC,QAAjC;AACD;;AAEDC,EAAAA,YAAY,GAAG;AACb,QAAI,cAAI,KAAKL,UAAT,CAAJ,EAA0B;AACxB,aAAO,cAAI,KAAKC,QAAT,CAAP;AACD,KAFD,MAEO;AACL,aAAO,KAAKC,UAAL,KAAoBL,SAApB,GAAgC,cAAI,KAAKK,UAAT,CAAhC,GAAuDL,SAA9D;AACD;AACF;;AA1CqC;;AA6CjC,SAASS,kBAAT,CAA4BP,IAA5B,EAAkCJ,OAAlC,EAA2CC,SAA3C,EAAsD;AAC3D,SAAO,IAAIL,YAAJ,CACL,0BAAMQ,IAAN,CADK,EAEL,0BAAMJ,OAAN,CAFK,EAGLC,SAAS,KAAKC,SAAd,GAA0BA,SAA1B,GAAsC,0BAAMD,SAAN,CAHjC,CAAP;AAKD","sourcesContent":["import invariant from 'fbjs/lib/invariant';\nimport { adapt } from '../core/AnimatedBlock';\nimport { val } from '../val';\nimport AnimatedNode from './AnimatedNode';\n\nclass AnimatedCond extends AnimatedNode {\n _condition;\n _ifBlock;\n _elseBlock;\n\n constructor(condition, ifBlock, elseBlock) {\n invariant(\n condition instanceof AnimatedNode,\n `Reanimated: Animated.cond node first argument should be of type AnimatedNode but got ${condition}`\n );\n invariant(\n ifBlock instanceof AnimatedNode,\n `Reanimated: Animated.cond node second argument should be of type AnimatedNode but got ${ifBlock}`\n );\n invariant(\n elseBlock instanceof AnimatedNode || elseBlock === undefined,\n `Reanimated: Animated.cond node third argument should be of type AnimatedNode or should be undefined but got ${elseBlock}`\n );\n super(\n {\n type: 'cond',\n cond: condition,\n ifBlock,\n elseBlock,\n },\n [condition, ifBlock, elseBlock]\n );\n this._condition = condition;\n this._ifBlock = ifBlock;\n this._elseBlock = elseBlock;\n }\n\n toString() {\n return `AnimatedCond, id: ${this.__nodeID}`;\n }\n\n __onEvaluate() {\n if (val(this._condition)) {\n return val(this._ifBlock);\n } else {\n return this._elseBlock !== undefined ? val(this._elseBlock) : undefined;\n }\n }\n}\n\nexport function createAnimatedCond(cond, ifBlock, elseBlock) {\n return new AnimatedCond(\n adapt(cond),\n adapt(ifBlock),\n elseBlock === undefined ? undefined : adapt(elseBlock)\n );\n}\n"]}

View File

@ -0,0 +1,77 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.createAnimatedDebug = createAnimatedDebug;
var _invariant = _interopRequireDefault(require("fbjs/lib/invariant"));
var _reactNative = require("react-native");
var _val = require("../val");
var _AnimatedBlock = require("./AnimatedBlock");
var _AnimatedCall = require("./AnimatedCall");
var _AnimatedNode = _interopRequireDefault(require("./AnimatedNode"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
class AnimatedDebug extends _AnimatedNode.default {
constructor(message, value) {
(0, _invariant.default)(typeof message === 'string', "Reanimated: Animated.debug node first argument should be of type string but got ".concat(message));
(0, _invariant.default)(value instanceof _AnimatedNode.default, "Reanimated: Animated.debug node second argument should be of type AnimatedNode but got ".concat(value));
super({
type: 'debug',
message,
value
}, [value]);
_defineProperty(this, "_message", void 0);
_defineProperty(this, "_value", void 0);
this._message = message;
this._value = value;
}
toString() {
return "AnimatedDebug, id: ".concat(this.__nodeID);
}
__onEvaluate() {
const value = (0, _val.val)(this._value);
console.log(this._message, value);
return value;
}
}
function createAnimatedDebug(message, value) {
if (__DEV__) {
var _NativeModules$Native, _NativeModules$Native2, _NativeModules$Native3;
// hack to detect if app is running in remote debugger
// https://stackoverflow.com/questions/39022216
const runningInRemoteDebugger = typeof atob !== 'undefined'; // read the executionEnvironment off of expo-constants without explicitly
// depending on the package
const runningInExpoShell = ((_NativeModules$Native = _reactNative.NativeModules.NativeUnimoduleProxy) === null || _NativeModules$Native === void 0 ? void 0 : (_NativeModules$Native2 = _NativeModules$Native.modulesConstants) === null || _NativeModules$Native2 === void 0 ? void 0 : (_NativeModules$Native3 = _NativeModules$Native2.ExponentConstants) === null || _NativeModules$Native3 === void 0 ? void 0 : _NativeModules$Native3.executionEnvironment) === 'storeClient';
if (runningInRemoteDebugger || runningInExpoShell) {
// When running in expo or remote debugger we use JS console.log to output variables
// otherwise we output to the native console using native debug node
return (0, _AnimatedBlock.createAnimatedBlock)([(0, _AnimatedCall.createAnimatedCall)([value], ([a]) => console.log("".concat(message, " ").concat(a))), value]);
} else {
return new AnimatedDebug(message, (0, _AnimatedBlock.adapt)(value));
}
} // Debugging is disabled in PROD
return value;
}
//# sourceMappingURL=AnimatedDebug.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["AnimatedDebug.js"],"names":["AnimatedDebug","AnimatedNode","constructor","message","value","type","_message","_value","toString","__nodeID","__onEvaluate","console","log","createAnimatedDebug","__DEV__","runningInRemoteDebugger","atob","runningInExpoShell","NativeUnimoduleProxy","modulesConstants","ExponentConstants","executionEnvironment","a"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;AAEA,MAAMA,aAAN,SAA4BC,qBAA5B,CAAyC;AAIvCC,EAAAA,WAAW,CAACC,OAAD,EAAUC,KAAV,EAAiB;AAC1B,4BACE,OAAOD,OAAP,KAAmB,QADrB,4FAEqFA,OAFrF;AAIA,4BACEC,KAAK,YAAYH,qBADnB,mGAE4FG,KAF5F;AAIA,UAAM;AAAEC,MAAAA,IAAI,EAAE,OAAR;AAAiBF,MAAAA,OAAjB;AAA0BC,MAAAA;AAA1B,KAAN,EAAyC,CAACA,KAAD,CAAzC;;AAT0B;;AAAA;;AAU1B,SAAKE,QAAL,GAAgBH,OAAhB;AACA,SAAKI,MAAL,GAAcH,KAAd;AACD;;AAEDI,EAAAA,QAAQ,GAAG;AACT,wCAA6B,KAAKC,QAAlC;AACD;;AAEDC,EAAAA,YAAY,GAAG;AACb,UAAMN,KAAK,GAAG,cAAI,KAAKG,MAAT,CAAd;AACAI,IAAAA,OAAO,CAACC,GAAR,CAAY,KAAKN,QAAjB,EAA2BF,KAA3B;AACA,WAAOA,KAAP;AACD;;AA1BsC;;AA6BlC,SAASS,mBAAT,CAA6BV,OAA7B,EAAsCC,KAAtC,EAA6C;AAClD,MAAIU,OAAJ,EAAa;AAAA;;AACX;AACA;AACA,UAAMC,uBAAuB,GAAG,OAAOC,IAAP,KAAgB,WAAhD,CAHW,CAKX;AACA;;AACA,UAAMC,kBAAkB,GACtB,qDAAcC,oBAAd,0GAAoCC,gBAApC,4GAAsDC,iBAAtD,kFACIC,oBADJ,MAC6B,aAF/B;;AAIA,QAAIN,uBAAuB,IAAIE,kBAA/B,EAAmD;AACjD;AACA;AACA,aAAO,wCAAM,CACX,sCAAK,CAACb,KAAD,CAAL,EAAc,CAAC,CAACkB,CAAD,CAAD,KAASX,OAAO,CAACC,GAAR,WAAeT,OAAf,cAA0BmB,CAA1B,EAAvB,CADW,EAEXlB,KAFW,CAAN,CAAP;AAID,KAPD,MAOO;AACL,aAAO,IAAIJ,aAAJ,CAAkBG,OAAlB,EAA2B,0BAAMC,KAAN,CAA3B,CAAP;AACD;AACF,GAtBiD,CAuBlD;;;AACA,SAAOA,KAAP;AACD","sourcesContent":["import invariant from 'fbjs/lib/invariant';\nimport { NativeModules } from 'react-native';\nimport { val } from '../val';\nimport { adapt, createAnimatedBlock as block } from './AnimatedBlock';\nimport { createAnimatedCall as call } from './AnimatedCall';\nimport AnimatedNode from './AnimatedNode';\n\nclass AnimatedDebug extends AnimatedNode {\n _message;\n _value;\n\n constructor(message, value) {\n invariant(\n typeof message === 'string',\n `Reanimated: Animated.debug node first argument should be of type string but got ${message}`\n );\n invariant(\n value instanceof AnimatedNode,\n `Reanimated: Animated.debug node second argument should be of type AnimatedNode but got ${value}`\n );\n super({ type: 'debug', message, value }, [value]);\n this._message = message;\n this._value = value;\n }\n\n toString() {\n return `AnimatedDebug, id: ${this.__nodeID}`;\n }\n\n __onEvaluate() {\n const value = val(this._value);\n console.log(this._message, value);\n return value;\n }\n}\n\nexport function createAnimatedDebug(message, value) {\n if (__DEV__) {\n // hack to detect if app is running in remote debugger\n // https://stackoverflow.com/questions/39022216\n const runningInRemoteDebugger = typeof atob !== 'undefined';\n\n // read the executionEnvironment off of expo-constants without explicitly\n // depending on the package\n const runningInExpoShell =\n NativeModules.NativeUnimoduleProxy?.modulesConstants?.ExponentConstants\n ?.executionEnvironment === 'storeClient';\n\n if (runningInRemoteDebugger || runningInExpoShell) {\n // When running in expo or remote debugger we use JS console.log to output variables\n // otherwise we output to the native console using native debug node\n return block([\n call([value], ([a]) => console.log(`${message} ${a}`)),\n value,\n ]);\n } else {\n return new AnimatedDebug(message, adapt(value));\n }\n }\n // Debugging is disabled in PROD\n return value;\n}\n"]}

View File

@ -0,0 +1,154 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.createAnimatedEvent = createAnimatedEvent;
exports.default = void 0;
var _reactNative = require("react-native");
var _ReanimatedModule = _interopRequireDefault(require("../ReanimatedModule"));
var _AnimatedNode = _interopRequireDefault(require("./AnimatedNode"));
var _AnimatedValue = _interopRequireDefault(require("./AnimatedValue"));
var _AnimatedAlways = require("./AnimatedAlways");
var _invariant = _interopRequireDefault(require("fbjs/lib/invariant"));
var _createEventObjectProxyPolyfill = _interopRequireDefault(require("./createEventObjectProxyPolyfill"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function sanitizeArgMapping(argMapping) {
// Find animated values in `argMapping` and create an array representing their
// key path inside the `nativeEvent` object. Ex.: ['contentOffset', 'x'].
const eventMappings = [];
const alwaysNodes = [];
const getNode = node => {
if (_reactNative.Platform.OS === 'web' || _reactNative.Platform.OS === 'windows' || _reactNative.Platform.OS === 'macos') {
return node;
}
return node.__nodeID;
};
const traverse = (value, path) => {
if (value instanceof _AnimatedValue.default) {
eventMappings.push(path.concat(getNode(value)));
} else if (typeof value === 'object' && value.__val) {
eventMappings.push(path.concat(getNode(value.__val)));
} else if (typeof value === 'function') {
const node = new _AnimatedValue.default(0);
alwaysNodes.push((0, _AnimatedAlways.createAnimatedAlways)(value(node)));
eventMappings.push(path.concat(getNode(node)));
} else if (typeof value === 'object') {
for (const key in value) {
traverse(value[key], path.concat(key));
}
}
};
(0, _invariant.default)(argMapping[0] && argMapping[0].nativeEvent, 'Native driven events only support animated values contained inside `nativeEvent`.'); // Assume that the event containing `nativeEvent` is always the first argument.
const ev = argMapping[0].nativeEvent;
if (typeof ev === 'object') {
traverse(ev, []);
} else if (typeof ev === 'function') {
const proxyHandler = {
get: function get(target, name) {
if (name === '__isProxy') {
return true;
}
if (!target[name] && name !== '__val') {
target[name] = new Proxy({}, proxyHandler);
}
return target[name];
},
set: function set(target, prop, value) {
if (prop === '__val') {
target[prop] = value;
return true;
}
return false;
}
};
const proxy = typeof Proxy === 'function' ? new Proxy({}, proxyHandler) : (0, _createEventObjectProxyPolyfill.default)();
alwaysNodes.push((0, _AnimatedAlways.createAnimatedAlways)(ev(proxy)));
traverse(proxy, []);
}
return {
eventMappings,
alwaysNodes
};
}
class AnimatedEvent extends _AnimatedNode.default {
constructor(argMapping, config = {}) {
const {
eventMappings,
alwaysNodes
} = sanitizeArgMapping(argMapping);
super({
type: 'event',
argMapping: eventMappings
});
_defineProperty(this, "__isNative", true);
this._alwaysNodes = alwaysNodes;
}
toString() {
return "AnimatedEvent, id: ".concat(this.__nodeID);
} // The below field is a temporary workaround to make AnimatedEvent object be recognized
// as Animated.event event callback and therefore filtered out from being send over the
// bridge which was causing the object to be frozen in JS.
attachEvent(viewRef, eventName) {
for (let i = 0; i < this._alwaysNodes.length; i++) {
this._alwaysNodes[i].__attach();
}
this.__attach();
const viewTag = (0, _reactNative.findNodeHandle)(viewRef);
_ReanimatedModule.default.attachEvent(viewTag, eventName, this.__nodeID);
}
__onEvaluate() {
return 0;
}
detachEvent(viewRef, eventName) {
for (let i = 0; i < this._alwaysNodes.length; i++) {
this._alwaysNodes[i].isNativelyInitialized() && this._alwaysNodes[i].__detach();
}
const viewTag = (0, _reactNative.findNodeHandle)(viewRef);
_ReanimatedModule.default.detachEvent(viewTag, eventName, this.__nodeID);
this.__detach();
}
}
exports.default = AnimatedEvent;
function createAnimatedEvent(argMapping, config) {
return new AnimatedEvent(argMapping, config);
}
//# sourceMappingURL=AnimatedEvent.js.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,65 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.createAnimatedFunction = createAnimatedFunction;
var _AnimatedNode = _interopRequireDefault(require("./AnimatedNode"));
var _AnimatedCallFunc = require("./AnimatedCallFunc");
var _AnimatedParam = require("./AnimatedParam");
var _val = require("../val");
var _invariant = _interopRequireDefault(require("fbjs/lib/invariant"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
class AnimatedFunction extends _AnimatedNode.default {
constructor(what, ...params) {
(0, _invariant.default)(what instanceof _AnimatedNode.default, "Reanimated: AnimatedCallFunc 'what' argument should be of type AnimatedNode but got ".concat(what));
super({
type: 'func',
what
}, [what, ...params]);
_defineProperty(this, "_what", void 0);
this._what = what;
this.__attach();
}
__onEvaluate() {
return (0, _val.val)(this._what);
}
toString() {
return "AnimatedFunction, id: ".concat(this.__nodeID);
}
}
function createAnimatedFunction(cb) {
const params = new Array(cb.length);
for (let i = 0; i < params.length; i++) {
params[i] = (0, _AnimatedParam.createAnimatedParam)();
} // eslint-disable-next-line standard/no-callback-literal
const what = cb(...params);
const func = new AnimatedFunction(what, ...params);
return (...args) => {
if (args.length !== params.length) {
throw new Error('Parameter mismatch when calling reanimated function. Expected ' + params.length + ' parameters, got ' + args.length + '.');
}
return (0, _AnimatedCallFunc.createAnimatedCallFunc)(func, args, params);
};
}
//# sourceMappingURL=AnimatedFunction.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["AnimatedFunction.js"],"names":["AnimatedFunction","AnimatedNode","constructor","what","params","type","_what","__attach","__onEvaluate","toString","__nodeID","createAnimatedFunction","cb","Array","length","i","func","args","Error"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;;;;;AAEA,MAAMA,gBAAN,SAA+BC,qBAA/B,CAA4C;AAG1CC,EAAAA,WAAW,CAACC,IAAD,EAAO,GAAGC,MAAV,EAAkB;AAC3B,4BACED,IAAI,YAAYF,qBADlB,gGAEyFE,IAFzF;AAIA,UACE;AACEE,MAAAA,IAAI,EAAE,MADR;AAEEF,MAAAA;AAFF,KADF,EAKE,CAACA,IAAD,EAAO,GAAGC,MAAV,CALF;;AAL2B;;AAY3B,SAAKE,KAAL,GAAaH,IAAb;;AACA,SAAKI,QAAL;AACD;;AAEDC,EAAAA,YAAY,GAAG;AACb,WAAO,cAAI,KAAKF,KAAT,CAAP;AACD;;AAEDG,EAAAA,QAAQ,GAAG;AACT,2CAAgC,KAAKC,QAArC;AACD;;AAzByC;;AA4BrC,SAASC,sBAAT,CAAgCC,EAAhC,EAAoC;AACzC,QAAMR,MAAM,GAAG,IAAIS,KAAJ,CAAUD,EAAE,CAACE,MAAb,CAAf;;AACA,OAAK,IAAIC,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGX,MAAM,CAACU,MAA3B,EAAmCC,CAAC,EAApC,EAAwC;AACtCX,IAAAA,MAAM,CAACW,CAAD,CAAN,GAAY,yCAAZ;AACD,GAJwC,CAKzC;;;AACA,QAAMZ,IAAI,GAAGS,EAAE,CAAC,GAAGR,MAAJ,CAAf;AACA,QAAMY,IAAI,GAAG,IAAIhB,gBAAJ,CAAqBG,IAArB,EAA2B,GAAGC,MAA9B,CAAb;AACA,SAAO,CAAC,GAAGa,IAAJ,KAAa;AAClB,QAAIA,IAAI,CAACH,MAAL,KAAgBV,MAAM,CAACU,MAA3B,EAAmC;AACjC,YAAM,IAAII,KAAJ,CACJ,mEACEd,MAAM,CAACU,MADT,GAEE,mBAFF,GAGEG,IAAI,CAACH,MAHP,GAIE,GALE,CAAN;AAOD;;AACD,WAAO,8CAAuBE,IAAvB,EAA6BC,IAA7B,EAAmCb,MAAnC,CAAP;AACD,GAXD;AAYD","sourcesContent":["import AnimatedNode from './AnimatedNode';\nimport { createAnimatedCallFunc } from './AnimatedCallFunc';\nimport { createAnimatedParam } from './AnimatedParam';\nimport { val } from '../val';\nimport invariant from 'fbjs/lib/invariant';\n\nclass AnimatedFunction extends AnimatedNode {\n _what;\n\n constructor(what, ...params) {\n invariant(\n what instanceof AnimatedNode,\n `Reanimated: AnimatedCallFunc 'what' argument should be of type AnimatedNode but got ${what}`\n );\n super(\n {\n type: 'func',\n what,\n },\n [what, ...params]\n );\n this._what = what;\n this.__attach();\n }\n\n __onEvaluate() {\n return val(this._what);\n }\n\n toString() {\n return `AnimatedFunction, id: ${this.__nodeID}`;\n }\n}\n\nexport function createAnimatedFunction(cb) {\n const params = new Array(cb.length);\n for (let i = 0; i < params.length; i++) {\n params[i] = createAnimatedParam();\n }\n // eslint-disable-next-line standard/no-callback-literal\n const what = cb(...params);\n const func = new AnimatedFunction(what, ...params);\n return (...args) => {\n if (args.length !== params.length) {\n throw new Error(\n 'Parameter mismatch when calling reanimated function. Expected ' +\n params.length +\n ' parameters, got ' +\n args.length +\n '.'\n );\n }\n return createAnimatedCallFunc(func, args, params);\n };\n}\n"]}

View File

@ -0,0 +1,263 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getCallID = getCallID;
exports.setCallID = setCallID;
exports.default = void 0;
var _ReanimatedModule = _interopRequireDefault(require("../ReanimatedModule"));
var _reactNative = require("react-native");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
const UPDATED_NODES = [];
let loopID = 1;
let propUpdatesEnqueued = null;
let nodeCount = 0;
let callID = "";
function getCallID() {
return callID;
}
function setCallID(nextCallID) {
callID = nextCallID;
}
function sanitizeConfig(config) {
if (_reactNative.Platform.OS === 'web' || _reactNative.Platform.OS === 'windows' || _reactNative.Platform.OS === 'macos' || ['undefined', 'string', 'function', 'boolean', 'number'].includes(typeof config)) {
return config;
} else if (Array.isArray(config)) {
return config.map(sanitizeConfig);
} else if (config instanceof AnimatedNode) {
return config.__nodeID;
} else if (typeof config === 'object') {
const output = {};
for (const property in config) {
if (property in config) {
output[property] = sanitizeConfig(config[property]);
}
}
return output;
} // unhandled
return config;
}
function runPropUpdates() {
const visitedNodes = new Set();
const findAndUpdateNodes = node => {
if (!node) {
console.warn('findAndUpdateNodes was passed a nullish node');
return;
}
if (visitedNodes.has(node)) {
return;
} else {
visitedNodes.add(node);
}
if (typeof node.update === 'function') {
node.update();
} else {
const nodes = node.__getChildren();
if (nodes) {
for (let i = 0, l = nodes.length; i < l; i++) {
findAndUpdateNodes(nodes[i]);
}
}
}
};
for (let i = 0; i < UPDATED_NODES.length; i++) {
const node = UPDATED_NODES[i];
findAndUpdateNodes(node);
}
UPDATED_NODES.length = 0; // clear array
propUpdatesEnqueued = null;
loopID += 1;
}
const scheduleUpdates = _reactNative.Platform.OS === 'web' ? requestAnimationFrame : setImmediate;
class AnimatedNode {
constructor(nodeConfig, inputNodes) {
_defineProperty(this, "__nodeID", void 0);
_defineProperty(this, "__lastLoopID", {
"": -1
});
_defineProperty(this, "__memoizedValue", {
"": null
});
_defineProperty(this, "__children", []);
this.__nodeID = ++nodeCount;
this.__nodeConfig = sanitizeConfig(nodeConfig);
this.__initialized = false;
this.__inputNodes = inputNodes && inputNodes.filter(node => node instanceof AnimatedNode);
}
toString() {
return "AnimatedNode, id: ".concat(this.__nodeID);
}
__attach() {
this.__nativeInitialize();
const nodes = this.__inputNodes;
if (nodes) {
for (let i = 0, l = nodes.length; i < l; i++) {
nodes[i].__addChild(this);
}
}
}
__detach() {
const nodes = this.__inputNodes;
if (nodes) {
for (let i = 0, l = nodes.length; i < l; i++) {
nodes[i].__removeChild(this);
}
}
this.__nativeTearDown();
}
__getValue() {
if (!(callID in this.__lastLoopID) || this.__lastLoopID[callID] < loopID) {
this.__lastLoopID[callID] = loopID;
const result = this.__onEvaluate();
this.__memoizedValue[callID] = result;
return result;
}
return this.__memoizedValue[callID];
}
__forceUpdateCache(newValue) {
this.__memoizedValue[callID] = newValue;
this.__markUpdated();
}
__dangerouslyRescheduleEvaluate() {
this.__lastLoopID[callID] = -1;
this.__markUpdated();
}
__markUpdated() {
UPDATED_NODES.push(this);
if (!propUpdatesEnqueued) {
propUpdatesEnqueued = scheduleUpdates(runPropUpdates);
}
}
__nativeInitialize() {
if (!this.__initialized) {
_ReanimatedModule.default.createNode(this.__nodeID, _objectSpread({}, this.__nodeConfig));
this.__initialized = true;
}
}
__nativeTearDown() {
if (this.__initialized) {
_ReanimatedModule.default.dropNode(this.__nodeID);
this.__initialized = false;
}
}
isNativelyInitialized() {
return this.__initialized;
}
__onEvaluate() {
throw new Error('Missing implementation of onEvaluate');
}
__getProps() {
return this.__getValue();
}
__getChildren() {
return this.__children;
}
__addChild(child) {
if (this.__children.length === 0) {
this.__attach();
}
this.__children.push(child);
child.__nativeInitialize();
if (_ReanimatedModule.default.connectNodes) {
_ReanimatedModule.default.connectNodes(this.__nodeID, child.__nodeID);
} else {
child.__dangerouslyRescheduleEvaluate();
}
}
__removeChild(child) {
const index = this.__children.indexOf(child);
if (index === -1) {
console.warn("Trying to remove a child that doesn't exist");
return;
}
if (_ReanimatedModule.default.disconnectNodes) {
_ReanimatedModule.default.disconnectNodes(this.__nodeID, child.__nodeID);
}
this.__children.splice(index, 1);
if (this.__children.length === 0) {
this.__detach();
}
}
_connectAnimatedView(nativeViewTag) {
if (_ReanimatedModule.default.connectNodeToView) {
_ReanimatedModule.default.connectNodeToView(this.__nodeID, nativeViewTag);
} else {
this.__dangerouslyRescheduleEvaluate();
}
}
_disconnectAnimatedView(nativeViewTag) {
_ReanimatedModule.default.disconnectNodeFromView(this.__nodeID, nativeViewTag);
}
}
exports.default = AnimatedNode;
//# sourceMappingURL=AnimatedNode.js.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,115 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.createAnimatedOperator = createAnimatedOperator;
var _AnimatedNode = _interopRequireDefault(require("./AnimatedNode"));
var _val = require("../val");
var _invariant = _interopRequireDefault(require("fbjs/lib/invariant"));
var _AnimatedBlock = require("../core/AnimatedBlock");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function reduce(fn) {
return input => input.reduce((a, b) => fn((0, _val.val)(a), (0, _val.val)(b)));
}
function reduceFrom(fn, initialValue) {
return input => input.reduce((a, b) => fn((0, _val.val)(a), (0, _val.val)(b)), initialValue);
}
function infix(fn) {
return input => fn((0, _val.val)(input[0]), (0, _val.val)(input[1]));
}
function single(fn) {
return input => fn((0, _val.val)(input[0]));
}
const OPERATIONS = {
// arithmetic
add: reduce((a, b) => a + b),
sub: reduce((a, b) => a - b),
multiply: reduce((a, b) => a * b),
divide: reduce((a, b) => a / b),
pow: reduce((a, b) => Math.pow(a, b)),
modulo: reduce((a, b) => (a % b + b) % b),
sqrt: single(a => Math.sqrt(a)),
log: single(a => Math.log(a)),
sin: single(a => Math.sin(a)),
cos: single(a => Math.cos(a)),
tan: single(a => Math.tan(a)),
acos: single(a => Math.acos(a)),
asin: single(a => Math.asin(a)),
atan: single(a => Math.atan(a)),
exp: single(a => Math.exp(a)),
round: single(a => Math.round(a)),
abs: single(a => Math.abs(a)),
ceil: single(a => Math.ceil(a)),
floor: single(a => Math.floor(a)),
max: reduce((a, b) => Math.max(a, b)),
min: reduce((a, b) => Math.min(a, b)),
// logical
and: reduceFrom((a, b) => a && b, true),
or: reduceFrom((a, b) => a || b, false),
not: single(a => !a),
defined: single(a => a !== null && a !== undefined && !isNaN(a)),
// comparing
lessThan: infix((a, b) => a < b),
/* eslint-disable-next-line eqeqeq */
eq: infix((a, b) => a == b),
greaterThan: infix((a, b) => a > b),
lessOrEq: infix((a, b) => a <= b),
greaterOrEq: infix((a, b) => a >= b),
/* eslint-disable-next-line eqeqeq */
neq: infix((a, b) => a != b)
};
class AnimatedOperator extends _AnimatedNode.default {
constructor(operator, input) {
(0, _invariant.default)(typeof operator === 'string', "Reanimated: Animated.operator node first argument should be of type String, but got: ".concat(operator));
(0, _invariant.default)(input.every(el => el instanceof _AnimatedNode.default || typeof el === 'string' || typeof el === 'number'), "Reanimated: Animated.operator node second argument should be one or more of type AnimatedNode, String or Number but got ".concat(input));
super({
type: 'op',
op: operator,
input
}, input);
_defineProperty(this, "_input", void 0);
_defineProperty(this, "_op", void 0);
_defineProperty(this, "_operation", void 0);
this._op = operator;
this._input = input;
}
toString() {
return "AnimatedOperator, id: ".concat(this.__nodeID);
}
__onEvaluate() {
if (!this._operation) {
this._operation = OPERATIONS[this._op];
(0, _invariant.default)(this._operation, "Illegal operator '%s'", this._op);
}
return this._operation(this._input);
}
}
function createAnimatedOperator(name) {
return (...args) => new AnimatedOperator(name, args.map(_AnimatedBlock.adapt));
}
//# sourceMappingURL=AnimatedOperator.js.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,109 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.createAnimatedParam = createAnimatedParam;
exports.AnimatedParam = void 0;
var _invariant = _interopRequireDefault(require("fbjs/lib/invariant"));
var _AnimatedNode = _interopRequireWildcard(require("./AnimatedNode"));
var _AnimatedClock = _interopRequireDefault(require("./AnimatedClock"));
var _val = require("../val");
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
class AnimatedParam extends _AnimatedNode.default {
constructor() {
super({
type: 'param'
}, []);
_defineProperty(this, "argsStack", []);
_defineProperty(this, "_prevCallID", void 0);
this.__attach();
}
beginContext(ref, prevCallID) {
this._prevCallID = prevCallID;
this.argsStack.push(ref);
}
endContext() {
this.argsStack.pop();
}
_getTopNode() {
if (this.argsStack.length === 0) throw new Error("param: Invocation failed because argsStack is empty");
const top = this.argsStack[this.argsStack.length - 1];
return top;
}
setValue(value) {
const top = this._getTopNode();
if (top.setValue) {
const callID = (0, _AnimatedNode.getCallID)();
(0, _AnimatedNode.setCallID)(this._prevCallID);
top.setValue(value);
(0, _AnimatedNode.setCallID)(callID);
} else {
throw new Error("param: setValue(".concat(value, ") failed because the top element has no known method for updating it's current value."));
}
}
__onEvaluate() {
const callID = (0, _AnimatedNode.getCallID)();
(0, _AnimatedNode.setCallID)(this._prevCallID);
const top = this._getTopNode();
const value = (0, _val.val)(top);
(0, _AnimatedNode.setCallID)(callID);
return value;
}
start() {
const node = this._getTopNode();
(0, _invariant.default)(node instanceof _AnimatedClock.default || node instanceof AnimatedParam, "param: top node should be of type AnimatedClock but got ".concat(node));
node.start();
}
stop() {
const node = this._getTopNode();
(0, _invariant.default)(node instanceof _AnimatedClock.default || node instanceof AnimatedParam, "param: top node should be of type AnimatedClock but got ".concat(node));
node.stop();
}
isRunning() {
const node = this._getTopNode();
if (node instanceof AnimatedParam) {
return node.isRunning();
}
(0, _invariant.default)(node instanceof _AnimatedClock.default, "param: top node should be of type AnimatedClock but got ".concat(node));
return node.isStarted();
}
}
exports.AnimatedParam = AnimatedParam;
function createAnimatedParam() {
return new AnimatedParam();
}
//# sourceMappingURL=AnimatedParam.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["AnimatedParam.js"],"names":["AnimatedParam","AnimatedNode","constructor","type","__attach","beginContext","ref","prevCallID","_prevCallID","argsStack","push","endContext","pop","_getTopNode","length","Error","top","setValue","value","callID","__onEvaluate","start","node","AnimatedClock","stop","isRunning","isStarted","createAnimatedParam"],"mappings":";;;;;;;;AAAA;;AACA;;AACA;;AACA;;;;;;;;;;AAEO,MAAMA,aAAN,SAA4BC,qBAA5B,CAAyC;AAI9CC,EAAAA,WAAW,GAAG;AACZ,UAAM;AAAEC,MAAAA,IAAI,EAAE;AAAR,KAAN,EAAyB,EAAzB;;AADY,uCAHF,EAGE;;AAAA;;AAEZ,SAAKC,QAAL;AACD;;AAEDC,EAAAA,YAAY,CAACC,GAAD,EAAMC,UAAN,EAAkB;AAC5B,SAAKC,WAAL,GAAmBD,UAAnB;AACA,SAAKE,SAAL,CAAeC,IAAf,CAAoBJ,GAApB;AACD;;AAEDK,EAAAA,UAAU,GAAG;AACX,SAAKF,SAAL,CAAeG,GAAf;AACD;;AAEDC,EAAAA,WAAW,GAAG;AACZ,QAAI,KAAKJ,SAAL,CAAeK,MAAf,KAA0B,CAA9B,EAAiC,MAAM,IAAIC,KAAJ,uDAAN;AACjC,UAAMC,GAAG,GAAG,KAAKP,SAAL,CAAe,KAAKA,SAAL,CAAeK,MAAf,GAAwB,CAAvC,CAAZ;AACA,WAAOE,GAAP;AACD;;AAEDC,EAAAA,QAAQ,CAACC,KAAD,EAAQ;AACd,UAAMF,GAAG,GAAG,KAAKH,WAAL,EAAZ;;AACA,QAAIG,GAAG,CAACC,QAAR,EAAkB;AAChB,YAAME,MAAM,GAAG,8BAAf;AACA,mCAAU,KAAKX,WAAf;AACAQ,MAAAA,GAAG,CAACC,QAAJ,CAAaC,KAAb;AACA,mCAAUC,MAAV;AACD,KALD,MAKO;AACL,YAAM,IAAIJ,KAAJ,2BAA6BG,KAA7B,2FAAN;AACD;AACF;;AAEDE,EAAAA,YAAY,GAAG;AACb,UAAMD,MAAM,GAAG,8BAAf;AACA,iCAAU,KAAKX,WAAf;;AACA,UAAMQ,GAAG,GAAG,KAAKH,WAAL,EAAZ;;AACA,UAAMK,KAAK,GAAG,cAAIF,GAAJ,CAAd;AACA,iCAAUG,MAAV;AACA,WAAOD,KAAP;AACD;;AAEDG,EAAAA,KAAK,GAAG;AACN,UAAMC,IAAI,GAAG,KAAKT,WAAL,EAAb;;AACA,4BACES,IAAI,YAAYC,sBAAhB,IAAiCD,IAAI,YAAYtB,aADnD,oEAE6DsB,IAF7D;AAIAA,IAAAA,IAAI,CAACD,KAAL;AACD;;AAEDG,EAAAA,IAAI,GAAG;AACL,UAAMF,IAAI,GAAG,KAAKT,WAAL,EAAb;;AACA,4BACES,IAAI,YAAYC,sBAAhB,IAAiCD,IAAI,YAAYtB,aADnD,oEAE6DsB,IAF7D;AAIAA,IAAAA,IAAI,CAACE,IAAL;AACD;;AAEDC,EAAAA,SAAS,GAAG;AACV,UAAMH,IAAI,GAAG,KAAKT,WAAL,EAAb;;AAEA,QAAIS,IAAI,YAAYtB,aAApB,EAAmC;AACjC,aAAOsB,IAAI,CAACG,SAAL,EAAP;AACD;;AACD,4BACEH,IAAI,YAAYC,sBADlB,oEAE6DD,IAF7D;AAIA,WAAOA,IAAI,CAACI,SAAL,EAAP;AACD;;AA1E6C;;;;AA6EzC,SAASC,mBAAT,GAA+B;AACpC,SAAO,IAAI3B,aAAJ,EAAP;AACD","sourcesContent":["import invariant from 'fbjs/lib/invariant';\nimport AnimatedNode, { getCallID, setCallID } from './AnimatedNode';\nimport AnimatedClock from './AnimatedClock';\nimport { val } from '../val';\n\nexport class AnimatedParam extends AnimatedNode {\n argsStack = [];\n _prevCallID;\n \n constructor() {\n super({ type: 'param' }, []);\n this.__attach();\n }\n\n beginContext(ref, prevCallID) {\n this._prevCallID = prevCallID;\n this.argsStack.push(ref);\n }\n\n endContext() {\n this.argsStack.pop();\n }\n\n _getTopNode() {\n if (this.argsStack.length === 0) throw new Error(`param: Invocation failed because argsStack is empty`);\n const top = this.argsStack[this.argsStack.length - 1];\n return top;\n }\n\n setValue(value) {\n const top = this._getTopNode();\n if (top.setValue) {\n const callID = getCallID();\n setCallID(this._prevCallID);\n top.setValue(value);\n setCallID(callID);\n } else {\n throw new Error(`param: setValue(${value}) failed because the top element has no known method for updating it's current value.`)\n }\n }\n \n __onEvaluate() {\n const callID = getCallID();\n setCallID(this._prevCallID);\n const top = this._getTopNode();\n const value = val(top);\n setCallID(callID);\n return value;\n }\n\n start() {\n const node = this._getTopNode();\n invariant(\n node instanceof AnimatedClock || node instanceof AnimatedParam,\n `param: top node should be of type AnimatedClock but got ${node}`\n );\n node.start();\n }\n\n stop() {\n const node = this._getTopNode();\n invariant(\n node instanceof AnimatedClock || node instanceof AnimatedParam,\n `param: top node should be of type AnimatedClock but got ${node}`\n );\n node.stop();\n }\n\n isRunning() {\n const node = this._getTopNode();\n\n if (node instanceof AnimatedParam) {\n return node.isRunning()\n }\n invariant(\n node instanceof AnimatedClock,\n `param: top node should be of type AnimatedClock but got ${node}`\n );\n return node.isStarted();\n }\n}\n\nexport function createAnimatedParam() {\n return new AnimatedParam();\n}\n"]}

View File

@ -0,0 +1,123 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.createOrReusePropsNode = createOrReusePropsNode;
var _reactNative = require("react-native");
var _AnimatedNode = _interopRequireDefault(require("./AnimatedNode"));
var _AnimatedEvent = _interopRequireDefault(require("./AnimatedEvent"));
var _AnimatedStyle = require("./AnimatedStyle");
var _invariant = _interopRequireDefault(require("fbjs/lib/invariant"));
var _areEqual = _interopRequireDefault(require("fbjs/lib/areEqual"));
var _val = require("../val");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function sanitizeProps(inputProps) {
const props = {};
for (const key in inputProps) {
const value = inputProps[key];
if (value instanceof _AnimatedNode.default && !(value instanceof _AnimatedEvent.default)) {
props[key] = value.__nodeID;
}
}
return props;
}
function createOrReusePropsNode(props, callback, oldNode) {
if (props.style) {
props = _objectSpread(_objectSpread({}, props), {}, {
style: (0, _AnimatedStyle.createOrReuseStyleNode)(props.style, oldNode && oldNode._props.style)
});
}
const config = sanitizeProps(props);
if (oldNode && (0, _areEqual.default)(config, oldNode._config)) {
return oldNode;
}
return new AnimatedProps(props, config, callback);
}
class AnimatedProps extends _AnimatedNode.default {
constructor(props, config, callback) {
super({
type: 'props',
props: config
}, Object.values(props).filter(n => !(n instanceof _AnimatedEvent.default)));
this._config = config;
this._props = props;
this._callback = callback;
this.__attach();
}
toString() {
return "AnimatedProps, id: ".concat(this.__nodeID);
}
__onEvaluate() {
const props = {};
for (const key in this._props) {
const value = this._props[key];
if (value instanceof _AnimatedNode.default) {
props[key] = value.__getValue();
}
}
return props;
}
__detach() {
const nativeViewTag = (0, _reactNative.findNodeHandle)(this._animatedView);
(0, _invariant.default)(nativeViewTag != null, 'Unable to locate attached view in the native tree');
this._disconnectAnimatedView(nativeViewTag);
super.__detach();
}
update() {
this._callback();
if (!this._animatedView) {
return;
}
(0, _val.val)(this);
}
setNativeView(animatedView) {
if (this._animatedView === animatedView) {
return;
}
this._animatedView = animatedView;
const nativeViewTag = (0, _reactNative.findNodeHandle)(this._animatedView);
(0, _invariant.default)(nativeViewTag != null, 'Unable to locate attached view in the native tree');
this._connectAnimatedView(nativeViewTag);
}
}
//# sourceMappingURL=AnimatedProps.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["AnimatedProps.js"],"names":["sanitizeProps","inputProps","props","key","value","AnimatedNode","AnimatedEvent","__nodeID","createOrReusePropsNode","callback","oldNode","style","_props","config","_config","AnimatedProps","constructor","type","Object","values","filter","n","_callback","__attach","toString","__onEvaluate","__getValue","__detach","nativeViewTag","_animatedView","_disconnectAnimatedView","update","setNativeView","animatedView","_connectAnimatedView"],"mappings":";;;;;;;AAAA;;AAEA;;AACA;;AACA;;AAEA;;AACA;;AACA;;;;;;;;;;AAEA,SAASA,aAAT,CAAuBC,UAAvB,EAAmC;AACjC,QAAMC,KAAK,GAAG,EAAd;;AACA,OAAK,MAAMC,GAAX,IAAkBF,UAAlB,EAA8B;AAC5B,UAAMG,KAAK,GAAGH,UAAU,CAACE,GAAD,CAAxB;;AACA,QAAIC,KAAK,YAAYC,qBAAjB,IAAiC,EAAED,KAAK,YAAYE,sBAAnB,CAArC,EAAwE;AACtEJ,MAAAA,KAAK,CAACC,GAAD,CAAL,GAAaC,KAAK,CAACG,QAAnB;AACD;AACF;;AACD,SAAOL,KAAP;AACD;;AAEM,SAASM,sBAAT,CAAgCN,KAAhC,EAAuCO,QAAvC,EAAiDC,OAAjD,EAA0D;AAC/D,MAAIR,KAAK,CAACS,KAAV,EAAiB;AACfT,IAAAA,KAAK,mCACAA,KADA;AAEHS,MAAAA,KAAK,EAAE,2CACLT,KAAK,CAACS,KADD,EAELD,OAAO,IAAIA,OAAO,CAACE,MAAR,CAAeD,KAFrB;AAFJ,MAAL;AAOD;;AACD,QAAME,MAAM,GAAGb,aAAa,CAACE,KAAD,CAA5B;;AACA,MAAIQ,OAAO,IAAI,uBAAUG,MAAV,EAAkBH,OAAO,CAACI,OAA1B,CAAf,EAAmD;AACjD,WAAOJ,OAAP;AACD;;AACD,SAAO,IAAIK,aAAJ,CAAkBb,KAAlB,EAAyBW,MAAzB,EAAiCJ,QAAjC,CAAP;AACD;;AAED,MAAMM,aAAN,SAA4BV,qBAA5B,CAAyC;AACvCW,EAAAA,WAAW,CAACd,KAAD,EAAQW,MAAR,EAAgBJ,QAAhB,EAA0B;AACnC,UACE;AAAEQ,MAAAA,IAAI,EAAE,OAAR;AAAiBf,MAAAA,KAAK,EAAEW;AAAxB,KADF,EAEEK,MAAM,CAACC,MAAP,CAAcjB,KAAd,EAAqBkB,MAArB,CAA4BC,CAAC,IAAI,EAAEA,CAAC,YAAYf,sBAAf,CAAjC,CAFF;AAIA,SAAKQ,OAAL,GAAeD,MAAf;AACA,SAAKD,MAAL,GAAcV,KAAd;AACA,SAAKoB,SAAL,GAAiBb,QAAjB;;AACA,SAAKc,QAAL;AACD;;AAEDC,EAAAA,QAAQ,GAAG;AACT,wCAA6B,KAAKjB,QAAlC;AACD;;AAEDkB,EAAAA,YAAY,GAAG;AACb,UAAMvB,KAAK,GAAG,EAAd;;AACA,SAAK,MAAMC,GAAX,IAAkB,KAAKS,MAAvB,EAA+B;AAC7B,YAAMR,KAAK,GAAG,KAAKQ,MAAL,CAAYT,GAAZ,CAAd;;AACA,UAAIC,KAAK,YAAYC,qBAArB,EAAmC;AACjCH,QAAAA,KAAK,CAACC,GAAD,CAAL,GAAaC,KAAK,CAACsB,UAAN,EAAb;AACD;AACF;;AACD,WAAOxB,KAAP;AACD;;AAEDyB,EAAAA,QAAQ,GAAG;AACT,UAAMC,aAAa,GAAG,iCAAe,KAAKC,aAApB,CAAtB;AACA,4BACED,aAAa,IAAI,IADnB,EAEE,mDAFF;;AAIA,SAAKE,uBAAL,CAA6BF,aAA7B;;AACA,UAAMD,QAAN;AACD;;AAEDI,EAAAA,MAAM,GAAG;AACP,SAAKT,SAAL;;AAEA,QAAI,CAAC,KAAKO,aAAV,EAAyB;AACvB;AACD;;AAED,kBAAI,IAAJ;AACD;;AAEDG,EAAAA,aAAa,CAACC,YAAD,EAAe;AAC1B,QAAI,KAAKJ,aAAL,KAAuBI,YAA3B,EAAyC;AACvC;AACD;;AACD,SAAKJ,aAAL,GAAqBI,YAArB;AAEA,UAAML,aAAa,GAAG,iCAAe,KAAKC,aAApB,CAAtB;AACA,4BACED,aAAa,IAAI,IADnB,EAEE,mDAFF;;AAIA,SAAKM,oBAAL,CAA0BN,aAA1B;AACD;;AA3DsC","sourcesContent":["import { findNodeHandle } from 'react-native';\n\nimport AnimatedNode from './AnimatedNode';\nimport AnimatedEvent from './AnimatedEvent';\nimport { createOrReuseStyleNode } from './AnimatedStyle';\n\nimport invariant from 'fbjs/lib/invariant';\nimport deepEqual from 'fbjs/lib/areEqual';\nimport { val } from '../val';\n\nfunction sanitizeProps(inputProps) {\n const props = {};\n for (const key in inputProps) {\n const value = inputProps[key];\n if (value instanceof AnimatedNode && !(value instanceof AnimatedEvent)) {\n props[key] = value.__nodeID;\n }\n }\n return props;\n}\n\nexport function createOrReusePropsNode(props, callback, oldNode) {\n if (props.style) {\n props = {\n ...props,\n style: createOrReuseStyleNode(\n props.style,\n oldNode && oldNode._props.style\n ),\n };\n }\n const config = sanitizeProps(props);\n if (oldNode && deepEqual(config, oldNode._config)) {\n return oldNode;\n }\n return new AnimatedProps(props, config, callback);\n}\n\nclass AnimatedProps extends AnimatedNode {\n constructor(props, config, callback) {\n super(\n { type: 'props', props: config },\n Object.values(props).filter(n => !(n instanceof AnimatedEvent))\n );\n this._config = config;\n this._props = props;\n this._callback = callback;\n this.__attach();\n }\n\n toString() {\n return `AnimatedProps, id: ${this.__nodeID}`;\n }\n\n __onEvaluate() {\n const props = {};\n for (const key in this._props) {\n const value = this._props[key];\n if (value instanceof AnimatedNode) {\n props[key] = value.__getValue();\n }\n }\n return props;\n }\n\n __detach() {\n const nativeViewTag = findNodeHandle(this._animatedView);\n invariant(\n nativeViewTag != null,\n 'Unable to locate attached view in the native tree'\n );\n this._disconnectAnimatedView(nativeViewTag);\n super.__detach();\n }\n\n update() {\n this._callback();\n\n if (!this._animatedView) {\n return;\n }\n\n val(this);\n }\n\n setNativeView(animatedView) {\n if (this._animatedView === animatedView) {\n return;\n }\n this._animatedView = animatedView;\n\n const nativeViewTag = findNodeHandle(this._animatedView);\n invariant(\n nativeViewTag != null,\n 'Unable to locate attached view in the native tree'\n );\n this._connectAnimatedView(nativeViewTag);\n }\n}\n"]}

View File

@ -0,0 +1,56 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.createAnimatedSet = createAnimatedSet;
var _AnimatedNode = _interopRequireDefault(require("./AnimatedNode"));
var _invariant = _interopRequireDefault(require("fbjs/lib/invariant"));
var _val = require("../val");
var _AnimatedBlock = require("../core/AnimatedBlock");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
class AnimatedSet extends _AnimatedNode.default {
constructor(what, value) {
(0, _invariant.default)(what instanceof _AnimatedNode.default, "Reanimated: Animated.set first argument should be of type AnimatedNode but got ".concat(what));
(0, _invariant.default)(value instanceof _AnimatedNode.default, "Reanimated: Animated.set second argument should be of type AnimatedNode, String or Number but got ".concat(value));
super({
type: 'set',
what,
value
}, [value]);
_defineProperty(this, "_what", void 0);
_defineProperty(this, "_value", void 0);
(0, _invariant.default)(!what._constant, 'Value to be set cannot be constant');
this._what = what;
this._value = value;
}
toString() {
return "AnimatedSet, id: ".concat(this.__nodeID);
}
__onEvaluate() {
const newValue = (0, _val.val)(this._value);
this._what.setValue(newValue);
return newValue;
}
}
function createAnimatedSet(what, value) {
return new AnimatedSet(what, (0, _AnimatedBlock.adapt)(value));
}
//# sourceMappingURL=AnimatedSet.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["AnimatedSet.js"],"names":["AnimatedSet","AnimatedNode","constructor","what","value","type","_constant","_what","_value","toString","__nodeID","__onEvaluate","newValue","setValue","createAnimatedSet"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;;;;;AAEA,MAAMA,WAAN,SAA0BC,qBAA1B,CAAuC;AAIrCC,EAAAA,WAAW,CAACC,IAAD,EAAOC,KAAP,EAAc;AACvB,4BACED,IAAI,YAAYF,qBADlB,2FAEoFE,IAFpF;AAIA,4BACEC,KAAK,YAAYH,qBADnB,8GAEuGG,KAFvG;AAIA,UAAM;AAAEC,MAAAA,IAAI,EAAE,KAAR;AAAeF,MAAAA,IAAf;AAAqBC,MAAAA;AAArB,KAAN,EAAoC,CAACA,KAAD,CAApC;;AATuB;;AAAA;;AAUvB,4BAAU,CAACD,IAAI,CAACG,SAAhB,EAA2B,oCAA3B;AACA,SAAKC,KAAL,GAAaJ,IAAb;AACA,SAAKK,MAAL,GAAcJ,KAAd;AACD;;AAEDK,EAAAA,QAAQ,GAAG;AACT,sCAA2B,KAAKC,QAAhC;AACD;;AAEDC,EAAAA,YAAY,GAAG;AACb,UAAMC,QAAQ,GAAG,cAAI,KAAKJ,MAAT,CAAjB;;AACA,SAAKD,KAAL,CAAWM,QAAX,CAAoBD,QAApB;;AACA,WAAOA,QAAP;AACD;;AA3BoC;;AA8BhC,SAASE,iBAAT,CAA2BX,IAA3B,EAAiCC,KAAjC,EAAwC;AAC7C,SAAO,IAAIJ,WAAJ,CAAgBG,IAAhB,EAAsB,0BAAMC,KAAN,CAAtB,CAAP;AACD","sourcesContent":["import AnimatedNode from './AnimatedNode';\nimport invariant from 'fbjs/lib/invariant';\nimport { val } from '../val';\nimport { adapt } from '../core/AnimatedBlock';\n\nclass AnimatedSet extends AnimatedNode {\n _what;\n _value;\n\n constructor(what, value) {\n invariant(\n what instanceof AnimatedNode,\n `Reanimated: Animated.set first argument should be of type AnimatedNode but got ${what}`\n );\n invariant(\n value instanceof AnimatedNode,\n `Reanimated: Animated.set second argument should be of type AnimatedNode, String or Number but got ${value}`\n );\n super({ type: 'set', what, value }, [value]);\n invariant(!what._constant, 'Value to be set cannot be constant');\n this._what = what;\n this._value = value;\n }\n\n toString() {\n return `AnimatedSet, id: ${this.__nodeID}`;\n }\n\n __onEvaluate() {\n const newValue = val(this._value);\n this._what.setValue(newValue);\n return newValue;\n }\n}\n\nexport function createAnimatedSet(what, value) {\n return new AnimatedSet(what, adapt(value));\n}\n"]}

View File

@ -0,0 +1,48 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.createAnimatedStartClock = createAnimatedStartClock;
var _AnimatedNode = _interopRequireDefault(require("./AnimatedNode"));
var _AnimatedClock = _interopRequireDefault(require("./AnimatedClock"));
var _AnimatedParam = require("./AnimatedParam");
var _invariant = _interopRequireDefault(require("fbjs/lib/invariant"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
class AnimatedStartClock extends _AnimatedNode.default {
constructor(clockNode) {
(0, _invariant.default)(clockNode instanceof _AnimatedClock.default || clockNode instanceof _AnimatedParam.AnimatedParam, "Reanimated: Animated.startClock argument should be of type AnimatedClock but got ".concat(clockNode));
super({
type: 'clockStart',
clock: clockNode
});
_defineProperty(this, "_clockNode", void 0);
this._clockNode = clockNode;
}
toString() {
return "AnimatedStartClock, id: ".concat(this.__nodeID);
}
__onEvaluate() {
this._clockNode.start();
return 0;
}
}
function createAnimatedStartClock(clock) {
return new AnimatedStartClock(clock);
}
//# sourceMappingURL=AnimatedStartClock.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["AnimatedStartClock.js"],"names":["AnimatedStartClock","AnimatedNode","constructor","clockNode","AnimatedClock","AnimatedParam","type","clock","_clockNode","toString","__nodeID","__onEvaluate","start","createAnimatedStartClock"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;;;;;AAEA,MAAMA,kBAAN,SAAiCC,qBAAjC,CAA8C;AAG5CC,EAAAA,WAAW,CAACC,SAAD,EAAY;AACrB,4BACEA,SAAS,YAAYC,sBAArB,IAAsCD,SAAS,YAAYE,4BAD7D,6FAEsFF,SAFtF;AAIA,UAAM;AAAEG,MAAAA,IAAI,EAAE,YAAR;AAAsBC,MAAAA,KAAK,EAAEJ;AAA7B,KAAN;;AALqB;;AAMrB,SAAKK,UAAL,GAAkBL,SAAlB;AACD;;AAEDM,EAAAA,QAAQ,GAAG;AACT,6CAAkC,KAAKC,QAAvC;AACD;;AAEDC,EAAAA,YAAY,GAAG;AACb,SAAKH,UAAL,CAAgBI,KAAhB;;AACA,WAAO,CAAP;AACD;;AAnB2C;;AAsBvC,SAASC,wBAAT,CAAkCN,KAAlC,EAAyC;AAC9C,SAAO,IAAIP,kBAAJ,CAAuBO,KAAvB,CAAP;AACD","sourcesContent":["import AnimatedNode from './AnimatedNode';\nimport AnimatedClock from './AnimatedClock';\nimport { AnimatedParam } from \"./AnimatedParam\";\nimport invariant from 'fbjs/lib/invariant';\n\nclass AnimatedStartClock extends AnimatedNode {\n _clockNode;\n\n constructor(clockNode) {\n invariant(\n clockNode instanceof AnimatedClock || clockNode instanceof AnimatedParam,\n `Reanimated: Animated.startClock argument should be of type AnimatedClock but got ${clockNode}`\n );\n super({ type: 'clockStart', clock: clockNode });\n this._clockNode = clockNode;\n }\n\n toString() {\n return `AnimatedStartClock, id: ${this.__nodeID}`;\n }\n\n __onEvaluate() {\n this._clockNode.start();\n return 0;\n }\n}\n\nexport function createAnimatedStartClock(clock) {\n return new AnimatedStartClock(clock);\n}\n"]}

View File

@ -0,0 +1,48 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.createAnimatedStopClock = createAnimatedStopClock;
var _AnimatedNode = _interopRequireDefault(require("./AnimatedNode"));
var _AnimatedClock = _interopRequireDefault(require("./AnimatedClock"));
var _AnimatedParam = require("./AnimatedParam");
var _invariant = _interopRequireDefault(require("fbjs/lib/invariant"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
class AnimatedStopClock extends _AnimatedNode.default {
constructor(clockNode) {
(0, _invariant.default)(clockNode instanceof _AnimatedClock.default || clockNode instanceof _AnimatedParam.AnimatedParam, "Reanimated: Animated.stopClock argument should be of type AnimatedClock but got ".concat(clockNode));
super({
type: 'clockStop',
clock: clockNode
});
_defineProperty(this, "_clockNode", void 0);
this._clockNode = clockNode;
}
toString() {
return "AnimatedStopClock, id: ".concat(this.__nodeID);
}
__onEvaluate() {
this._clockNode.stop();
return 0;
}
}
function createAnimatedStopClock(clock) {
return new AnimatedStopClock(clock);
}
//# sourceMappingURL=AnimatedStopClock.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["AnimatedStopClock.js"],"names":["AnimatedStopClock","AnimatedNode","constructor","clockNode","AnimatedClock","AnimatedParam","type","clock","_clockNode","toString","__nodeID","__onEvaluate","stop","createAnimatedStopClock"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;;;;;AAEA,MAAMA,iBAAN,SAAgCC,qBAAhC,CAA6C;AAG3CC,EAAAA,WAAW,CAACC,SAAD,EAAY;AACrB,4BACEA,SAAS,YAAYC,sBAArB,IAAsCD,SAAS,YAAYE,4BAD7D,4FAEqFF,SAFrF;AAIA,UAAM;AAAEG,MAAAA,IAAI,EAAE,WAAR;AAAqBC,MAAAA,KAAK,EAAEJ;AAA5B,KAAN;;AALqB;;AAMrB,SAAKK,UAAL,GAAkBL,SAAlB;AACD;;AAEDM,EAAAA,QAAQ,GAAG;AACT,4CAAiC,KAAKC,QAAtC;AACD;;AAEDC,EAAAA,YAAY,GAAG;AACb,SAAKH,UAAL,CAAgBI,IAAhB;;AACA,WAAO,CAAP;AACD;;AAnB0C;;AAsBtC,SAASC,uBAAT,CAAiCN,KAAjC,EAAwC;AAC7C,SAAO,IAAIP,iBAAJ,CAAsBO,KAAtB,CAAP;AACD","sourcesContent":["import AnimatedNode from './AnimatedNode';\nimport AnimatedClock from './AnimatedClock';\nimport { AnimatedParam } from \"./AnimatedParam\";\nimport invariant from 'fbjs/lib/invariant';\n\nclass AnimatedStopClock extends AnimatedNode {\n _clockNode;\n\n constructor(clockNode) {\n invariant(\n clockNode instanceof AnimatedClock || clockNode instanceof AnimatedParam,\n `Reanimated: Animated.stopClock argument should be of type AnimatedClock but got ${clockNode}`\n );\n super({ type: 'clockStop', clock: clockNode });\n this._clockNode = clockNode;\n }\n\n toString() {\n return `AnimatedStopClock, id: ${this.__nodeID}`;\n }\n\n __onEvaluate() {\n this._clockNode.stop();\n return 0;\n }\n}\n\nexport function createAnimatedStopClock(clock) {\n return new AnimatedStopClock(clock);\n}\n"]}

View File

@ -0,0 +1,100 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.createOrReuseStyleNode = createOrReuseStyleNode;
exports.default = void 0;
var _reactNative = require("react-native");
var _AnimatedNode = _interopRequireDefault(require("./AnimatedNode"));
var _AnimatedTransform = require("./AnimatedTransform");
var _areEqual = _interopRequireDefault(require("fbjs/lib/areEqual"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function sanitizeStyle(inputStyle) {
const style = {};
for (const key in inputStyle) {
const value = inputStyle[key];
if (value instanceof _AnimatedNode.default) {
style[key] = value.__nodeID;
}
}
return style;
}
function createOrReuseStyleNode(style, oldNode) {
style = _reactNative.StyleSheet.flatten(style) || {};
if (style.transform) {
style = _objectSpread(_objectSpread({}, style), {}, {
transform: (0, _AnimatedTransform.createOrReuseTransformNode)(style.transform, oldNode && oldNode._style.transform)
});
}
const config = sanitizeStyle(style);
if (oldNode && (0, _areEqual.default)(config, oldNode._config)) {
return oldNode;
}
return new AnimatedStyle(style, config);
}
/**
* AnimatedStyle should never be directly instantiated, use createOrReuseStyleNode
* in order to make a new instance of this node.
*/
class AnimatedStyle extends _AnimatedNode.default {
constructor(style, config) {
super({
type: 'style',
style: config
}, Object.values(style));
this._config = config;
this._style = style;
}
toString() {
return "AnimatedStyle, id: ".concat(this.__nodeID);
}
_walkStyleAndGetAnimatedValues(style) {
const updatedStyle = {};
for (const key in style) {
const value = style[key];
if (value instanceof _AnimatedNode.default) {
updatedStyle[key] = value.__getValue();
} else if (value && !Array.isArray(value) && typeof value === 'object') {
// Support animating nested values (for example: shadowOffset.height)
updatedStyle[key] = this._walkStyleAndGetAnimatedValues(value);
}
}
return updatedStyle;
}
__onEvaluate() {
return this._walkStyleAndGetAnimatedValues(this._style);
}
}
exports.default = AnimatedStyle;
//# sourceMappingURL=AnimatedStyle.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["AnimatedStyle.js"],"names":["sanitizeStyle","inputStyle","style","key","value","AnimatedNode","__nodeID","createOrReuseStyleNode","oldNode","StyleSheet","flatten","transform","_style","config","_config","AnimatedStyle","constructor","type","Object","values","toString","_walkStyleAndGetAnimatedValues","updatedStyle","__getValue","Array","isArray","__onEvaluate"],"mappings":";;;;;;;;AAAA;;AAEA;;AACA;;AAEA;;;;;;;;;;AAEA,SAASA,aAAT,CAAuBC,UAAvB,EAAmC;AACjC,QAAMC,KAAK,GAAG,EAAd;;AACA,OAAK,MAAMC,GAAX,IAAkBF,UAAlB,EAA8B;AAC5B,UAAMG,KAAK,GAAGH,UAAU,CAACE,GAAD,CAAxB;;AACA,QAAIC,KAAK,YAAYC,qBAArB,EAAmC;AACjCH,MAAAA,KAAK,CAACC,GAAD,CAAL,GAAaC,KAAK,CAACE,QAAnB;AACD;AACF;;AACD,SAAOJ,KAAP;AACD;;AAEM,SAASK,sBAAT,CAAgCL,KAAhC,EAAuCM,OAAvC,EAAgD;AACrDN,EAAAA,KAAK,GAAGO,wBAAWC,OAAX,CAAmBR,KAAnB,KAA6B,EAArC;;AACA,MAAIA,KAAK,CAACS,SAAV,EAAqB;AACnBT,IAAAA,KAAK,mCACAA,KADA;AAEHS,MAAAA,SAAS,EAAE,mDACTT,KAAK,CAACS,SADG,EAETH,OAAO,IAAIA,OAAO,CAACI,MAAR,CAAeD,SAFjB;AAFR,MAAL;AAOD;;AACD,QAAME,MAAM,GAAGb,aAAa,CAACE,KAAD,CAA5B;;AACA,MAAIM,OAAO,IAAI,uBAAUK,MAAV,EAAkBL,OAAO,CAACM,OAA1B,CAAf,EAAmD;AACjD,WAAON,OAAP;AACD;;AACD,SAAO,IAAIO,aAAJ,CAAkBb,KAAlB,EAAyBW,MAAzB,CAAP;AACD;AAED;;;;;;AAIe,MAAME,aAAN,SAA4BV,qBAA5B,CAAyC;AACtDW,EAAAA,WAAW,CAACd,KAAD,EAAQW,MAAR,EAAgB;AACzB,UAAM;AAAEI,MAAAA,IAAI,EAAE,OAAR;AAAiBf,MAAAA,KAAK,EAAEW;AAAxB,KAAN,EAAwCK,MAAM,CAACC,MAAP,CAAcjB,KAAd,CAAxC;AACA,SAAKY,OAAL,GAAeD,MAAf;AACA,SAAKD,MAAL,GAAcV,KAAd;AACD;;AAEDkB,EAAAA,QAAQ,GAAG;AACT,wCAA6B,KAAKd,QAAlC;AACD;;AAEDe,EAAAA,8BAA8B,CAACnB,KAAD,EAAQ;AACpC,UAAMoB,YAAY,GAAG,EAArB;;AACA,SAAK,MAAMnB,GAAX,IAAkBD,KAAlB,EAAyB;AACvB,YAAME,KAAK,GAAGF,KAAK,CAACC,GAAD,CAAnB;;AACA,UAAIC,KAAK,YAAYC,qBAArB,EAAmC;AACjCiB,QAAAA,YAAY,CAACnB,GAAD,CAAZ,GAAoBC,KAAK,CAACmB,UAAN,EAApB;AACD,OAFD,MAEO,IAAInB,KAAK,IAAI,CAACoB,KAAK,CAACC,OAAN,CAAcrB,KAAd,CAAV,IAAkC,OAAOA,KAAP,KAAiB,QAAvD,EAAiE;AACtE;AACAkB,QAAAA,YAAY,CAACnB,GAAD,CAAZ,GAAoB,KAAKkB,8BAAL,CAAoCjB,KAApC,CAApB;AACD;AACF;;AACD,WAAOkB,YAAP;AACD;;AAEDI,EAAAA,YAAY,GAAG;AACb,WAAO,KAAKL,8BAAL,CAAoC,KAAKT,MAAzC,CAAP;AACD;;AA3BqD","sourcesContent":["import { StyleSheet } from 'react-native';\n\nimport AnimatedNode from './AnimatedNode';\nimport { createOrReuseTransformNode } from './AnimatedTransform';\n\nimport deepEqual from 'fbjs/lib/areEqual';\n\nfunction sanitizeStyle(inputStyle) {\n const style = {};\n for (const key in inputStyle) {\n const value = inputStyle[key];\n if (value instanceof AnimatedNode) {\n style[key] = value.__nodeID;\n }\n }\n return style;\n}\n\nexport function createOrReuseStyleNode(style, oldNode) {\n style = StyleSheet.flatten(style) || {};\n if (style.transform) {\n style = {\n ...style,\n transform: createOrReuseTransformNode(\n style.transform,\n oldNode && oldNode._style.transform\n ),\n };\n }\n const config = sanitizeStyle(style);\n if (oldNode && deepEqual(config, oldNode._config)) {\n return oldNode;\n }\n return new AnimatedStyle(style, config);\n}\n\n/**\n * AnimatedStyle should never be directly instantiated, use createOrReuseStyleNode\n * in order to make a new instance of this node.\n */\nexport default class AnimatedStyle extends AnimatedNode {\n constructor(style, config) {\n super({ type: 'style', style: config }, Object.values(style));\n this._config = config;\n this._style = style;\n }\n\n toString() {\n return `AnimatedStyle, id: ${this.__nodeID}`;\n }\n\n _walkStyleAndGetAnimatedValues(style) {\n const updatedStyle = {};\n for (const key in style) {\n const value = style[key];\n if (value instanceof AnimatedNode) {\n updatedStyle[key] = value.__getValue();\n } else if (value && !Array.isArray(value) && typeof value === 'object') {\n // Support animating nested values (for example: shadowOffset.height)\n updatedStyle[key] = this._walkStyleAndGetAnimatedValues(value);\n }\n }\n return updatedStyle;\n }\n\n __onEvaluate() {\n return this._walkStyleAndGetAnimatedValues(this._style);\n }\n}\n"]}

View File

@ -0,0 +1,91 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.createOrReuseTransformNode = createOrReuseTransformNode;
var _AnimatedNode = _interopRequireDefault(require("./AnimatedNode"));
var _areEqual = _interopRequireDefault(require("fbjs/lib/areEqual"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function sanitizeTransform(inputTransform) {
const outputTransform = [];
inputTransform.forEach(transform => {
for (const key in transform) {
const value = transform[key];
if (value instanceof _AnimatedNode.default) {
outputTransform.push({
property: key,
nodeID: value.__nodeID
});
} else {
outputTransform.push({
property: key,
value
});
}
}
});
return outputTransform;
}
function extractAnimatedParentNodes(transform) {
const parents = [];
transform.forEach(transform => {
for (const key in transform) {
const value = transform[key];
if (value instanceof _AnimatedNode.default) {
parents.push(value);
}
}
});
return parents;
}
function createOrReuseTransformNode(transform, oldNode) {
const config = sanitizeTransform(transform);
if (oldNode && (0, _areEqual.default)(config, oldNode._config)) {
return oldNode;
}
return new AnimatedTransform(transform, config);
}
class AnimatedTransform extends _AnimatedNode.default {
constructor(transform, config) {
super({
type: 'transform',
transform: config
}, extractAnimatedParentNodes(transform));
this._config = config;
this._transform = transform;
}
toString() {
return "AnimatedTransform, id: ".concat(this.__nodeID);
}
__onEvaluate() {
return this._transform.map(transform => {
const result = {};
for (const key in transform) {
const value = transform[key];
if (value instanceof _AnimatedNode.default) {
result[key] = value.__getValue();
}
}
return result;
});
}
}
//# sourceMappingURL=AnimatedTransform.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["AnimatedTransform.js"],"names":["sanitizeTransform","inputTransform","outputTransform","forEach","transform","key","value","AnimatedNode","push","property","nodeID","__nodeID","extractAnimatedParentNodes","parents","createOrReuseTransformNode","oldNode","config","_config","AnimatedTransform","constructor","type","_transform","toString","__onEvaluate","map","result","__getValue"],"mappings":";;;;;;;AAAA;;AAEA;;;;AAEA,SAASA,iBAAT,CAA2BC,cAA3B,EAA2C;AACzC,QAAMC,eAAe,GAAG,EAAxB;AACAD,EAAAA,cAAc,CAACE,OAAf,CAAuBC,SAAS,IAAI;AAClC,SAAK,MAAMC,GAAX,IAAkBD,SAAlB,EAA6B;AAC3B,YAAME,KAAK,GAAGF,SAAS,CAACC,GAAD,CAAvB;;AACA,UAAIC,KAAK,YAAYC,qBAArB,EAAmC;AACjCL,QAAAA,eAAe,CAACM,IAAhB,CAAqB;AACnBC,UAAAA,QAAQ,EAAEJ,GADS;AAEnBK,UAAAA,MAAM,EAAEJ,KAAK,CAACK;AAFK,SAArB;AAID,OALD,MAKO;AACLT,QAAAA,eAAe,CAACM,IAAhB,CAAqB;AACnBC,UAAAA,QAAQ,EAAEJ,GADS;AAEnBC,UAAAA;AAFmB,SAArB;AAID;AACF;AACF,GAfD;AAgBA,SAAOJ,eAAP;AACD;;AAED,SAASU,0BAAT,CAAoCR,SAApC,EAA+C;AAC7C,QAAMS,OAAO,GAAG,EAAhB;AACAT,EAAAA,SAAS,CAACD,OAAV,CAAkBC,SAAS,IAAI;AAC7B,SAAK,MAAMC,GAAX,IAAkBD,SAAlB,EAA6B;AAC3B,YAAME,KAAK,GAAGF,SAAS,CAACC,GAAD,CAAvB;;AACA,UAAIC,KAAK,YAAYC,qBAArB,EAAmC;AACjCM,QAAAA,OAAO,CAACL,IAAR,CAAaF,KAAb;AACD;AACF;AACF,GAPD;AAQA,SAAOO,OAAP;AACD;;AAEM,SAASC,0BAAT,CAAoCV,SAApC,EAA+CW,OAA/C,EAAwD;AAC7D,QAAMC,MAAM,GAAGhB,iBAAiB,CAACI,SAAD,CAAhC;;AACA,MAAIW,OAAO,IAAI,uBAAUC,MAAV,EAAkBD,OAAO,CAACE,OAA1B,CAAf,EAAmD;AACjD,WAAOF,OAAP;AACD;;AACD,SAAO,IAAIG,iBAAJ,CAAsBd,SAAtB,EAAiCY,MAAjC,CAAP;AACD;;AAED,MAAME,iBAAN,SAAgCX,qBAAhC,CAA6C;AAC3CY,EAAAA,WAAW,CAACf,SAAD,EAAYY,MAAZ,EAAoB;AAC7B,UACE;AAAEI,MAAAA,IAAI,EAAE,WAAR;AAAqBhB,MAAAA,SAAS,EAAEY;AAAhC,KADF,EAEEJ,0BAA0B,CAACR,SAAD,CAF5B;AAIA,SAAKa,OAAL,GAAeD,MAAf;AACA,SAAKK,UAAL,GAAkBjB,SAAlB;AACD;;AAEDkB,EAAAA,QAAQ,GAAG;AACT,4CAAiC,KAAKX,QAAtC;AACD;;AAEDY,EAAAA,YAAY,GAAG;AACb,WAAO,KAAKF,UAAL,CAAgBG,GAAhB,CAAoBpB,SAAS,IAAI;AACtC,YAAMqB,MAAM,GAAG,EAAf;;AACA,WAAK,MAAMpB,GAAX,IAAkBD,SAAlB,EAA6B;AAC3B,cAAME,KAAK,GAAGF,SAAS,CAACC,GAAD,CAAvB;;AACA,YAAIC,KAAK,YAAYC,qBAArB,EAAmC;AACjCkB,UAAAA,MAAM,CAACpB,GAAD,CAAN,GAAcC,KAAK,CAACoB,UAAN,EAAd;AACD;AACF;;AACD,aAAOD,MAAP;AACD,KATM,CAAP;AAUD;;AAzB0C","sourcesContent":["import AnimatedNode from './AnimatedNode';\n\nimport deepEqual from 'fbjs/lib/areEqual';\n\nfunction sanitizeTransform(inputTransform) {\n const outputTransform = [];\n inputTransform.forEach(transform => {\n for (const key in transform) {\n const value = transform[key];\n if (value instanceof AnimatedNode) {\n outputTransform.push({\n property: key,\n nodeID: value.__nodeID,\n });\n } else {\n outputTransform.push({\n property: key,\n value,\n });\n }\n }\n });\n return outputTransform;\n}\n\nfunction extractAnimatedParentNodes(transform) {\n const parents = [];\n transform.forEach(transform => {\n for (const key in transform) {\n const value = transform[key];\n if (value instanceof AnimatedNode) {\n parents.push(value);\n }\n }\n });\n return parents;\n}\n\nexport function createOrReuseTransformNode(transform, oldNode) {\n const config = sanitizeTransform(transform);\n if (oldNode && deepEqual(config, oldNode._config)) {\n return oldNode;\n }\n return new AnimatedTransform(transform, config);\n}\n\nclass AnimatedTransform extends AnimatedNode {\n constructor(transform, config) {\n super(\n { type: 'transform', transform: config },\n extractAnimatedParentNodes(transform)\n );\n this._config = config;\n this._transform = transform;\n }\n\n toString() {\n return `AnimatedTransform, id: ${this.__nodeID}`;\n }\n\n __onEvaluate() {\n return this._transform.map(transform => {\n const result = {};\n for (const key in transform) {\n const value = transform[key];\n if (value instanceof AnimatedNode) {\n result[key] = value.__getValue();\n }\n }\n return result;\n });\n }\n}\n"]}

View File

@ -0,0 +1,54 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _AnimatedSet = require("../core/AnimatedSet");
var _interpolate = _interopRequireDefault(require("../derived/interpolate"));
var _InternalAnimatedValue = _interopRequireDefault(require("./InternalAnimatedValue"));
var _reactNative = require("react-native");
var _evaluateOnce = require("../derived/evaluateOnce");
var _ReanimatedModule = _interopRequireDefault(require("../ReanimatedModule"));
var _val = require("../val");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
// Animated value wrapped with extra methods for omit cycle of dependencies
class AnimatedValue extends _InternalAnimatedValue.default {
setValue(value) {
this.__detachAnimation(this._animation);
if (_reactNative.Platform.OS === 'web' || _reactNative.Platform.OS === 'windows' || _reactNative.Platform.OS === 'macos') {
this._updateValue((0, _val.val)(value));
} else {
if (_ReanimatedModule.default.setValue && typeof value === 'number') {
// FIXME Remove it after some time
// For OTA-safety
// FIXME handle setting value with a node
_ReanimatedModule.default.setValue(this.__nodeID, value);
} else {
(0, _evaluateOnce.evaluateOnce)((0, _AnimatedSet.createAnimatedSet)(this, value), this);
}
}
}
toString() {
return "AnimatedValue, id: ".concat(this.__nodeID);
}
interpolate(config) {
return (0, _interpolate.default)(this, config);
}
}
exports.default = AnimatedValue;
//# sourceMappingURL=AnimatedValue.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["AnimatedValue.js"],"names":["AnimatedValue","InternalAnimatedValue","setValue","value","__detachAnimation","_animation","Platform","OS","_updateValue","ReanimatedModule","__nodeID","toString","interpolate","config"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;AAEA;AACe,MAAMA,aAAN,SAA4BC,8BAA5B,CAAkD;AAC/DC,EAAAA,QAAQ,CAACC,KAAD,EAAQ;AACd,SAAKC,iBAAL,CAAuB,KAAKC,UAA5B;;AACA,QAAIC,sBAASC,EAAT,KAAgB,KAAhB,IAAyBD,sBAASC,EAAT,KAAgB,SAAzC,IAAsDD,sBAASC,EAAT,KAAgB,OAA1E,EAAmF;AACjF,WAAKC,YAAL,CAAkB,cAAIL,KAAJ,CAAlB;AACD,KAFD,MAEO;AACL,UAAIM,0BAAiBP,QAAjB,IAA6B,OAAOC,KAAP,KAAiB,QAAlD,EAA4D;AAC1D;AACA;AACA;AACAM,kCAAiBP,QAAjB,CAA0B,KAAKQ,QAA/B,EAAyCP,KAAzC;AACD,OALD,MAKO;AACL,wCAAa,oCAAI,IAAJ,EAAUA,KAAV,CAAb,EAA+B,IAA/B;AACD;AACF;AACF;;AAEDQ,EAAAA,QAAQ,GAAG;AACT,wCAA6B,KAAKD,QAAlC;AACD;;AAEDE,EAAAA,WAAW,CAACC,MAAD,EAAS;AAClB,WAAO,0BAAY,IAAZ,EAAkBA,MAAlB,CAAP;AACD;;AAvB8D","sourcesContent":["import { createAnimatedSet as set } from '../core/AnimatedSet';\nimport interpolate from '../derived/interpolate';\nimport InternalAnimatedValue from './InternalAnimatedValue';\nimport { Platform } from 'react-native';\nimport { evaluateOnce } from '../derived/evaluateOnce';\nimport ReanimatedModule from '../ReanimatedModule';\nimport { val } from '../val';\n\n// Animated value wrapped with extra methods for omit cycle of dependencies\nexport default class AnimatedValue extends InternalAnimatedValue {\n setValue(value) {\n this.__detachAnimation(this._animation);\n if (Platform.OS === 'web' || Platform.OS === 'windows' || Platform.OS === 'macos') {\n this._updateValue(val(value));\n } else {\n if (ReanimatedModule.setValue && typeof value === 'number') {\n // FIXME Remove it after some time\n // For OTA-safety\n // FIXME handle setting value with a node\n ReanimatedModule.setValue(this.__nodeID, value);\n } else {\n evaluateOnce(set(this, value), this);\n }\n }\n }\n\n toString() {\n return `AnimatedValue, id: ${this.__nodeID}`;\n }\n\n interpolate(config) {\n return interpolate(this, config);\n }\n}\n"]}

View File

@ -0,0 +1,106 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _AnimatedNode = _interopRequireDefault(require("./AnimatedNode"));
var _val = require("../val");
var _ReanimatedModule = _interopRequireDefault(require("../ReanimatedModule"));
var _invariant = _interopRequireDefault(require("fbjs/lib/invariant"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function sanitizeValue(value) {
return value === null || value === undefined || typeof value === 'string' ? value : Number(value);
}
const CONSTANT_VALUES = new Map();
function initializeConstantValues() {
if (CONSTANT_VALUES.size !== 0) {
return;
}
[0, -1, 1, -2, 2].forEach(v => CONSTANT_VALUES.set(v, new InternalAnimatedValue(v, true)));
}
/**
* This class has been made internal in order to omit dependencies' cycles which
* were caused by imperative setValue and interpolate they are currently exposed with AnimatedValue.js
*/
class InternalAnimatedValue extends _AnimatedNode.default {
static valueForConstant(number) {
initializeConstantValues();
return CONSTANT_VALUES.get(number) || new InternalAnimatedValue(number, true);
}
constructor(value, constant = false) {
(0, _invariant.default)(value !== null, 'Animated.Value cannot be set to the null');
super({
type: 'value',
value: sanitizeValue(value)
});
this._startingValue = this._value = value;
this._animation = null;
this._constant = constant;
}
__detach() {
if (!this._constant) {
if (_ReanimatedModule.default.getValue) {
_ReanimatedModule.default.getValue(this.__nodeID, val => this.__nodeConfig.value = val);
} else {
this.__nodeConfig.value = this.__getValue();
}
}
this.__detachAnimation(this._animation);
super.__detach();
}
__detachAnimation(animation) {
animation && animation.__detach();
if (this._animation === animation) {
this._animation = null;
}
}
__attachAnimation(animation) {
this.__detachAnimation(this._animation);
this._animation = animation;
}
__onEvaluate() {
if (this.__inputNodes && this.__inputNodes.length) {
this.__inputNodes.forEach(_val.val);
}
return this._value;
} // AnimatedValue will override this method to modify the value of a native node.
setValue(value) {
this.__detachAnimation(this._animation);
this._updateValue(value);
}
_updateValue(value) {
this._value = value;
this.__forceUpdateCache(value);
}
}
exports.default = InternalAnimatedValue;
//# sourceMappingURL=InternalAnimatedValue.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["InternalAnimatedValue.js"],"names":["sanitizeValue","value","undefined","Number","CONSTANT_VALUES","Map","initializeConstantValues","size","forEach","v","set","InternalAnimatedValue","AnimatedNode","valueForConstant","number","get","constructor","constant","type","_startingValue","_value","_animation","_constant","__detach","ReanimatedModule","getValue","__nodeID","val","__nodeConfig","__getValue","__detachAnimation","animation","__attachAnimation","__onEvaluate","__inputNodes","length","setValue","_updateValue","__forceUpdateCache"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;;;AAEA,SAASA,aAAT,CAAuBC,KAAvB,EAA8B;AAC5B,SAAOA,KAAK,KAAK,IAAV,IAAkBA,KAAK,KAAKC,SAA5B,IAAyC,OAAOD,KAAP,KAAiB,QAA1D,GACHA,KADG,GAEHE,MAAM,CAACF,KAAD,CAFV;AAGD;;AAED,MAAMG,eAAe,GAAG,IAAIC,GAAJ,EAAxB;;AAEA,SAASC,wBAAT,GAAoC;AAClC,MAAIF,eAAe,CAACG,IAAhB,KAAyB,CAA7B,EAAgC;AAC9B;AACD;;AACD,GAAC,CAAD,EAAI,CAAC,CAAL,EAAQ,CAAR,EAAW,CAAC,CAAZ,EAAe,CAAf,EAAkBC,OAAlB,CAA0BC,CAAC,IACzBL,eAAe,CAACM,GAAhB,CAAoBD,CAApB,EAAuB,IAAIE,qBAAJ,CAA0BF,CAA1B,EAA6B,IAA7B,CAAvB,CADF;AAGD;AAED;;;;;;AAIe,MAAME,qBAAN,SAAoCC,qBAApC,CAAiD;AAC9D,SAAOC,gBAAP,CAAwBC,MAAxB,EAAgC;AAC9BR,IAAAA,wBAAwB;AACxB,WACEF,eAAe,CAACW,GAAhB,CAAoBD,MAApB,KAA+B,IAAIH,qBAAJ,CAA0BG,MAA1B,EAAkC,IAAlC,CADjC;AAGD;;AAEDE,EAAAA,WAAW,CAACf,KAAD,EAAQgB,QAAQ,GAAG,KAAnB,EAA0B;AACnC,4BACEhB,KAAK,KAAK,IADZ,EAEE,0CAFF;AAIA,UAAM;AAAEiB,MAAAA,IAAI,EAAE,OAAR;AAAiBjB,MAAAA,KAAK,EAAED,aAAa,CAACC,KAAD;AAArC,KAAN;AACA,SAAKkB,cAAL,GAAsB,KAAKC,MAAL,GAAcnB,KAApC;AACA,SAAKoB,UAAL,GAAkB,IAAlB;AACA,SAAKC,SAAL,GAAiBL,QAAjB;AACD;;AAEDM,EAAAA,QAAQ,GAAG;AACT,QAAI,CAAC,KAAKD,SAAV,EAAqB;AACnB,UAAIE,0BAAiBC,QAArB,EAA+B;AAC7BD,kCAAiBC,QAAjB,CACE,KAAKC,QADP,EAEEC,GAAG,IAAK,KAAKC,YAAL,CAAkB3B,KAAlB,GAA0B0B,GAFpC;AAID,OALD,MAKO;AACL,aAAKC,YAAL,CAAkB3B,KAAlB,GAA0B,KAAK4B,UAAL,EAA1B;AACD;AACF;;AACD,SAAKC,iBAAL,CAAuB,KAAKT,UAA5B;;AACA,UAAME,QAAN;AACD;;AAEDO,EAAAA,iBAAiB,CAACC,SAAD,EAAY;AAC3BA,IAAAA,SAAS,IAAIA,SAAS,CAACR,QAAV,EAAb;;AACA,QAAI,KAAKF,UAAL,KAAoBU,SAAxB,EAAmC;AACjC,WAAKV,UAAL,GAAkB,IAAlB;AACD;AACF;;AAEDW,EAAAA,iBAAiB,CAACD,SAAD,EAAY;AAC3B,SAAKD,iBAAL,CAAuB,KAAKT,UAA5B;;AACA,SAAKA,UAAL,GAAkBU,SAAlB;AACD;;AAEDE,EAAAA,YAAY,GAAG;AACb,QAAI,KAAKC,YAAL,IAAqB,KAAKA,YAAL,CAAkBC,MAA3C,EAAmD;AACjD,WAAKD,YAAL,CAAkB1B,OAAlB,CAA0BmB,QAA1B;AACD;;AACD,WAAO,KAAKP,MAAZ;AACD,GAnD6D,CAqD9D;;;AACAgB,EAAAA,QAAQ,CAACnC,KAAD,EAAQ;AACd,SAAK6B,iBAAL,CAAuB,KAAKT,UAA5B;;AACA,SAAKgB,YAAL,CAAkBpC,KAAlB;AACD;;AAEDoC,EAAAA,YAAY,CAACpC,KAAD,EAAQ;AAClB,SAAKmB,MAAL,GAAcnB,KAAd;;AACA,SAAKqC,kBAAL,CAAwBrC,KAAxB;AACD;;AA9D6D","sourcesContent":["import AnimatedNode from './AnimatedNode';\nimport { val } from '../val';\nimport ReanimatedModule from '../ReanimatedModule';\nimport invariant from 'fbjs/lib/invariant';\n\nfunction sanitizeValue(value) {\n return value === null || value === undefined || typeof value === 'string'\n ? value\n : Number(value);\n}\n\nconst CONSTANT_VALUES = new Map();\n\nfunction initializeConstantValues() {\n if (CONSTANT_VALUES.size !== 0) {\n return;\n }\n [0, -1, 1, -2, 2].forEach(v =>\n CONSTANT_VALUES.set(v, new InternalAnimatedValue(v, true))\n );\n}\n\n/**\n * This class has been made internal in order to omit dependencies' cycles which\n * were caused by imperative setValue and interpolate they are currently exposed with AnimatedValue.js\n */\nexport default class InternalAnimatedValue extends AnimatedNode {\n static valueForConstant(number) {\n initializeConstantValues();\n return (\n CONSTANT_VALUES.get(number) || new InternalAnimatedValue(number, true)\n );\n }\n\n constructor(value, constant = false) {\n invariant(\n value !== null,\n 'Animated.Value cannot be set to the null'\n );\n super({ type: 'value', value: sanitizeValue(value) });\n this._startingValue = this._value = value;\n this._animation = null;\n this._constant = constant;\n }\n\n __detach() {\n if (!this._constant) {\n if (ReanimatedModule.getValue) {\n ReanimatedModule.getValue(\n this.__nodeID,\n val => (this.__nodeConfig.value = val)\n );\n } else {\n this.__nodeConfig.value = this.__getValue();\n }\n }\n this.__detachAnimation(this._animation);\n super.__detach();\n }\n\n __detachAnimation(animation) {\n animation && animation.__detach();\n if (this._animation === animation) {\n this._animation = null;\n }\n }\n\n __attachAnimation(animation) {\n this.__detachAnimation(this._animation);\n this._animation = animation;\n }\n\n __onEvaluate() {\n if (this.__inputNodes && this.__inputNodes.length) {\n this.__inputNodes.forEach(val);\n }\n return this._value;\n }\n\n // AnimatedValue will override this method to modify the value of a native node.\n setValue(value) {\n this.__detachAnimation(this._animation);\n this._updateValue(value);\n }\n\n _updateValue(value) {\n this._value = value;\n this.__forceUpdateCache(value);\n }\n}\n"]}

View File

@ -0,0 +1,118 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.createOrReusePropsNode = createOrReusePropsNode;
var _AnimatedNode = _interopRequireDefault(require("../AnimatedNode"));
var _AnimatedEvent = _interopRequireDefault(require("../AnimatedEvent"));
var _AnimatedStyle = _interopRequireWildcard(require("../AnimatedStyle"));
var _areEqual = _interopRequireDefault(require("fbjs/lib/areEqual"));
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
// This file has been mocked as react-native's `findNodeHandle` is returning undefined value;
// and I became easier to mock whole this file instead of mocking RN
function sanitizeProps(inputProps) {
const props = {};
for (const key in inputProps) {
const value = inputProps[key];
if (value instanceof _AnimatedNode.default && !(value instanceof _AnimatedEvent.default)) {
props[key] = value.__nodeID;
}
}
return props;
}
function createOrReusePropsNode(props, callback, oldNode) {
if (props.style) {
props = _objectSpread(_objectSpread({}, props), {}, {
style: (0, _AnimatedStyle.createOrReuseStyleNode)(props.style, oldNode && oldNode._props.style)
});
}
const config = sanitizeProps(props);
if (oldNode && (0, _areEqual.default)(config, oldNode._config)) {
return oldNode;
}
return new AnimatedProps(props, config, callback);
}
class AnimatedProps extends _AnimatedNode.default {
constructor(props, config, callback) {
super({
type: 'props',
props: config
}, Object.values(props).filter(n => !(n instanceof _AnimatedEvent.default)));
this._config = config;
this._props = props;
this._callback = callback;
this.__attach();
}
__getProps() {
const props = {};
for (const key in this._props) {
const value = this._props[key];
if (value instanceof _AnimatedNode.default) {
if (value instanceof _AnimatedStyle.default) {
props[key] = value.__getProps();
}
} else {
props[key] = value;
}
}
return props;
}
__onEvaluate() {
const props = {};
for (const key in this._props) {
const value = this._props[key];
if (value instanceof _AnimatedNode.default) {
props[key] = value.__getValue();
}
}
return props;
}
update() {
this._callback();
}
setNativeView(animatedView) {
if (this._animatedView === animatedView) {
return;
}
this._animatedView = animatedView;
}
}
//# sourceMappingURL=AnimatedProps.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["AnimatedProps.js"],"names":["sanitizeProps","inputProps","props","key","value","AnimatedNode","AnimatedEvent","__nodeID","createOrReusePropsNode","callback","oldNode","style","_props","config","_config","AnimatedProps","constructor","type","Object","values","filter","n","_callback","__attach","__getProps","AnimatedStyle","__onEvaluate","__getValue","update","setNativeView","animatedView","_animatedView"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AAEA;;;;;;;;;;;;;;AAEA;AACA;AAEA,SAASA,aAAT,CAAuBC,UAAvB,EAAmC;AACjC,QAAMC,KAAK,GAAG,EAAd;;AACA,OAAK,MAAMC,GAAX,IAAkBF,UAAlB,EAA8B;AAC5B,UAAMG,KAAK,GAAGH,UAAU,CAACE,GAAD,CAAxB;;AACA,QAAIC,KAAK,YAAYC,qBAAjB,IAAiC,EAAED,KAAK,YAAYE,sBAAnB,CAArC,EAAwE;AACtEJ,MAAAA,KAAK,CAACC,GAAD,CAAL,GAAaC,KAAK,CAACG,QAAnB;AACD;AACF;;AACD,SAAOL,KAAP;AACD;;AAEM,SAASM,sBAAT,CAAgCN,KAAhC,EAAuCO,QAAvC,EAAiDC,OAAjD,EAA0D;AAC/D,MAAIR,KAAK,CAACS,KAAV,EAAiB;AACfT,IAAAA,KAAK,mCACAA,KADA;AAEHS,MAAAA,KAAK,EAAE,2CACLT,KAAK,CAACS,KADD,EAELD,OAAO,IAAIA,OAAO,CAACE,MAAR,CAAeD,KAFrB;AAFJ,MAAL;AAOD;;AACD,QAAME,MAAM,GAAGb,aAAa,CAACE,KAAD,CAA5B;;AACA,MAAIQ,OAAO,IAAI,uBAAUG,MAAV,EAAkBH,OAAO,CAACI,OAA1B,CAAf,EAAmD;AACjD,WAAOJ,OAAP;AACD;;AACD,SAAO,IAAIK,aAAJ,CAAkBb,KAAlB,EAAyBW,MAAzB,EAAiCJ,QAAjC,CAAP;AACD;;AAED,MAAMM,aAAN,SAA4BV,qBAA5B,CAAyC;AACvCW,EAAAA,WAAW,CAACd,KAAD,EAAQW,MAAR,EAAgBJ,QAAhB,EAA0B;AACnC,UACE;AAAEQ,MAAAA,IAAI,EAAE,OAAR;AAAiBf,MAAAA,KAAK,EAAEW;AAAxB,KADF,EAEEK,MAAM,CAACC,MAAP,CAAcjB,KAAd,EAAqBkB,MAArB,CAA4BC,CAAC,IAAI,EAAEA,CAAC,YAAYf,sBAAf,CAAjC,CAFF;AAIA,SAAKQ,OAAL,GAAeD,MAAf;AACA,SAAKD,MAAL,GAAcV,KAAd;AACA,SAAKoB,SAAL,GAAiBb,QAAjB;;AACA,SAAKc,QAAL;AACD;;AAEDC,EAAAA,UAAU,GAAG;AACX,UAAMtB,KAAK,GAAG,EAAd;;AACA,SAAK,MAAMC,GAAX,IAAkB,KAAKS,MAAvB,EAA+B;AAC7B,YAAMR,KAAK,GAAG,KAAKQ,MAAL,CAAYT,GAAZ,CAAd;;AACA,UAAIC,KAAK,YAAYC,qBAArB,EAAmC;AACjC,YAAID,KAAK,YAAYqB,sBAArB,EAAoC;AAClCvB,UAAAA,KAAK,CAACC,GAAD,CAAL,GAAaC,KAAK,CAACoB,UAAN,EAAb;AACD;AACF,OAJD,MAIO;AACLtB,QAAAA,KAAK,CAACC,GAAD,CAAL,GAAaC,KAAb;AACD;AACF;;AACD,WAAOF,KAAP;AACD;;AAEDwB,EAAAA,YAAY,GAAG;AACb,UAAMxB,KAAK,GAAG,EAAd;;AACA,SAAK,MAAMC,GAAX,IAAkB,KAAKS,MAAvB,EAA+B;AAC7B,YAAMR,KAAK,GAAG,KAAKQ,MAAL,CAAYT,GAAZ,CAAd;;AACA,UAAIC,KAAK,YAAYC,qBAArB,EAAmC;AACjCH,QAAAA,KAAK,CAACC,GAAD,CAAL,GAAaC,KAAK,CAACuB,UAAN,EAAb;AACD;AACF;;AACD,WAAOzB,KAAP;AACD;;AAED0B,EAAAA,MAAM,GAAG;AACP,SAAKN,SAAL;AACD;;AAEDO,EAAAA,aAAa,CAACC,YAAD,EAAe;AAC1B,QAAI,KAAKC,aAAL,KAAuBD,YAA3B,EAAyC;AACvC;AACD;;AACD,SAAKC,aAAL,GAAqBD,YAArB;AACD;;AA/CsC","sourcesContent":["import AnimatedNode from '../AnimatedNode';\nimport AnimatedEvent from '../AnimatedEvent';\nimport AnimatedStyle, { createOrReuseStyleNode } from '../AnimatedStyle';\n\nimport deepEqual from 'fbjs/lib/areEqual';\n\n// This file has been mocked as react-native's `findNodeHandle` is returning undefined value;\n// and I became easier to mock whole this file instead of mocking RN\n\nfunction sanitizeProps(inputProps) {\n const props = {};\n for (const key in inputProps) {\n const value = inputProps[key];\n if (value instanceof AnimatedNode && !(value instanceof AnimatedEvent)) {\n props[key] = value.__nodeID;\n }\n }\n return props;\n}\n\nexport function createOrReusePropsNode(props, callback, oldNode) {\n if (props.style) {\n props = {\n ...props,\n style: createOrReuseStyleNode(\n props.style,\n oldNode && oldNode._props.style\n ),\n };\n }\n const config = sanitizeProps(props);\n if (oldNode && deepEqual(config, oldNode._config)) {\n return oldNode;\n }\n return new AnimatedProps(props, config, callback);\n}\n\nclass AnimatedProps extends AnimatedNode {\n constructor(props, config, callback) {\n super(\n { type: 'props', props: config },\n Object.values(props).filter(n => !(n instanceof AnimatedEvent))\n );\n this._config = config;\n this._props = props;\n this._callback = callback;\n this.__attach();\n }\n\n __getProps() {\n const props = {};\n for (const key in this._props) {\n const value = this._props[key];\n if (value instanceof AnimatedNode) {\n if (value instanceof AnimatedStyle) {\n props[key] = value.__getProps();\n }\n } else {\n props[key] = value;\n }\n }\n return props;\n }\n\n __onEvaluate() {\n const props = {};\n for (const key in this._props) {\n const value = this._props[key];\n if (value instanceof AnimatedNode) {\n props[key] = value.__getValue();\n }\n }\n return props;\n }\n\n update() {\n this._callback();\n }\n\n setNativeView(animatedView) {\n if (this._animatedView === animatedView) {\n return;\n }\n this._animatedView = animatedView;\n }\n}\n"]}

View File

@ -0,0 +1,75 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = createEventObjectProxyPolyfill;
// JSC on Android and iOS 8 & 9 does not support proxies.
// The below workaround provides a proxy-like functionality for event data by
// creating an object which contains predefined fields for the most commonly
// used event attributes. If your app uses even attribute which is not listed
// here please submit a PR to add that and we will merge it right away
function createEventObjectProxyPolyfill() {
const nodesMap = {
// Gesture handlers-related event
translationX: {},
translationY: {},
state: {},
oldState: {},
absoluteX: {},
absoluteY: {},
x: {},
y: {},
velocityX: {},
velocityY: {},
scale: {},
focalX: {},
focalY: {},
rotation: {},
anchorX: {},
anchorY: {},
velocity: {},
numberOfPointers: {},
// onLayour-related event
layout: {
x: {},
y: {},
width: {},
height: {}
},
// ScrollView event
contentOffset: {
y: {},
x: {}
},
layoutMeasurement: {
width: {},
height: {}
},
contentSize: {
width: {},
height: {}
},
zoomScale: {},
contentInset: {
right: {},
top: {},
left: {},
bottom: {}
}
};
const traverse = obj => {
for (const key in obj) {
traverse(obj[key]);
Object.assign(obj[key], {
__isProxy: true
});
}
};
traverse(nodesMap);
return nodesMap;
}
//# sourceMappingURL=createEventObjectProxyPolyfill.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["createEventObjectProxyPolyfill.js"],"names":["createEventObjectProxyPolyfill","nodesMap","translationX","translationY","state","oldState","absoluteX","absoluteY","x","y","velocityX","velocityY","scale","focalX","focalY","rotation","anchorX","anchorY","velocity","numberOfPointers","layout","width","height","contentOffset","layoutMeasurement","contentSize","zoomScale","contentInset","right","top","left","bottom","traverse","obj","key","Object","assign","__isProxy"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACe,SAASA,8BAAT,GAA0C;AACvD,QAAMC,QAAQ,GAAG;AACf;AACAC,IAAAA,YAAY,EAAE,EAFC;AAGfC,IAAAA,YAAY,EAAE,EAHC;AAIfC,IAAAA,KAAK,EAAE,EAJQ;AAKfC,IAAAA,QAAQ,EAAE,EALK;AAMfC,IAAAA,SAAS,EAAE,EANI;AAOfC,IAAAA,SAAS,EAAE,EAPI;AAQfC,IAAAA,CAAC,EAAE,EARY;AASfC,IAAAA,CAAC,EAAE,EATY;AAUfC,IAAAA,SAAS,EAAE,EAVI;AAWfC,IAAAA,SAAS,EAAE,EAXI;AAYfC,IAAAA,KAAK,EAAE,EAZQ;AAafC,IAAAA,MAAM,EAAE,EAbO;AAcfC,IAAAA,MAAM,EAAE,EAdO;AAefC,IAAAA,QAAQ,EAAE,EAfK;AAgBfC,IAAAA,OAAO,EAAE,EAhBM;AAiBfC,IAAAA,OAAO,EAAE,EAjBM;AAkBfC,IAAAA,QAAQ,EAAE,EAlBK;AAmBfC,IAAAA,gBAAgB,EAAE,EAnBH;AAoBf;AACAC,IAAAA,MAAM,EAAE;AAAEZ,MAAAA,CAAC,EAAE,EAAL;AAASC,MAAAA,CAAC,EAAE,EAAZ;AAAgBY,MAAAA,KAAK,EAAE,EAAvB;AAA2BC,MAAAA,MAAM,EAAE;AAAnC,KArBO;AAsBf;AACAC,IAAAA,aAAa,EAAE;AAAEd,MAAAA,CAAC,EAAE,EAAL;AAASD,MAAAA,CAAC,EAAE;AAAZ,KAvBA;AAwBfgB,IAAAA,iBAAiB,EAAE;AAAEH,MAAAA,KAAK,EAAE,EAAT;AAAaC,MAAAA,MAAM,EAAE;AAArB,KAxBJ;AAyBfG,IAAAA,WAAW,EAAE;AAAEJ,MAAAA,KAAK,EAAE,EAAT;AAAaC,MAAAA,MAAM,EAAE;AAArB,KAzBE;AA0BfI,IAAAA,SAAS,EAAE,EA1BI;AA2BfC,IAAAA,YAAY,EAAE;AAAEC,MAAAA,KAAK,EAAE,EAAT;AAAaC,MAAAA,GAAG,EAAE,EAAlB;AAAsBC,MAAAA,IAAI,EAAE,EAA5B;AAAgCC,MAAAA,MAAM,EAAE;AAAxC;AA3BC,GAAjB;;AA6BA,QAAMC,QAAQ,GAAGC,GAAG,IAAI;AACtB,SAAK,MAAMC,GAAX,IAAkBD,GAAlB,EAAuB;AACrBD,MAAAA,QAAQ,CAACC,GAAG,CAACC,GAAD,CAAJ,CAAR;AACAC,MAAAA,MAAM,CAACC,MAAP,CAAcH,GAAG,CAACC,GAAD,CAAjB,EAAwB;AAAEG,QAAAA,SAAS,EAAE;AAAb,OAAxB;AACD;AACF,GALD;;AAMAL,EAAAA,QAAQ,CAAC/B,QAAD,CAAR;AACA,SAAOA,QAAP;AACD","sourcesContent":["// JSC on Android and iOS 8 & 9 does not support proxies.\n// The below workaround provides a proxy-like functionality for event data by\n// creating an object which contains predefined fields for the most commonly\n// used event attributes. If your app uses even attribute which is not listed\n// here please submit a PR to add that and we will merge it right away\nexport default function createEventObjectProxyPolyfill() {\n const nodesMap = {\n // Gesture handlers-related event\n translationX: {},\n translationY: {},\n state: {},\n oldState: {},\n absoluteX: {},\n absoluteY: {},\n x: {},\n y: {},\n velocityX: {},\n velocityY: {},\n scale: {},\n focalX: {},\n focalY: {},\n rotation: {},\n anchorX: {},\n anchorY: {},\n velocity: {},\n numberOfPointers: {},\n // onLayour-related event\n layout: { x: {}, y: {}, width: {}, height: {} },\n // ScrollView event\n contentOffset: { y: {}, x: {} },\n layoutMeasurement: { width: {}, height: {} },\n contentSize: { width: {}, height: {} },\n zoomScale: {},\n contentInset: { right: {}, top: {}, left: {}, bottom: {} },\n };\n const traverse = obj => {\n for (const key in obj) {\n traverse(obj[key]);\n Object.assign(obj[key], { __isProxy: true });\n }\n };\n traverse(nodesMap);\n return nodesMap;\n}\n"]}

View File

@ -0,0 +1,288 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = createAnimatedComponent;
var _react = _interopRequireDefault(require("react"));
var _reactNative = require("react-native");
var _ReanimatedEventEmitter = _interopRequireDefault(require("./ReanimatedEventEmitter"));
var _AnimatedEvent = _interopRequireDefault(require("./core/AnimatedEvent"));
var _AnimatedNode = _interopRequireDefault(require("./core/AnimatedNode"));
var _AnimatedValue = _interopRequireDefault(require("./core/AnimatedValue"));
var _AnimatedProps = require("./core/AnimatedProps");
var _invariant = _interopRequireDefault(require("fbjs/lib/invariant"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
const NODE_MAPPING = new Map();
function listener(data) {
const component = NODE_MAPPING.get(data.viewTag);
component && component._updateFromNative(data.props);
}
function dummyListener() {// empty listener we use to assign to listener properties for which animated
// event is used.
}
function createAnimatedComponent(Component) {
(0, _invariant.default)(typeof Component !== 'function' || Component.prototype && Component.prototype.isReactComponent, '`createAnimatedComponent` does not support stateless functional components; ' + 'use a class component instead.');
class AnimatedComponent extends _react.default.Component {
constructor(props) {
super(props);
_defineProperty(this, "_invokeAnimatedPropsCallbackOnMount", false);
_defineProperty(this, "_animatedPropsCallback", () => {
if (this._component == null) {
// AnimatedProps is created in will-mount because it's used in render.
// But this callback may be invoked before mount in async mode,
// In which case we should defer the setNativeProps() call.
// React may throw away uncommitted work in async mode,
// So a deferred call won't always be invoked.
this._invokeAnimatedPropsCallbackOnMount = true;
} else if (typeof this._component.setNativeProps !== 'function') {
this.forceUpdate();
} else {
this._component.setNativeProps(this._propsAnimated.__getValue());
}
});
_defineProperty(this, "_setComponentRef", c => {
if (c !== this._component) {
this._component = c;
}
});
this._attachProps(this.props);
}
componentWillUnmount() {
this._detachPropUpdater();
this._propsAnimated && this._propsAnimated.__detach();
this._detachNativeEvents();
}
setNativeProps(props) {
this._component.setNativeProps(props);
}
componentDidMount() {
if (this._invokeAnimatedPropsCallbackOnMount) {
this._invokeAnimatedPropsCallbackOnMount = false;
this._animatedPropsCallback();
}
this._propsAnimated.setNativeView(this._component);
this._attachNativeEvents();
this._attachPropUpdater();
}
_getEventViewRef() {
// Make sure to get the scrollable node for components that implement
// `ScrollResponder.Mixin`.
return this._component.getScrollableNode ? this._component.getScrollableNode() : this._component;
}
_attachNativeEvents() {
const node = this._getEventViewRef();
for (const key in this.props) {
const prop = this.props[key];
if (prop instanceof _AnimatedEvent.default) {
prop.attachEvent(node, key);
}
}
}
_detachNativeEvents() {
const node = this._getEventViewRef();
for (const key in this.props) {
const prop = this.props[key];
if (prop instanceof _AnimatedEvent.default) {
prop.detachEvent(node, key);
}
}
}
_reattachNativeEvents(prevProps) {
const node = this._getEventViewRef();
const attached = new Set();
const nextEvts = new Set();
for (const key in this.props) {
const prop = this.props[key];
if (prop instanceof _AnimatedEvent.default) {
nextEvts.add(prop.__nodeID);
}
}
for (const key in prevProps) {
const prop = this.props[key];
if (prop instanceof _AnimatedEvent.default) {
if (!nextEvts.has(prop.__nodeID)) {
// event was in prev props but not in current props, we detach
prop.detachEvent(node, key);
} else {
// event was in prev and is still in current props
attached.add(prop.__nodeID);
}
}
}
for (const key in this.props) {
const prop = this.props[key];
if (prop instanceof _AnimatedEvent.default && !attached.has(prop.__nodeID)) {
// not yet attached
prop.attachEvent(node, key);
}
}
} // The system is best designed when setNativeProps is implemented. It is
// able to avoid re-rendering and directly set the attributes that changed.
// However, setNativeProps can only be implemented on native components
// If you want to animate a composite component, you need to re-render it.
// In this case, we have a fallback that uses forceUpdate.
_attachProps(nextProps) {
const oldPropsAnimated = this._propsAnimated;
this._propsAnimated = (0, _AnimatedProps.createOrReusePropsNode)(nextProps, this._animatedPropsCallback, oldPropsAnimated); // If prop node has been reused we don't need to call into "__detach"
if (oldPropsAnimated !== this._propsAnimated) {
// When you call detach, it removes the element from the parent list
// of children. If it goes to 0, then the parent also detaches itself
// and so on.
// An optimization is to attach the new elements and THEN detach the old
// ones instead of detaching and THEN attaching.
// This way the intermediate state isn't to go to 0 and trigger
// this expensive recursive detaching to then re-attach everything on
// the very next operation.
oldPropsAnimated && oldPropsAnimated.__detach();
}
}
_updateFromNative(props) {
this._component.setNativeProps(props);
}
_attachPropUpdater() {
const viewTag = (0, _reactNative.findNodeHandle)(this);
NODE_MAPPING.set(viewTag, this);
if (NODE_MAPPING.size === 1) {
_ReanimatedEventEmitter.default.addListener('onReanimatedPropsChange', listener);
}
}
_detachPropUpdater() {
const viewTag = (0, _reactNative.findNodeHandle)(this);
NODE_MAPPING.delete(viewTag);
if (NODE_MAPPING.size === 0) {
_ReanimatedEventEmitter.default.removeAllListeners('onReanimatedPropsChange');
}
}
componentDidUpdate(prevProps) {
this._attachProps(this.props);
this._reattachNativeEvents(prevProps);
this._propsAnimated.setNativeView(this._component);
}
_filterNonAnimatedStyle(inputStyle) {
const style = {};
for (const key in inputStyle) {
const value = inputStyle[key];
if (key !== 'transform') {
if (value instanceof _AnimatedValue.default) {
style[key] = value._startingValue;
} else if (!(value instanceof _AnimatedNode.default)) {
style[key] = value;
}
}
}
return style;
}
_filterNonAnimatedProps(inputProps) {
const props = {};
for (const key in inputProps) {
const value = inputProps[key];
if (key === 'style') {
props[key] = this._filterNonAnimatedStyle(_reactNative.StyleSheet.flatten(value));
} else if (value instanceof _AnimatedEvent.default) {
// we cannot filter out event listeners completely as some components
// rely on having a callback registered in order to generate events
// alltogether. Therefore we provide a dummy callback here to allow
// native event dispatcher to hijack events.
props[key] = dummyListener;
} else if (value instanceof _AnimatedValue.default) {
props[key] = value._startingValue;
} else if (!(value instanceof _AnimatedNode.default)) {
props[key] = value;
}
}
return props;
}
render() {
const props = this._filterNonAnimatedProps(this.props);
const platformProps = _reactNative.Platform.select({
web: {},
default: {
collapsable: false
}
});
return /*#__PURE__*/_react.default.createElement(Component, _extends({}, props, {
ref: this._setComponentRef
}, platformProps));
} // A third party library can use getNode()
// to get the node reference of the decorated component
getNode() {
return this._component;
}
}
AnimatedComponent.displayName = "AnimatedComponent(".concat(Component.displayName || Component.name || 'Component', ")");
return AnimatedComponent;
}
//# sourceMappingURL=createAnimatedComponent.js.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,27 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.evaluateOnce = evaluateOnce;
var _base = require("../../base");
function evaluateOnce(node, children = [], callback) {
if (!Array.isArray(children)) {
children = [children];
}
const alwaysNode = (0, _base.always)(node);
for (let i = 0; i < children.length; i++) {
alwaysNode.__addChild(children[i]);
}
for (let i = 0; i < children.length; i++) {
alwaysNode.__removeChild(children[i]);
}
callback && callback();
}
//# sourceMappingURL=evaluateOnce.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["evaluateOnce.js"],"names":["evaluateOnce","node","children","callback","Array","isArray","alwaysNode","i","length","__addChild","__removeChild"],"mappings":";;;;;;;AAAA;;AACO,SAASA,YAAT,CAAsBC,IAAtB,EAA4BC,QAAQ,GAAG,EAAvC,EAA2CC,QAA3C,EAAqD;AAC1D,MAAI,CAACC,KAAK,CAACC,OAAN,CAAcH,QAAd,CAAL,EAA8B;AAC5BA,IAAAA,QAAQ,GAAG,CAACA,QAAD,CAAX;AACD;;AACD,QAAMI,UAAU,GAAG,kBAAOL,IAAP,CAAnB;;AACA,OAAK,IAAIM,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGL,QAAQ,CAACM,MAA7B,EAAqCD,CAAC,EAAtC,EAA0C;AACxCD,IAAAA,UAAU,CAACG,UAAX,CAAsBP,QAAQ,CAACK,CAAD,CAA9B;AACD;;AACD,OAAK,IAAIA,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGL,QAAQ,CAACM,MAA7B,EAAqCD,CAAC,EAAtC,EAA0C;AACxCD,IAAAA,UAAU,CAACI,aAAX,CAAyBR,QAAQ,CAACK,CAAD,CAAjC;AACD;;AACDJ,EAAAA,QAAQ,IAAIA,QAAQ,EAApB;AACD","sourcesContent":["import { always } from '../../base';\nexport function evaluateOnce(node, children = [], callback) {\n if (!Array.isArray(children)) {\n children = [children];\n }\n const alwaysNode = always(node);\n for (let i = 0; i < children.length; i++) {\n alwaysNode.__addChild(children[i]);\n }\n for (let i = 0; i < children.length; i++) {\n alwaysNode.__removeChild(children[i]);\n }\n callback && callback();\n}\n"]}

View File

@ -0,0 +1,22 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = acc;
var _base = require("../base");
var _InternalAnimatedValue = _interopRequireDefault(require("../core/InternalAnimatedValue"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const procAcc = (0, _base.proc)(function (v, acc) {
return (0, _base.set)(acc, (0, _base.add)(acc, v));
});
function acc(v) {
const acc = new _InternalAnimatedValue.default(0);
return procAcc(v, acc);
}
//# sourceMappingURL=acc.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["acc.js"],"names":["procAcc","v","acc","AnimatedValue"],"mappings":";;;;;;;AAAA;;AACA;;;;AAEA,MAAMA,OAAO,GAAG,gBAAK,UAASC,CAAT,EAAYC,GAAZ,EAAiB;AACpC,SAAO,eAAIA,GAAJ,EAAS,eAAIA,GAAJ,EAASD,CAAT,CAAT,CAAP;AACD,CAFe,CAAhB;;AAIe,SAASC,GAAT,CAAaD,CAAb,EAAgB;AAC7B,QAAMC,GAAG,GAAG,IAAIC,8BAAJ,CAAkB,CAAlB,CAAZ;AACA,SAAOH,OAAO,CAACC,CAAD,EAAIC,GAAJ,CAAd;AACD","sourcesContent":["import { set, add, proc } from '../base';\nimport AnimatedValue from '../core/InternalAnimatedValue';\n\nconst procAcc = proc(function(v, acc) {\n return set(acc, add(acc, v));\n});\n\nexport default function acc(v) {\n const acc = new AnimatedValue(0);\n return procAcc(v, acc);\n}\n"]}

View File

@ -0,0 +1,41 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = color;
var _reactNative = require("react-native");
var _base = require("../base");
var _AnimatedNode = _interopRequireDefault(require("../core/AnimatedNode"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const procColor = (0, _base.proc)(function (r, g, b, a) {
const color = (0, _base.add)((0, _base.multiply)(a, 1 << 24), (0, _base.multiply)((0, _base.round)(r), 1 << 16), (0, _base.multiply)((0, _base.round)(g), 1 << 8), (0, _base.round)(b));
if (_reactNative.Platform.OS === 'android') {
// on Android color is represented as signed 32 bit int
return (0, _base.cond)((0, _base.lessThan)(color, 1 << 31 >>> 0), color, (0, _base.sub)(color, Math.pow(2, 32)));
}
return color;
});
function color(r, g, b, a = 1) {
if (_reactNative.Platform.OS === 'web') {
// doesn't support bit shifting
return (0, _base.concat)('rgba(', r, ',', g, ',', b, ',', a, ')');
}
if (a instanceof _AnimatedNode.default) {
a = (0, _base.round)((0, _base.multiply)(a, 255));
} else {
a = Math.round(a * 255);
}
return procColor(r, g, b, a);
}
//# sourceMappingURL=color.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["color.js"],"names":["procColor","r","g","b","a","color","Platform","OS","Math","pow","AnimatedNode","round"],"mappings":";;;;;;;AAAA;;AAEA;;AACA;;;;AAEA,MAAMA,SAAS,GAAG,gBAAK,UAASC,CAAT,EAAYC,CAAZ,EAAeC,CAAf,EAAkBC,CAAlB,EAAqB;AAC1C,QAAMC,KAAK,GAAG,eACZ,oBAASD,CAAT,EAAY,KAAK,EAAjB,CADY,EAEZ,oBAAS,iBAAMH,CAAN,CAAT,EAAmB,KAAK,EAAxB,CAFY,EAGZ,oBAAS,iBAAMC,CAAN,CAAT,EAAmB,KAAK,CAAxB,CAHY,EAIZ,iBAAMC,CAAN,CAJY,CAAd;;AAOA,MAAIG,sBAASC,EAAT,KAAgB,SAApB,EAA+B;AAC7B;AACA,WAAO,gBACL,oBAASF,KAAT,EAAiB,KAAK,EAAN,KAAc,CAA9B,CADK,EAELA,KAFK,EAGL,eAAIA,KAAJ,EAAWG,IAAI,CAACC,GAAL,CAAS,CAAT,EAAY,EAAZ,CAAX,CAHK,CAAP;AAKD;;AACD,SAAOJ,KAAP;AACD,CAjBiB,CAAlB;;AAmBe,SAASA,KAAT,CAAeJ,CAAf,EAAkBC,CAAlB,EAAqBC,CAArB,EAAwBC,CAAC,GAAG,CAA5B,EAA+B;AAC5C,MAAIE,sBAASC,EAAT,KAAgB,KAApB,EAA2B;AACzB;AACA,WAAO,kBAAO,OAAP,EAAgBN,CAAhB,EAAmB,GAAnB,EAAwBC,CAAxB,EAA2B,GAA3B,EAAgCC,CAAhC,EAAmC,GAAnC,EAAwCC,CAAxC,EAA2C,GAA3C,CAAP;AACD;;AAED,MAAIA,CAAC,YAAYM,qBAAjB,EAA+B;AAC7BN,IAAAA,CAAC,GAAG,iBAAM,oBAASA,CAAT,EAAY,GAAZ,CAAN,CAAJ;AACD,GAFD,MAEO;AACLA,IAAAA,CAAC,GAAGI,IAAI,CAACG,KAAL,CAAWP,CAAC,GAAG,GAAf,CAAJ;AACD;;AAED,SAAOJ,SAAS,CAACC,CAAD,EAAIC,CAAJ,EAAOC,CAAP,EAAUC,CAAV,CAAhB;AACD","sourcesContent":["import { Platform } from 'react-native';\n\nimport { add, cond, concat, lessThan, multiply, round, sub, proc } from '../base';\nimport AnimatedNode from '../core/AnimatedNode';\n\nconst procColor = proc(function(r, g, b, a) {\n const color = add(\n multiply(a, 1 << 24),\n multiply(round(r), 1 << 16),\n multiply(round(g), 1 << 8),\n round(b)\n );\n \n if (Platform.OS === 'android') {\n // on Android color is represented as signed 32 bit int\n return cond(\n lessThan(color, (1 << 31) >>> 0),\n color,\n sub(color, Math.pow(2, 32))\n );\n }\n return color;\n});\n\nexport default function color(r, g, b, a = 1) {\n if (Platform.OS === 'web') {\n // doesn't support bit shifting\n return concat('rgba(', r, ',', g, ',', b, ',', a, ')');\n }\n\n if (a instanceof AnimatedNode) {\n a = round(multiply(a, 255));\n } else {\n a = Math.round(a * 255);\n }\n\n return procColor(r, g, b, a);\n}\n"]}

Some files were not shown because too many files have changed in this diff Show More