UNPKG

addimated

Version:

An always interruptable, declarative animation library for React

71 lines (54 loc) 2.41 kB
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); Object.defineProperty(exports, "__esModule", { value: true }); exports.AnimatedInterpolation = void 0; var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")); var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass")); var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn")); var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf")); var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits")); var _invariant = _interopRequireDefault(require("invariant")); var _Animated = require("./Animated"); var _AnimatedWithChildren2 = require("./AnimatedWithChildren"); var _Interpolation = require("./Interpolation"); var AnimatedInterpolation = /*#__PURE__*/ function (_AnimatedWithChildren) { (0, _inherits2.default)(AnimatedInterpolation, _AnimatedWithChildren); function AnimatedInterpolation(parent, interpolation) { var _this; (0, _classCallCheck2.default)(this, AnimatedInterpolation); _this = (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(AnimatedInterpolation).call(this)); _this.parent = parent; _this.interpolation = interpolation; return _this; } (0, _createClass2.default)(AnimatedInterpolation, [{ key: "__getValue", value: function __getValue() { var parentValue = this.parent.__getValue(); !(typeof parentValue === "number") ? process.env.NODE_ENV !== "production" ? (0, _invariant.default)(false, "Cannot interpolate an input which is not a number.") : invariant(false) : void 0; return this.interpolation(parentValue); } }, { key: "interpolate", value: function interpolate(config) { return new AnimatedInterpolation(this, _Interpolation.Interpolation.create(config)); } }, { key: "__attach", value: function __attach() { this.parent.__addChild(this); } }, { key: "__detach", value: function __detach() { this.parent.__removeChild(this); } }]); return AnimatedInterpolation; }(_AnimatedWithChildren2.AnimatedWithChildren); exports.AnimatedInterpolation = AnimatedInterpolation; //# sourceMappingURL=AnimatedInterpolation.js.map