You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1 line
9.3 KiB

{"ast":null,"code":"'use strict';\n\nimport _classCallCheck from \"@babel/runtime/helpers/classCallCheck\";\nimport _createClass from \"@babel/runtime/helpers/createClass\";\nimport _get from \"@babel/runtime/helpers/get\";\nimport _inherits from \"@babel/runtime/helpers/inherits\";\nimport _possibleConstructorReturn from \"@babel/runtime/helpers/possibleConstructorReturn\";\nimport _getPrototypeOf from \"@babel/runtime/helpers/getPrototypeOf\";\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\nimport Animation from \"./Animation\";\nimport { shouldUseNativeDriver } from \"../NativeAnimatedHelper\";\nvar DecayAnimation = function (_Animation) {\n _inherits(DecayAnimation, _Animation);\n var _super = _createSuper(DecayAnimation);\n function DecayAnimation(config) {\n var _this;\n _classCallCheck(this, DecayAnimation);\n var _config$deceleration, _config$isInteraction, _config$iterations;\n _this = _super.call(this);\n _this._deceleration = (_config$deceleration = config.deceleration) !== null && _config$deceleration !== void 0 ? _config$deceleration : 0.998;\n _this._velocity = config.velocity;\n _this._useNativeDriver = shouldUseNativeDriver(config);\n _this.__isInteraction = (_config$isInteraction = config.isInteraction) !== null && _config$isInteraction !== void 0 ? _config$isInteraction : !_this._useNativeDriver;\n _this.__iterations = (_config$iterations = config.iterations) !== null && _config$iterations !== void 0 ? _config$iterations : 1;\n return _this;\n }\n _createClass(DecayAnimation, [{\n key: \"__getNativeAnimationConfig\",\n value: function __getNativeAnimationConfig() {\n return {\n type: 'decay',\n deceleration: this._deceleration,\n velocity: this._velocity,\n iterations: this.__iterations\n };\n }\n }, {\n key: \"start\",\n value: function start(fromValue, onUpdate, onEnd, previousAnimation, animatedValue) {\n this.__active = true;\n this._lastValue = fromValue;\n this._fromValue = fromValue;\n this._onUpdate = onUpdate;\n this.__onEnd = onEnd;\n this._startTime = Date.now();\n if (this._useNativeDriver) {\n this.__startNativeAnimation(animatedValue);\n } else {\n this._animationFrame = requestAnimationFrame(this.onUpdate.bind(this));\n }\n }\n }, {\n key: \"onUpdate\",\n value: function onUpdate() {\n var now = Date.now();\n var value = this._fromValue + this._velocity / (1 - this._deceleration) * (1 - Math.exp(-(1 - this._deceleration) * (now - this._startTime)));\n this._onUpdate(value);\n if (Math.abs(this._lastValue - value) < 0.1) {\n this.__debouncedOnEnd({\n finished: true\n });\n return;\n }\n this._lastValue = value;\n if (this.__active) {\n this._animationFrame = requestAnimationFrame(this.onUpdate.bind(this));\n }\n }\n }, {\n key: \"stop\",\n value: function stop() {\n _get(_getPrototypeOf(DecayAnimation.prototype), \"stop\", this).call(this);\n this.__active = false;\n global.cancelAnimationFrame(this._animationFrame);\n this.__debouncedOnEnd({\n finished: false\n });\n }\n }]);\n return DecayAnimation;\n}(Animation);\nexport default DecayAnimation;","map":{"version":3,"names":["Animation","shouldUseNativeDriver","DecayAnimation","config","_config$deceleration","_config$isInteraction","_config$iterations","_deceleration","deceleration","_velocity","velocity","_useNativeDriver","__isInteraction","isInteraction","__iterations","iterations","type","fromValue","onUpdate","onEnd","previousAnimation","animatedValue","__active","_lastValue","_fromValue","_onUpdate","__onEnd","_startTime","Date","now","__startNativeAnimation","_animationFrame","requestAnimationFrame","bind","value","Math","exp","abs","__debouncedOnEnd","finished","global","cancelAnimationFrame"],"sources":["/Users/thomaschazot/Documents/But2A/LaSuperMeteo/iut-expo-starter/node_modules/react-native-web/dist/vendor/react-native/Animated/animations/DecayAnimation.js"],"sourcesContent":["/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * \n * @format\n */\n'use strict';\n\nimport Animation from './Animation';\nimport { shouldUseNativeDriver } from '../NativeAnimatedHelper';\n\nclass DecayAnimation extends Animation {\n constructor(config) {\n var _config$deceleration, _config$isInteraction, _config$iterations;\n\n super();\n this._deceleration = (_config$deceleration = config.deceleration) !== null && _config$deceleration !== void 0 ? _config$deceleration : 0.998;\n this._velocity = config.velocity;\n this._useNativeDriver = shouldUseNativeDriver(config);\n this.__isInteraction = (_config$isInteraction = config.isInteraction) !== null && _config$isInteraction !== void 0 ? _config$isInteraction : !this._useNativeDriver;\n this.__iterations = (_config$iterations = config.iterations) !== null && _config$iterations !== void 0 ? _config$iterations : 1;\n }\n\n __getNativeAnimationConfig() {\n return {\n type: 'decay',\n deceleration: this._deceleration,\n velocity: this._velocity,\n iterations: this.__iterations\n };\n }\n\n start(fromValue, onUpdate, onEnd, previousAnimation, animatedValue) {\n this.__active = true;\n this._lastValue = fromValue;\n this._fromValue = fromValue;\n this._onUpdate = onUpdate;\n this.__onEnd = onEnd;\n this._startTime = Date.now();\n\n if (this._useNativeDriver) {\n this.__startNativeAnimation(animatedValue);\n } else {\n this._animationFrame = requestAnimationFrame(this.onUpdate.bind(this));\n }\n }\n\n onUpdate() {\n var now = Date.now();\n var value = this._fromValue + this._velocity / (1 - this._deceleration) * (1 - Math.exp(-(1 - this._deceleration) * (now - this._startTime)));\n\n this._onUpdate(value);\n\n if (Math.abs(this._lastValue - value) < 0.1) {\n this.__debouncedOnEnd({\n finished: true\n });\n\n return;\n }\n\n this._lastValue = value;\n\n if (this.__active) {\n this._animationFrame = requestAnimationFrame(this.onUpdate.bind(this));\n }\n }\n\n stop() {\n super.stop();\n this.__active = false;\n global.cancelAnimationFrame(this._animationFrame);\n\n this.__debouncedOnEnd({\n finished: false\n });\n }\n\n}\n\nexport default DecayAnim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