cc14203f1cf171e7d35493cd841367c8.json 11.9 KB
{"ast":null,"code":"'use strict';var _interopRequireDefault=require(\"@babel/runtime/helpers/interopRequireDefault\");Object.defineProperty(exports,\"__esModule\",{value:true});exports.default=void 0;var _AnimatedValue=_interopRequireDefault(require(\"../nodes/AnimatedValue\"));var _AnimatedValueXY=_interopRequireDefault(require(\"../nodes/AnimatedValueXY\"));var _Animation2=_interopRequireDefault(require(\"./Animation\"));var _Easing=_interopRequireDefault(require(\"../Easing\"));var _NativeAnimatedHelper=require(\"../NativeAnimatedHelper\");function _inheritsLoose(subClass,superClass){subClass.prototype=Object.create(superClass.prototype);subClass.prototype.constructor=subClass;subClass.__proto__=superClass;}var _easeInOut;function easeInOut(){if(!_easeInOut){_easeInOut=_Easing.default.inOut(_Easing.default.ease);}return _easeInOut;}var TimingAnimation=function(_Animation){_inheritsLoose(TimingAnimation,_Animation);function TimingAnimation(config){var _this;_this=_Animation.call(this)||this;_this._toValue=config.toValue;_this._easing=config.easing!==undefined?config.easing:easeInOut();_this._duration=config.duration!==undefined?config.duration:500;_this._delay=config.delay!==undefined?config.delay:0;_this.__iterations=config.iterations!==undefined?config.iterations:1;_this.__isInteraction=config.isInteraction!==undefined?config.isInteraction:true;_this._useNativeDriver=(0,_NativeAnimatedHelper.shouldUseNativeDriver)(config);return _this;}var _proto=TimingAnimation.prototype;_proto.__getNativeAnimationConfig=function __getNativeAnimationConfig(){var frameDuration=1000.0/60.0;var frames=[];for(var dt=0.0;dt<this._duration;dt+=frameDuration){frames.push(this._easing(dt/this._duration));}frames.push(this._easing(1));return{type:'frames',frames:frames,toValue:this._toValue,iterations:this.__iterations};};_proto.start=function start(fromValue,onUpdate,onEnd,previousAnimation,animatedValue){var _this2=this;this.__active=true;this._fromValue=fromValue;this._onUpdate=onUpdate;this.__onEnd=onEnd;var start=function start(){if(_this2._duration===0&&!_this2._useNativeDriver){_this2._onUpdate(_this2._toValue);_this2.__debouncedOnEnd({finished:true});}else{_this2._startTime=Date.now();if(_this2._useNativeDriver){_this2.__startNativeAnimation(animatedValue);}else{_this2._animationFrame=requestAnimationFrame(_this2.onUpdate.bind(_this2));}}};if(this._delay){this._timeout=setTimeout(start,this._delay);}else{start();}};_proto.onUpdate=function onUpdate(){var now=Date.now();if(now>=this._startTime+this._duration){if(this._duration===0){this._onUpdate(this._toValue);}else{this._onUpdate(this._fromValue+this._easing(1)*(this._toValue-this._fromValue));}this.__debouncedOnEnd({finished:true});return;}this._onUpdate(this._fromValue+this._easing((now-this._startTime)/this._duration)*(this._toValue-this._fromValue));if(this.__active){this._animationFrame=requestAnimationFrame(this.onUpdate.bind(this));}};_proto.stop=function stop(){_Animation.prototype.stop.call(this);this.__active=false;clearTimeout(this._timeout);global.cancelAnimationFrame(this._animationFrame);this.__debouncedOnEnd({finished:false});};return TimingAnimation;}(_Animation2.default);var _default=TimingAnimation;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/TimingAnimation.js"],"names":["_inheritsLoose","subClass","superClass","prototype","Object","create","constructor","__proto__","_easeInOut","easeInOut","Easing","inOut","ease","TimingAnimation","_Animation","config","_this","call","_toValue","toValue","_easing","easing","undefined","_duration","duration","_delay","delay","__iterations","iterations","__isInteraction","isInteraction","_useNativeDriver","_proto","__getNativeAnimationConfig","frameDuration","frames","dt","push","type","start","fromValue","onUpdate","onEnd","previousAnimation","animatedValue","_this2","__active","_fromValue","_onUpdate","__onEnd","__debouncedOnEnd","finished","_startTime","Date","now","__startNativeAnimation","_animationFrame","requestAnimationFrame","bind","_timeout","setTimeout","stop","clearTimeout","global","cancelAnimationFrame","Animation"],"mappings":"AASA,a,mKAIA,6EACA,iFACA,+DACA,yDACA,6DANA,QAASA,CAAAA,cAAT,CAAwBC,QAAxB,CAAkCC,UAAlC,CAA8C,CAAED,QAAQ,CAACE,SAAT,CAAqBC,MAAM,CAACC,MAAP,CAAcH,UAAU,CAACC,SAAzB,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CAtBD,CAwBA1B,MAAM,CAAC6B,IAAP,CAAc,QAASA,CAAAA,IAAT,EAAgB,CAC5B/C,UAAU,CAACX,SAAX,CAAqB0D,IAArB,CAA0B5C,IAA1B,CAA+B,IAA/B,EAEA,KAAK6B,QAAL,CAAgB,KAAhB,CACAgB,YAAY,CAAC,KAAKH,QAAN,CAAZ,CACAI,MAAM,CAACC,oBAAP,CAA4B,KAAKR,eAAjC,EAEA,KAAKN,gBAAL,CAAsB,CACpBC,QAAQ,CAAE,KADU,CAAtB,EAGD,CAVD,CAYA,MAAOtC,CAAAA,eAAP,CACD,CA7GD,CA6GEoD,mBA7GF,CAFA,C,aAiHepD,e","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 AnimatedValue from '../nodes/AnimatedValue';\nimport AnimatedValueXY from '../nodes/AnimatedValueXY';\nimport Animation from './Animation';\nimport Easing from '../Easing';\nimport { shouldUseNativeDriver } from '../NativeAnimatedHelper';\n\nvar _easeInOut;\n\nfunction easeInOut() {\n  if (!_easeInOut) {\n    _easeInOut = Easing.inOut(Easing.ease);\n  }\n\n  return _easeInOut;\n}\n\nvar TimingAnimation =\n/*#__PURE__*/\nfunction (_Animation) {\n  _inheritsLoose(TimingAnimation, _Animation);\n\n  function TimingAnimation(config) {\n    var _this;\n\n    _this = _Animation.call(this) || this;\n    _this._toValue = config.toValue;\n    _this._easing = config.easing !== undefined ? config.easing : easeInOut();\n    _this._duration = config.duration !== undefined ? config.duration : 500;\n    _this._delay = config.delay !== undefined ? config.delay : 0;\n    _this.__iterations = config.iterations !== undefined ? config.iterations : 1;\n    _this.__isInteraction = config.isInteraction !== undefined ? config.isInteraction : true;\n    _this._useNativeDriver = shouldUseNativeDriver(config);\n    return _this;\n  }\n\n  var _proto = TimingAnimation.prototype;\n\n  _proto.__getNativeAnimationConfig = function __getNativeAnimationConfig() {\n    var frameDuration = 1000.0 / 60.0;\n    var frames = [];\n\n    for (var dt = 0.0; dt < this._duration; dt += frameDuration) {\n      frames.push(this._easing(dt / this._duration));\n    }\n\n    frames.push(this._easing(1));\n    return {\n      type: 'frames',\n      frames: frames,\n      toValue: this._toValue,\n      iterations: this.__iterations\n    };\n  };\n\n  _proto.start = function start(fromValue, onUpdate, onEnd, previousAnimation, animatedValue) {\n    var _this2 = this;\n\n    this.__active = true;\n    this._fromValue = fromValue;\n    this._onUpdate = onUpdate;\n    this.__onEnd = onEnd;\n\n    var start = function start() {\n      // Animations that sometimes have 0 duration and sometimes do not\n      // still need to use the native driver when duration is 0 so as to\n      // not cause intermixed JS and native animations.\n      if (_this2._duration === 0 && !_this2._useNativeDriver) {\n        _this2._onUpdate(_this2._toValue);\n\n        _this2.__debouncedOnEnd({\n          finished: true\n        });\n      } else {\n        _this2._startTime = Date.now();\n\n        if (_this2._useNativeDriver) {\n          _this2.__startNativeAnimation(animatedValue);\n        } else {\n          _this2._animationFrame = requestAnimationFrame(_this2.onUpdate.bind(_this2));\n        }\n      }\n    };\n\n    if (this._delay) {\n      this._timeout = setTimeout(start, this._delay);\n    } else {\n      start();\n    }\n  };\n\n  _proto.onUpdate = function onUpdate() {\n    var now = Date.now();\n\n    if (now >= this._startTime + this._duration) {\n      if (this._duration === 0) {\n        this._onUpdate(this._toValue);\n      } else {\n        this._onUpdate(this._fromValue + this._easing(1) * (this._toValue - this._fromValue));\n      }\n\n      this.__debouncedOnEnd({\n        finished: true\n      });\n\n      return;\n    }\n\n    this._onUpdate(this._fromValue + this._easing((now - this._startTime) / this._duration) * (this._toValue - this._fromValue));\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    clearTimeout(this._timeout);\n    global.cancelAnimationFrame(this._animationFrame);\n\n    this.__debouncedOnEnd({\n      finished: false\n    });\n  };\n\n  return TimingAnimation;\n}(Animation);\n\nexport default TimingAnimation;"]},"metadata":{},"sourceType":"script"}