8cece5849d2a54b3596b05d0a2a2ed3a.json 8.24 KB
{"ast":null,"code":"'use strict';var _interopRequireDefault=require(\"@babel/runtime/helpers/interopRequireDefault\");Object.defineProperty(exports,\"__esModule\",{value:true});exports.default=void 0;var _Animation2=_interopRequireDefault(require(\"./Animation\"));var _NativeAnimatedHelper=require(\"../NativeAnimatedHelper\");function _inheritsLoose(subClass,superClass){subClass.prototype=Object.create(superClass.prototype);subClass.prototype.constructor=subClass;subClass.__proto__=superClass;}var DecayAnimation=function(_Animation){_inheritsLoose(DecayAnimation,_Animation);function DecayAnimation(config){var _this;_this=_Animation.call(this)||this;_this._deceleration=config.deceleration!==undefined?config.deceleration:0.998;_this._velocity=config.velocity;_this._useNativeDriver=(0,_NativeAnimatedHelper.shouldUseNativeDriver)(config);_this.__isInteraction=config.isInteraction!==undefined?config.isInteraction:true;_this.__iterations=config.iterations!==undefined?config.iterations:1;return _this;}var _proto=DecayAnimation.prototype;_proto.__getNativeAnimationConfig=function __getNativeAnimationConfig(){return{type:'decay',deceleration:this._deceleration,velocity:this._velocity,iterations:this.__iterations};};_proto.start=function start(fromValue,onUpdate,onEnd,previousAnimation,animatedValue){this.__active=true;this._lastValue=fromValue;this._fromValue=fromValue;this._onUpdate=onUpdate;this.__onEnd=onEnd;this._startTime=Date.now();if(this._useNativeDriver){this.__startNativeAnimation(animatedValue);}else{this._animationFrame=requestAnimationFrame(this.onUpdate.bind(this));}};_proto.onUpdate=function onUpdate(){var now=Date.now();var value=this._fromValue+this._velocity/(1-this._deceleration)*(1-Math.exp(-(1-this._deceleration)*(now-this._startTime)));this._onUpdate(value);if(Math.abs(this._lastValue-value)<0.1){this.__debouncedOnEnd({finished:true});return;}this._lastValue=value;if(this.__active){this._animationFrame=requestAnimationFrame(this.onUpdate.bind(this));}};_proto.stop=function stop(){_Animation.prototype.stop.call(this);this.__active=false;global.cancelAnimationFrame(this._animationFrame);this.__debouncedOnEnd({finished:false});};return DecayAnimation;}(_Animation2.default);var _default=DecayAnimation;exports.default=_default;","map":{"version":3,"sources":["C:/Users/bluej/Desktop/2_2/searchGuide/searchGuide/node_modules/react-native-web/dist/vendor/react-native/Animated/animations/DecayAnimation.js"],"names":["_inheritsLoose","subClass","superClass","prototype","Object","create","constructor","__proto__","DecayAnimation","_Animation","config","_this","call","_deceleration","deceleration","undefined","_velocity","velocity","_useNativeDriver","__isInteraction","isInteraction","__iterations","iterations","_proto","__getNativeAnimationConfig","type","start","fromValue","onUpdate","onEnd","previousAnimation","animatedValue","__active","_lastValue","_fromValue","_onUpdate","__onEnd","_startTime","Date","now","__startNativeAnimation","_animationFrame","requestAnimationFrame","bind","value","Math","exp","abs","__debouncedOnEnd","finished","stop","global","cancelAnimationFrame","Animation"],"mappings":"AASA,a,mKAIA,+DACA,6DAHA,QAASA,CAAAA,cAAT,CAAwBC,QAAxB,CAAkCC,UAAlC,CAA8C,CAAED,QAAQ,CAACE,SAAT,CAAqBC,MAAM,CAACC,MAAP,CAAcH,UAAU,CAACC,SAAzB,CAArB,CAA0DF,QAAQ,CAACE,SAAT,CAAmBG,WAAnB,CAAiCL,QAAjC,CAA2CA,QAAQ,CAACM,SAAT,CAAqBL,UAArB,CAAkC,CAKvL,GAAIM,CAAAA,cAAc,CAElB,SAAUC,UAAV,CAAsB,CACpBT,cAAc,CAACQ,cAAD,CAAiBC,UAAjB,CAAd,CAEA,QAASD,CAAAA,cAAT,CAAwBE,MAAxB,CAAgC,CAC9B,GAAIC,CAAAA,KAAJ,CAEAA,KAAK,CAAGF,UAAU,CAACG,IAAX,CAAgB,IAAhB,GAAyB,IAAjC,CACAD,KAAK,CAACE,aAAN,CAAsBH,MAAM,CAACI,YAAP,GAAwBC,SAAxB,CAAoCL,MAAM,CAACI,YAA3C,CAA0D,KAAhF,CACAH,KAAK,CAACK,SAAN,CAAkBN,MAAM,CAACO,QAAzB,CACAN,KAAK,CAACO,gBAAN,CAAyB,gDAAsBR,MAAtB,CAAzB,CACAC,KAAK,CAACQ,eAAN,CAAwBT,MA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aAA3B,GAA6C,EAAIgC,IAAI,CAACC,GAAL,CAAS,EAAE,EAAI,KAAKjC,aAAX,GAA6B0B,GAAG,CAAG,KAAKF,UAAxC,CAAT,CAAjD,CAA9B,CAEA,KAAKF,SAAL,CAAeS,KAAf,EAEA,GAAIC,IAAI,CAACE,GAAL,CAAS,KAAKd,UAAL,CAAkBW,KAA3B,EAAoC,GAAxC,CAA6C,CAC3C,KAAKI,gBAAL,CAAsB,CACpBC,QAAQ,CAAE,IADU,CAAtB,EAIA,OACD,CAED,KAAKhB,UAAL,CAAkBW,KAAlB,CAEA,GAAI,KAAKZ,QAAT,CAAmB,CACjB,KAAKS,eAAL,CAAuBC,qBAAqB,CAAC,KAAKd,QAAL,CAAce,IAAd,CAAmB,IAAnB,CAAD,CAA5C,CACD,CACF,CAnBD,CAqBApB,MAAM,CAAC2B,IAAP,CAAc,QAASA,CAAAA,IAAT,EAAgB,CAC5BzC,UAAU,CAACN,SAAX,CAAqB+C,IAArB,CAA0BtC,IAA1B,CAA+B,IAA/B,EAEA,KAAKoB,QAAL,CAAgB,KAAhB,CACAmB,MAAM,CAACC,oBAAP,CAA4B,KAAKX,eAAjC,EAEA,KAAKO,gBAAL,CAAsB,CACpBC,QAAQ,CAAE,KADU,CAAtB,EAGD,CATD,CAWA,MAAOzC,CAAAA,cAAP,CACD,CA1ED,CA0EE6C,mBA1EF,CAFA,C,aA8Ee7C,c","sourcesContent":["/**\n * Copyright (c) 2015-present, Facebook, Inc.\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\nfunction _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }\n\nimport Animation from './Animation';\nimport { shouldUseNativeDriver } from '../NativeAnimatedHelper';\n\nvar DecayAnimation =\n/*#__PURE__*/\nfunction (_Animation) {\n  _inheritsLoose(DecayAnimation, _Animation);\n\n  function DecayAnimation(config) {\n    var _this;\n\n    _this = _Animation.call(this) || this;\n    _this._deceleration = config.deceleration !== undefined ? config.deceleration : 0.998;\n    _this._velocity = config.velocity;\n    _this._useNativeDriver = shouldUseNativeDriver(config);\n    _this.__isInteraction = config.isInteraction !== undefined ? config.isInteraction : true;\n    _this.__iterations = config.iterations !== undefined ? config.iterations : 1;\n    return _this;\n  }\n\n  var _proto = DecayAnimation.prototype;\n\n  _proto.__getNativeAnimationConfig = function __getNativeAnimationConfig() {\n    return {\n      type: 'decay',\n      deceleration: this._deceleration,\n      velocity: this._velocity,\n      iterations: this.__iterations\n    };\n  };\n\n  _proto.start = 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\n    if (this._useNativeDriver) {\n      this.__startNativeAnimation(animatedValue);\n    } else {\n      this._animationFrame = requestAnimationFrame(this.onUpdate.bind(this));\n    }\n  };\n\n  _proto.onUpdate = 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\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  _proto.stop = function stop() {\n    _Animation.prototype.stop.call(this);\n\n    this.__active = false;\n    global.cancelAnimationFrame(this._animationFrame);\n\n    this.__debouncedOnEnd({\n      finished: false\n    });\n  };\n\n  return DecayAnimation;\n}(Animation);\n\nexport default DecayAnimation;"]},"metadata":{},"sourceType":"script"}