react-spring
Advanced tools
Comparing version 4.2.0 to 4.2.1-beta.0
@@ -1,3 +0,10 @@ | ||
## 4.0.2 | ||
## 4.2.0 | ||
* Exposed imperative Value animations: https://codesandbox.io/embed/3x350m0541 | ||
* Exposed createAnimatedValue: https://github.com/drcmda/react-spring/pull/63#issuecomment-382845475 | ||
* hold property: https://github.com/drcmda/react-spring/pull/48 | ||
* Various bugfixes | ||
## 4.0.2 | ||
Keyframe api, various bugfixes | ||
@@ -29,2 +36,2 @@ | ||
* Parallax | ||
* Parallax |
@@ -299,3 +299,3 @@ 'use strict'; | ||
if (now >= _this._startTime + _this._duration) { | ||
_this._onUpdate(_this._duration === 0 ? _this._toValue : _this._fromValue + _this._easing(1) * (_this._toValue - _this._fromValue)); | ||
_this._onUpdate(_this._duration === 0 ? _this._to : _this._fromValue + _this._easing(1) * (_this._to - _this._fromValue)); | ||
@@ -309,3 +309,3 @@ _this.__debouncedOnEnd({ | ||
_this._onUpdate(_this._fromValue + _this._easing((now - _this._startTime) / _this._duration) * (_this._toValue - _this._fromValue)); | ||
_this._onUpdate(_this._fromValue + _this._easing((now - _this._startTime) / _this._duration) * (_this._to - _this._fromValue)); | ||
@@ -315,3 +315,3 @@ if (_this.__active) _this._animationFrame = requestAnimationFrame(_this.onUpdate); | ||
_this._toValue = config.toValue; | ||
_this._to = config.to; | ||
_this._easing = config.easing !== undefined ? config.easing : easeInOut; | ||
@@ -335,3 +335,3 @@ _this._duration = config.duration !== undefined ? config.duration : 500; | ||
if (_this2._duration === 0) { | ||
_this2._onUpdate(_this2._toValue); | ||
_this2._onUpdate(_this2._to); | ||
@@ -416,3 +416,3 @@ _this2.__debouncedOnEnd({ | ||
var x0 = _this._toValue - _this._startPosition; // calculate the oscillation from x0 = 1 to x = 0 | ||
var x0 = _this._to - _this._startPosition; // calculate the oscillation from x0 = 1 to x = 0 | ||
@@ -426,3 +426,3 @@ var position = 0.0; | ||
var envelope = Math.exp(-zeta * omega0 * t); | ||
position = _this._toValue - envelope * ((v0 + zeta * omega0 * x0) / omega1 * Math.sin(omega1 * t) + x0 * Math.cos(omega1 * t)); // This looks crazy -- it's actually just the derivative of the | ||
position = _this._to - envelope * ((v0 + zeta * omega0 * x0) / omega1 * Math.sin(omega1 * t) + x0 * Math.cos(omega1 * t)); // This looks crazy -- it's actually just the derivative of the | ||
// oscillation function | ||
@@ -435,3 +435,3 @@ | ||
position = _this._toValue - _envelope * (x0 + (v0 + omega0 * x0) * t); | ||
position = _this._to - _envelope * (x0 + (v0 + omega0 * x0) * t); | ||
velocity = _envelope * (v0 * (t * omega0 - 1) + t * x0 * (omega0 * omega0)); | ||
@@ -452,3 +452,3 @@ } | ||
if (_this._overshootClamping && _this._stiffness !== 0) { | ||
isOvershooting = _this._startPosition < _this._toValue ? position > _this._toValue : position < _this._toValue; | ||
isOvershooting = _this._startPosition < _this._to ? position > _this._to : position < _this._to; | ||
} | ||
@@ -461,3 +461,3 @@ | ||
if (_this._stiffness !== 0) { | ||
isDisplacement = Math.abs(_this._toValue - position) <= _this._restDisplacementThreshold; | ||
isDisplacement = Math.abs(_this._to - position) <= _this._restDisplacementThreshold; | ||
} | ||
@@ -468,6 +468,6 @@ | ||
// Ensure that we end up with a round value | ||
_this._lastPosition = _this._toValue; | ||
_this._lastPosition = _this._to; | ||
_this._lastVelocity = 0; | ||
_this._onUpdate(_this._toValue); | ||
_this._onUpdate(_this._to); | ||
} | ||
@@ -488,3 +488,3 @@ | ||
_this._lastVelocity = withDefault(config.velocity, 0); | ||
_this._toValue = config.toValue; | ||
_this._to = config.to; | ||
var springConfig = fromOrigamiTensionAndFriction(withDefault(config.tension, 40), withDefault(config.friction, 7)); | ||
@@ -491,0 +491,0 @@ _this._tension = springConfig.tension; |
@@ -293,3 +293,3 @@ import _inheritsLoose from '@babel/runtime/helpers/builtin/es6/inheritsLoose'; | ||
if (now >= _this._startTime + _this._duration) { | ||
_this._onUpdate(_this._duration === 0 ? _this._toValue : _this._fromValue + _this._easing(1) * (_this._toValue - _this._fromValue)); | ||
_this._onUpdate(_this._duration === 0 ? _this._to : _this._fromValue + _this._easing(1) * (_this._to - _this._fromValue)); | ||
@@ -303,3 +303,3 @@ _this.__debouncedOnEnd({ | ||
_this._onUpdate(_this._fromValue + _this._easing((now - _this._startTime) / _this._duration) * (_this._toValue - _this._fromValue)); | ||
_this._onUpdate(_this._fromValue + _this._easing((now - _this._startTime) / _this._duration) * (_this._to - _this._fromValue)); | ||
@@ -309,3 +309,3 @@ if (_this.__active) _this._animationFrame = requestAnimationFrame(_this.onUpdate); | ||
_this._toValue = config.toValue; | ||
_this._to = config.to; | ||
_this._easing = config.easing !== undefined ? config.easing : easeInOut; | ||
@@ -329,3 +329,3 @@ _this._duration = config.duration !== undefined ? config.duration : 500; | ||
if (_this2._duration === 0) { | ||
_this2._onUpdate(_this2._toValue); | ||
_this2._onUpdate(_this2._to); | ||
@@ -410,3 +410,3 @@ _this2.__debouncedOnEnd({ | ||
var x0 = _this._toValue - _this._startPosition; // calculate the oscillation from x0 = 1 to x = 0 | ||
var x0 = _this._to - _this._startPosition; // calculate the oscillation from x0 = 1 to x = 0 | ||
@@ -420,3 +420,3 @@ var position = 0.0; | ||
var envelope = Math.exp(-zeta * omega0 * t); | ||
position = _this._toValue - envelope * ((v0 + zeta * omega0 * x0) / omega1 * Math.sin(omega1 * t) + x0 * Math.cos(omega1 * t)); // This looks crazy -- it's actually just the derivative of the | ||
position = _this._to - envelope * ((v0 + zeta * omega0 * x0) / omega1 * Math.sin(omega1 * t) + x0 * Math.cos(omega1 * t)); // This looks crazy -- it's actually just the derivative of the | ||
// oscillation function | ||
@@ -429,3 +429,3 @@ | ||
position = _this._toValue - _envelope * (x0 + (v0 + omega0 * x0) * t); | ||
position = _this._to - _envelope * (x0 + (v0 + omega0 * x0) * t); | ||
velocity = _envelope * (v0 * (t * omega0 - 1) + t * x0 * (omega0 * omega0)); | ||
@@ -446,3 +446,3 @@ } | ||
if (_this._overshootClamping && _this._stiffness !== 0) { | ||
isOvershooting = _this._startPosition < _this._toValue ? position > _this._toValue : position < _this._toValue; | ||
isOvershooting = _this._startPosition < _this._to ? position > _this._to : position < _this._to; | ||
} | ||
@@ -455,3 +455,3 @@ | ||
if (_this._stiffness !== 0) { | ||
isDisplacement = Math.abs(_this._toValue - position) <= _this._restDisplacementThreshold; | ||
isDisplacement = Math.abs(_this._to - position) <= _this._restDisplacementThreshold; | ||
} | ||
@@ -462,6 +462,6 @@ | ||
// Ensure that we end up with a round value | ||
_this._lastPosition = _this._toValue; | ||
_this._lastPosition = _this._to; | ||
_this._lastVelocity = 0; | ||
_this._onUpdate(_this._toValue); | ||
_this._onUpdate(_this._to); | ||
} | ||
@@ -482,3 +482,3 @@ | ||
_this._lastVelocity = withDefault(config.velocity, 0); | ||
_this._toValue = config.toValue; | ||
_this._to = config.to; | ||
var springConfig = fromOrigamiTensionAndFriction(withDefault(config.tension, 40), withDefault(config.friction, 7)); | ||
@@ -485,0 +485,0 @@ _this._tension = springConfig.tension; |
@@ -1,1 +0,1 @@ | ||
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n(t.ReactSpringAddons={})}(this,function(t){"use strict";var n=function(t,n){t.prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n},i=function(){function t(){}var n=t.prototype;return n.start=function(t,n,i,e){},n.stop=function(){},n.__debouncedOnEnd=function(t){var n=this.__onEnd;this.__onEnd=null,n&&n(t)},t}(),e=4,o=.001,a=1e-7,r=10,s=11,u=1/(s-1),_="function"==typeof Float32Array;function c(t,n){return 1-3*n+3*t}function l(t,n){return 3*n-6*t}function f(t){return 3*t}function h(t,n,i){return((c(n,i)*t+l(n,i))*t+f(n))*t}function d(t,n,i){return 3*c(n,i)*t*t+2*l(n,i)*t+f(n)}function m(t,n,i,c){if(!(0<=t&&t<=1&&0<=i&&i<=1))throw new Error("bezier x values must be in [0, 1] range");var l=_?new Float32Array(s):new Array(s);if(t!==n||i!==c)for(var f=0;f<s;++f)l[f]=h(f*u,t,i);function m(n){for(var _=0,c=1,f=s-1;c!==f&&l[c]<=n;++c)_+=u;var m=_+(n-l[--c])/(l[c+1]-l[c])*u,p=d(m,t,i);return p>=o?function(t,n,i,o){for(var a=0;a<e;++a){var r=d(n,i,o);if(0===r)return n;n-=(h(n,i,o)-t)/r}return n}(n,m,t,i):0===p?m:function(t,n,i,e,o){var s,u,_=0;do{(s=h(u=n+(i-n)/2,e,o)-t)>0?i=u:n=u}while(Math.abs(s)>a&&++_<r);return u}(n,_,_+u,t,i)}return function(e){return t===n&&i===c?e:0===e?0:1===e?1:h(m(e),n,c)}}var p=function(){function t(){}return t.step0=function(t){return t>0?1:0},t.step1=function(t){return t>=1?1:0},t.linear=function(t){return t},t.ease=function(t){return v(t)},t.quad=function(t){return t*t},t.cubic=function(t){return t*t*t},t.poly=function(t){return function(n){return Math.pow(n,t)}},t.sin=function(t){return 1-Math.cos(t*Math.PI/2)},t.circle=function(t){return 1-Math.sqrt(1-t*t)},t.exp=function(t){return Math.pow(2,10*(t-1))},t.elastic=function(t){void 0===t&&(t=1);var n=t*Math.PI;return function(t){return 1-Math.pow(Math.cos(t*Math.PI/2),3)*Math.cos(t*n)}},t.back=function(t){return void 0===t&&(t=1.70158),function(n){return n*n*((t+1)*n-t)}},t.bounce=function(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375},t.bezier=function(t,n,i,e){return m(t,n,i,e)},t.in=function(t){return t},t.out=function(t){return function(n){return 1-t(1-n)}},t.inOut=function(t){return function(n){return n<.5?t(2*n)/2:1-t(2*(1-n))/2}},t}(),v=p.bezier(.42,0,1,1),y=p.inOut(p.ease),V=function(t){function i(n){var i;return(i=t.call(this)||this).onUpdate=function(){var t=Date.now();if(t>=i._startTime+i._duration)return i._onUpdate(0===i._duration?i._toValue:i._fromValue+i._easing(1)*(i._toValue-i._fromValue)),void i.__debouncedOnEnd({finished:!0});i._onUpdate(i._fromValue+i._easing((t-i._startTime)/i._duration)*(i._toValue-i._fromValue)),i.__active&&(i._animationFrame=requestAnimationFrame(i.onUpdate))},i._toValue=n.toValue,i._easing=void 0!==n.easing?n.easing:y,i._duration=void 0!==n.duration?n.duration:500,i._delay=void 0!==n.delay?n.delay:0,i}n(i,t);var e=i.prototype;return e.start=function(t,n,i){var e=this;this.__active=!0,this._fromValue=t,this._onUpdate=n,this.__onEnd=i;var o=function(){0===e._duration?(e._onUpdate(e._toValue),e.__debouncedOnEnd({finished:!0})):(e._startTime=Date.now(),e._animationFrame=requestAnimationFrame(e.onUpdate))};this._delay?this._timeout=setTimeout(o,this._delay):o()},e.stop=function(){this.__active=!1,clearTimeout(this._timeout),cancelAnimationFrame(this._animationFrame),this.__debouncedOnEnd({finished:!1})},i}(i),T=function(t,n){return void 0===t||null===t?n:t},M=function(t,n){return{tension:(i=t,3.62*(i-30)+194),friction:function(t){return 3*(t-8)+25}(n)};var i},b=function(t){function i(n){var i;(i=t.call(this)||this).onUpdate=function(){var t=Date.now();t>i._lastTime+64&&(t=i._lastTime+64);var n=(t-i._lastTime)/1e3;i._frameTime+=n;var e=i._friction,o=i._mass,a=i._tension,r=-i._initialVelocity,s=e/(2*Math.sqrt(a*o)),u=Math.sqrt(a/o),_=u*Math.sqrt(1-s*s),c=i._toValue-i._startPosition,l=0,f=0,h=i._frameTime;if(s<1){var d=Math.exp(-s*u*h);l=i._toValue-d*((r+s*u*c)/_*Math.sin(_*h)+c*Math.cos(_*h)),f=s*u*d*(Math.sin(_*h)*(r+s*u*c)/_+c*Math.cos(_*h))-d*(Math.cos(_*h)*(r+s*u*c)-_*c*Math.sin(_*h))}else{var m=Math.exp(-u*h);l=i._toValue-m*(c+(r+u*c)*h),f=m*(r*(h*u-1)+h*c*(u*u))}if(i._lastTime=t,i._lastPosition=l,i._lastVelocity=f,i._onUpdate(l),i.__active){var p=!1;i._overshootClamping&&0!==i._stiffness&&(p=i._startPosition<i._toValue?l>i._toValue:l<i._toValue);var v=Math.abs(f)<=i._restSpeedThreshold,y=!0;if(0!==i._stiffness&&(y=Math.abs(i._toValue-l)<=i._restDisplacementThreshold),p||v&&y)return 0!==i._stiffness&&(i._lastPosition=i._toValue,i._lastVelocity=0,i._onUpdate(i._toValue)),i.__debouncedOnEnd({finished:!0});i._animationFrame=requestAnimationFrame(i.onUpdate)}},i._overshootClamping=T(n.overshootClamping,!1),i._restDisplacementThreshold=T(n.restDisplacementThreshold,1e-4),i._restSpeedThreshold=T(n.restSpeedThreshold,1e-4),i._initialVelocity=T(n.velocity,0),i._lastVelocity=T(n.velocity,0),i._toValue=n.toValue;var e=M(T(n.tension,40),T(n.friction,7));return i._tension=e.tension,i._friction=e.friction,i._mass=T(n.mass,1),i._delay=void 0!==n.delay?n.delay:0,i}n(i,t);var e=i.prototype;return e.start=function(t,n,e,o){if(this.__active=!0,this._startPosition=t,this._lastPosition=this._startPosition,this._onUpdate=n,this.__onEnd=e,this._lastTime=Date.now(),this._frameTime=0,o instanceof i){var a=o.getInternalState();this._lastPosition=a.lastPosition,this._lastVelocity=a.lastVelocity,this._lastTime=a.lastTime}void 0!==this._initialVelocity&&null!==this._initialVelocity&&(this._lastVelocity=this._initialVelocity),this._delay?this._timeout=setTimeout(this.onUpdate,this._delay):this.onUpdate()},e.getInternalState=function(){return{lastPosition:this._lastPosition,lastVelocity:this._lastVelocity,lastTime:this._lastTime}},e.stop=function(){this.__active=!1,clearTimeout(this._timeout),cancelAnimationFrame(this._animationFrame),this.__debouncedOnEnd({finished:!1})},i}(i);t.TimingAnimation=V,t.OscillatorAnimation=b,t.Easing=p,Object.defineProperty(t,"__esModule",{value:!0})}); | ||
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n(t.ReactSpringAddons={})}(this,function(t){"use strict";var n=function(t,n){t.prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n},i=function(){function t(){}var n=t.prototype;return n.start=function(t,n,i,e){},n.stop=function(){},n.__debouncedOnEnd=function(t){var n=this.__onEnd;this.__onEnd=null,n&&n(t)},t}(),e=4,o=.001,r=1e-7,a=10,s=11,u=1/(s-1),_="function"==typeof Float32Array;function c(t,n){return 1-3*n+3*t}function f(t,n){return 3*n-6*t}function l(t){return 3*t}function h(t,n,i){return((c(n,i)*t+f(n,i))*t+l(n))*t}function d(t,n,i){return 3*c(n,i)*t*t+2*f(n,i)*t+l(n)}function m(t,n,i,c){if(!(0<=t&&t<=1&&0<=i&&i<=1))throw new Error("bezier x values must be in [0, 1] range");var f=_?new Float32Array(s):new Array(s);if(t!==n||i!==c)for(var l=0;l<s;++l)f[l]=h(l*u,t,i);function m(n){for(var _=0,c=1,l=s-1;c!==l&&f[c]<=n;++c)_+=u;var m=_+(n-f[--c])/(f[c+1]-f[c])*u,p=d(m,t,i);return p>=o?function(t,n,i,o){for(var r=0;r<e;++r){var a=d(n,i,o);if(0===a)return n;n-=(h(n,i,o)-t)/a}return n}(n,m,t,i):0===p?m:function(t,n,i,e,o){var s,u,_=0;do{(s=h(u=n+(i-n)/2,e,o)-t)>0?i=u:n=u}while(Math.abs(s)>r&&++_<a);return u}(n,_,_+u,t,i)}return function(e){return t===n&&i===c?e:0===e?0:1===e?1:h(m(e),n,c)}}var p=function(){function t(){}return t.step0=function(t){return t>0?1:0},t.step1=function(t){return t>=1?1:0},t.linear=function(t){return t},t.ease=function(t){return v(t)},t.quad=function(t){return t*t},t.cubic=function(t){return t*t*t},t.poly=function(t){return function(n){return Math.pow(n,t)}},t.sin=function(t){return 1-Math.cos(t*Math.PI/2)},t.circle=function(t){return 1-Math.sqrt(1-t*t)},t.exp=function(t){return Math.pow(2,10*(t-1))},t.elastic=function(t){void 0===t&&(t=1);var n=t*Math.PI;return function(t){return 1-Math.pow(Math.cos(t*Math.PI/2),3)*Math.cos(t*n)}},t.back=function(t){return void 0===t&&(t=1.70158),function(n){return n*n*((t+1)*n-t)}},t.bounce=function(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375},t.bezier=function(t,n,i,e){return m(t,n,i,e)},t.in=function(t){return t},t.out=function(t){return function(n){return 1-t(1-n)}},t.inOut=function(t){return function(n){return n<.5?t(2*n)/2:1-t(2*(1-n))/2}},t}(),v=p.bezier(.42,0,1,1),y=p.inOut(p.ease),T=function(t){function i(n){var i;return(i=t.call(this)||this).onUpdate=function(){var t=Date.now();if(t>=i._startTime+i._duration)return i._onUpdate(0===i._duration?i._to:i._fromValue+i._easing(1)*(i._to-i._fromValue)),void i.__debouncedOnEnd({finished:!0});i._onUpdate(i._fromValue+i._easing((t-i._startTime)/i._duration)*(i._to-i._fromValue)),i.__active&&(i._animationFrame=requestAnimationFrame(i.onUpdate))},i._to=n.to,i._easing=void 0!==n.easing?n.easing:y,i._duration=void 0!==n.duration?n.duration:500,i._delay=void 0!==n.delay?n.delay:0,i}n(i,t);var e=i.prototype;return e.start=function(t,n,i){var e=this;this.__active=!0,this._fromValue=t,this._onUpdate=n,this.__onEnd=i;var o=function(){0===e._duration?(e._onUpdate(e._to),e.__debouncedOnEnd({finished:!0})):(e._startTime=Date.now(),e._animationFrame=requestAnimationFrame(e.onUpdate))};this._delay?this._timeout=setTimeout(o,this._delay):o()},e.stop=function(){this.__active=!1,clearTimeout(this._timeout),cancelAnimationFrame(this._animationFrame),this.__debouncedOnEnd({finished:!1})},i}(i),M=function(t,n){return void 0===t||null===t?n:t},b=function(t,n){return{tension:(i=t,3.62*(i-30)+194),friction:function(t){return 3*(t-8)+25}(n)};var i},V=function(t){function i(n){var i;(i=t.call(this)||this).onUpdate=function(){var t=Date.now();t>i._lastTime+64&&(t=i._lastTime+64);var n=(t-i._lastTime)/1e3;i._frameTime+=n;var e=i._friction,o=i._mass,r=i._tension,a=-i._initialVelocity,s=e/(2*Math.sqrt(r*o)),u=Math.sqrt(r/o),_=u*Math.sqrt(1-s*s),c=i._to-i._startPosition,f=0,l=0,h=i._frameTime;if(s<1){var d=Math.exp(-s*u*h);f=i._to-d*((a+s*u*c)/_*Math.sin(_*h)+c*Math.cos(_*h)),l=s*u*d*(Math.sin(_*h)*(a+s*u*c)/_+c*Math.cos(_*h))-d*(Math.cos(_*h)*(a+s*u*c)-_*c*Math.sin(_*h))}else{var m=Math.exp(-u*h);f=i._to-m*(c+(a+u*c)*h),l=m*(a*(h*u-1)+h*c*(u*u))}if(i._lastTime=t,i._lastPosition=f,i._lastVelocity=l,i._onUpdate(f),i.__active){var p=!1;i._overshootClamping&&0!==i._stiffness&&(p=i._startPosition<i._to?f>i._to:f<i._to);var v=Math.abs(l)<=i._restSpeedThreshold,y=!0;if(0!==i._stiffness&&(y=Math.abs(i._to-f)<=i._restDisplacementThreshold),p||v&&y)return 0!==i._stiffness&&(i._lastPosition=i._to,i._lastVelocity=0,i._onUpdate(i._to)),i.__debouncedOnEnd({finished:!0});i._animationFrame=requestAnimationFrame(i.onUpdate)}},i._overshootClamping=M(n.overshootClamping,!1),i._restDisplacementThreshold=M(n.restDisplacementThreshold,1e-4),i._restSpeedThreshold=M(n.restSpeedThreshold,1e-4),i._initialVelocity=M(n.velocity,0),i._lastVelocity=M(n.velocity,0),i._to=n.to;var e=b(M(n.tension,40),M(n.friction,7));return i._tension=e.tension,i._friction=e.friction,i._mass=M(n.mass,1),i._delay=void 0!==n.delay?n.delay:0,i}n(i,t);var e=i.prototype;return e.start=function(t,n,e,o){if(this.__active=!0,this._startPosition=t,this._lastPosition=this._startPosition,this._onUpdate=n,this.__onEnd=e,this._lastTime=Date.now(),this._frameTime=0,o instanceof i){var r=o.getInternalState();this._lastPosition=r.lastPosition,this._lastVelocity=r.lastVelocity,this._lastTime=r.lastTime}void 0!==this._initialVelocity&&null!==this._initialVelocity&&(this._lastVelocity=this._initialVelocity),this._delay?this._timeout=setTimeout(this.onUpdate,this._delay):this.onUpdate()},e.getInternalState=function(){return{lastPosition:this._lastPosition,lastVelocity:this._lastVelocity,lastTime:this._lastTime}},e.stop=function(){this.__active=!1,clearTimeout(this._timeout),cancelAnimationFrame(this._animationFrame),this.__debouncedOnEnd({finished:!1})},i}(i);t.TimingAnimation=T,t.OscillatorAnimation=V,t.Easing=p,Object.defineProperty(t,"__esModule",{value:!0})}); |
@@ -1,1 +0,1 @@ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("react"),require("react-dom"),require("prop-types")):"function"==typeof define&&define.amd?define(["exports","react","react-dom","prop-types"],e):e(t.ReactSpring={},t.React,t.ReactDOM,t.PropTypes)}(this,function(t,e,n,r){"use strict";e=e&&e.hasOwnProperty("default")?e.default:e,n=n&&n.hasOwnProperty("default")?n.default:n,r=r&&r.hasOwnProperty("default")?r.default:r;var i=function(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t};var o=function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable}))),r.forEach(function(e){i(t,e,n[e])})}return t},a="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function s(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function u(t,e){return t(e={exports:{}},e.exports),e.exports}var l=u(function(t){function e(){return t.exports=e=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},e.apply(this,arguments)}t.exports=e});var c=function(t,e){if(null==t)return{};var n,r,i={},o=Object.keys(t);for(r=0;r<o.length;r++)n=o[r],e.indexOf(n)>=0||(i[n]=t[n]);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(r=0;r<a.length;r++)n=a[r],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i};var f=function(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e},p=function(){function t(){}var e=t.prototype;return e.__attach=function(){},e.__detach=function(){},e.__getValue=function(){},e.__getAnimatedValue=function(){return this.__getValue()},e.__addChild=function(t){},e.__removeChild=function(t){},e.__getChildren=function(){return[]},t}(),h=function(t){function e(e,n,r,i,o){var a;return(a=t.call(this)||this)._value=e,a._parent=n,a._animationClass=r,a._animationConfig=i,a._callback=o,a.__attach(),a._hey=1,a}f(e,t);var n=e.prototype;return n.__getValue=function(){return this._parent.__getValue()},n.__attach=function(){this._parent.__addChild(this)},n.__detach=function(){this._parent.__removeChild(this)},n.update=function(){this._value.animate(new this._animationClass(o({},this._animationConfig,{to:this._animationConfig.to.__getValue()})),this._callback)},e}(p),d=function(t){function e(){var e;return(e=t.call(this)||this)._children=[],e}f(e,t);var n=e.prototype;return n.__addChild=function(t){t instanceof h&&(this._tracked=!0),0===this._children.length&&this.__attach(),this._children.push(t)},n.__removeChild=function(t){var e=this._children.indexOf(t);-1!==e?(this._children.splice(e,1),0===this._children.length&&this.__detach()):console.warn("Trying to remove a child that doesn't exist")},n.__getChildren=function(){return this._children},e}(p),m=function(t){function e(e){var n;return n=t.call(this)||this,e=e||{},n._style=e,n}f(e,t);var n=e.prototype;return n.__getValue=function(){var t={};for(var e in this._style){var n=this._style[e];t[e]=n instanceof p?n.__getValue():n}return t},n.__getAnimatedValue=function(){var t={};for(var e in this._style){var n=this._style[e];n instanceof p&&(t[e]=n.__getAnimatedValue())}return t},n.__attach=function(){for(var t in this._style){var e=this._style[t];e instanceof p&&e.__addChild(this)}},n.__detach=function(){for(var t in this._style){var e=this._style[t];e instanceof p&&e.__removeChild(this)}},e}(d),v=function(t){function e(e,n){var r;return r=t.call(this)||this,e.style&&(e=o({},e,{style:new m(e.style)})),r._props=e,r._callback=n,r.__attach(),r}f(e,t);var n=e.prototype;return n.__getValue=function(){var t={};for(var e in this._props){var n=this._props[e];t[e]=n instanceof p?n.__getValue():n}return t},n.__getAnimatedValue=function(){var t={};for(var e in this._props){var n=this._props[e];n instanceof p&&(t[e]=n.__getAnimatedValue())}return t},n.__attach=function(){for(var t in this._props){var e=this._props[t];e instanceof p&&e.__addChild(this)}},n.__detach=function(){for(var t in this._props){var e=this._props[t];e instanceof p&&e.__removeChild(this)}},n.update=function(){this._callback()},e}(p),_=function(){function t(){}return t.create=function(t){return function(){return t.apply(void 0,arguments)}},t}(),y=void 0,g=void 0;function b(t){return function(n){function r(){return n.apply(this,arguments)||this}f(r,n);var i=r.prototype;return i.componentWillUnmount=function(){this._propsAnimated&&this._propsAnimated.__detach()},i.setNativeProps=function(t){!1===g.fn(this.node,t,this)&&this.forceUpdate()},i.componentWillMount=function(){this.attachProps(this.props)},i.attachProps=function(t){var e=this,n=this._propsAnimated;this._propsAnimated=new v(t,function(){e.node&&!1===g.fn(e.node,e._propsAnimated.__getAnimatedValue(),e)&&e.forceUpdate()}),n&&n.__detach()},i.componentWillReceiveProps=function(t){this.attachProps(t)},i.render=function(){var n=this,r=this._propsAnimated.__getValue(),i=r.style,o=c(r,["style"]);return e.createElement(t,l({},o,{style:g.transform(i),ref:function(t){return n.node=t}}))},r}(e.Component)}function w(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+(e-t)*(2/3-n)*6:t}function x(t,e,n){var r=n<.5?n*(1+e):n+e-n*e,i=2*n-r,o=w(i,r,t+1/3),a=w(i,r,t),s=w(i,r,t-1/3);return Math.round(255*o)<<24|Math.round(255*a)<<16|Math.round(255*s)<<8}var k="[-+]?\\d*\\.?\\d+",P=k+"%";function A(){return"\\(\\s*("+(t=arguments,Array.prototype.slice.call(t,0)).join(")\\s*,\\s*(")+")\\s*\\)";var t}var O={rgb:new RegExp("rgb"+A(k,k,k)),rgba:new RegExp("rgba"+A(k,k,k,k)),hsl:new RegExp("hsl"+A(k,P,P)),hsla:new RegExp("hsla"+A(k,P,P,k)),hex3:/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex4:/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#([0-9a-fA-F]{6})$/,hex8:/^#([0-9a-fA-F]{8})$/};function V(t){var e=parseInt(t,10);return e<0?0:e>255?255:e}function E(t){return(parseFloat(t)%360+360)%360/360}function C(t){var e=parseFloat(t);return e<0?0:e>1?255:Math.round(255*e)}function S(t){var e=parseFloat(t,10);return e<0?0:e>100?1:e/100}var T={transparent:0,aliceblue:4042850303,antiquewhite:4209760255,aqua:16777215,aquamarine:2147472639,azure:4043309055,beige:4126530815,bisque:4293182719,black:255,blanchedalmond:4293643775,blue:65535,blueviolet:2318131967,brown:2771004159,burlywood:3736635391,burntsienna:3934150143,cadetblue:1604231423,chartreuse:2147418367,chocolate:3530104575,coral:4286533887,cornflowerblue:1687547391,cornsilk:4294499583,crimson:3692313855,cyan:16777215,darkblue:35839,darkcyan:9145343,darkgoldenrod:3095792639,darkgray:2846468607,darkgreen:6553855,darkgrey:2846468607,darkkhaki:3182914559,darkmagenta:2332068863,darkolivegreen:1433087999,darkorange:4287365375,darkorchid:2570243327,darkred:2332033279,darksalmon:3918953215,darkseagreen:2411499519,darkslateblue:1211993087,darkslategray:793726975,darkslategrey:793726975,darkturquoise:13554175,darkviolet:2483082239,deeppink:4279538687,deepskyblue:12582911,dimgray:1768516095,dimgrey:1768516095,dodgerblue:512819199,firebrick:2988581631,floralwhite:4294635775,forestgreen:579543807,fuchsia:4278255615,gainsboro:3705462015,ghostwhite:4177068031,gold:4292280575,goldenrod:3668254975,gray:2155905279,green:8388863,greenyellow:2919182335,grey:2155905279,honeydew:4043305215,hotpink:4285117695,indianred:3445382399,indigo:1258324735,ivory:4294963455,khaki:4041641215,lavender:3873897215,lavenderblush:4293981695,lawngreen:2096890111,lemonchiffon:4294626815,lightblue:2916673279,lightcoral:4034953471,lightcyan:3774873599,lightgoldenrodyellow:4210742015,lightgray:3553874943,lightgreen:2431553791,lightgrey:3553874943,lightpink:4290167295,lightsalmon:4288707327,lightseagreen:548580095,lightskyblue:2278488831,lightslategray:2005441023,lightslategrey:2005441023,lightsteelblue:2965692159,lightyellow:4294959359,lime:16711935,limegreen:852308735,linen:4210091775,magenta:4278255615,maroon:2147483903,mediumaquamarine:1724754687,mediumblue:52735,mediumorchid:3126187007,mediumpurple:2473647103,mediumseagreen:1018393087,mediumslateblue:2070474495,mediumspringgreen:16423679,mediumturquoise:1221709055,mediumvioletred:3340076543,midnightblue:421097727,mintcream:4127193855,mistyrose:4293190143,moccasin:4293178879,navajowhite:4292783615,navy:33023,oldlace:4260751103,olive:2155872511,olivedrab:1804477439,orange:4289003775,orangered:4282712319,orchid:3664828159,palegoldenrod:4008225535,palegreen:2566625535,paleturquoise:2951671551,palevioletred:3681588223,papayawhip:4293907967,peachpuff:4292524543,peru:3448061951,pink:4290825215,plum:3718307327,powderblue:2967529215,purple:2147516671,rebeccapurple:1714657791,red:4278190335,rosybrown:3163525119,royalblue:1097458175,saddlebrown:2336560127,salmon:4202722047,sandybrown:4104413439,seagreen:780883967,seashell:4294307583,sienna:2689740287,silver:3233857791,skyblue:2278484991,slateblue:1784335871,slategray:1887473919,slategrey:1887473919,snow:4294638335,springgreen:16744447,steelblue:1182971135,tan:3535047935,teal:8421631,thistle:3636451583,tomato:4284696575,turquoise:1088475391,violet:4001558271,wheat:4125012991,white:4294967295,whitesmoke:4126537215,yellow:4294902015,yellowgreen:2597139199},R=function(t){return t},j=function(){function t(){}return t.create=function(t){if("function"==typeof t)return function(){return t.apply(void 0,arguments)};if(t.output&&"string"==typeof t.output[0])return function(t){var e=t.output,n=(e=e.map(function(t){return t.replace(W,F)}).map(function(t){return t.replace(q,F)}))[0].match(M).map(function(){return[]});e.forEach(function(t){t.match(M).forEach(function(t,e){return n[e].push(+t)})});var r=e[0].match(M).map(function(e,r){return j.create(o({},t,{output:n[r]}))});return function(t){var n=0;return e[0].replace(M,function(){return r[n++](t)}).replace(/rgba\(([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+)\)/gi,function(t,e,n,r,i){return"rgba("+Math.round(e)+", "+Math.round(n)+", "+Math.round(r)+", "+i+")"})}}(t);var e=t.output,n=t.range,r=t.easing||R,i="extend";void 0!==t.extrapolateLeft?i=t.extrapolateLeft:void 0!==t.extrapolate&&(i=t.extrapolate);var a="extend";return void 0!==t.extrapolateRight?a=t.extrapolateRight:void 0!==t.extrapolate&&(a=t.extrapolate),function(t){var o=function(t,e){for(var n=1;n<e.length-1&&!(e[n]>=t);++n);return n-1}(t,n);return function(t,e,n,r,i,o,a,s){var u=t;if(u<e){if("identity"===a)return u;"clamp"===a&&(u=e)}if(u>n){if("identity"===s)return u;"clamp"===s&&(u=n)}if(r===i)return r;if(e===n)return t<=e?r:i;e===-1/0?u=-u:n===1/0?u-=e:u=(u-e)/(n-e);u=o(u),r===-1/0?u=-u:i===1/0?u+=r:u=u*(i-r)+r;return u}(t,n[o],n[o+1],e[o],e[o+1],r,i,a)}},t}();function F(t){var e,n,r="number"==typeof(e=t)?e>>>0===e&&e>=0&&e<=4294967295?e:null:(n=O.hex6.exec(e))?parseInt(n[1]+"ff",16)>>>0:T.hasOwnProperty(e)?T[e]:(n=O.rgb.exec(e))?(V(n[1])<<24|V(n[2])<<16|V(n[3])<<8|255)>>>0:(n=O.rgba.exec(e))?(V(n[1])<<24|V(n[2])<<16|V(n[3])<<8|C(n[4]))>>>0:(n=O.hex3.exec(e))?parseInt(n[1]+n[1]+n[2]+n[2]+n[3]+n[3]+"ff",16)>>>0:(n=O.hex8.exec(e))?parseInt(n[1],16)>>>0:(n=O.hex4.exec(e))?parseInt(n[1]+n[1]+n[2]+n[2]+n[3]+n[3]+n[4]+n[4],16)>>>0:(n=O.hsl.exec(e))?(255|x(E(n[1]),S(n[2]),S(n[3])))>>>0:(n=O.hsla.exec(e))?(x(E(n[1]),S(n[2]),S(n[3]))|C(n[4]))>>>0:null;return null===r?t:"rgba("+((4278190080&(r=r||0))>>>24)+", "+((16711680&r)>>>16)+", "+((65280&r)>>>8)+", "+(255&r)/255+")"}var M=/[0-9\.-]+/g,W=/(#[\d\w]+|\w+\((?:\d+%?(?:,\s)*){3}(?:\d*\.?\d+)?\))/,q=new RegExp("("+Object.keys(T).join("|")+")","g");var U=function(t){function e(e,n){var r;return(r=t.call(this)||this)._parents=Array.isArray(e)?e:[e],r._interpolation=_.create(n),r}f(e,t);var n=e.prototype;return n.__getValue=function(){return this._interpolation.apply(this,this._parents.map(function(t){return t.__getValue()}))},n.__attach=function(){for(var t=0;t<this._parents.length;++t)this._parents[t]instanceof p&&this._parents[t].__addChild(this)},n.__detach=function(){for(var t=0;t<this._parents.length;++t)this._parents[t]instanceof p&&this._parents[t].__removeChild(this)},n.interpolate=function(t){return new e(this,t)},e}(d),z=0;var D=function(t){function e(e){var n;return(n=t.call(this)||this)._value=e,n._animation=null,n._animatedStyles=new Set,n._listeners={},n}f(e,t);var n=e.prototype;return n.__detach=function(){this.stopAnimation()},n.__getValue=function(){return this._value},n._flush=function(){!function t(e,n){"function"==typeof e.update?n.add(e):e.__getChildren().forEach(function(e){return t(e,n)})}(this,this._animatedStyles),this._animatedStyles.forEach(function(t){return t.update()})},n._updateValue=function(t){for(var e in this._value=t,this._flush(),this._listeners)this._listeners[e]({value:this.__getValue()})},n.setValue=function(t){this._animation&&(this._animation.stop(),this._animation=null),this._animatedStyles.clear(),this._updateValue(t)},n.stopAnimation=function(t){this.stopTracking(),this._animation&&this._animation.stop(),this._animation=null,t&&t(this.__getValue())},n.interpolate=function(t){return new U(this,t)},n.animate=function(t,e){var n=this,r=this._animation;this._animation&&this._animation.stop(),this._animation=t,this._animatedStyles.clear(),t.start(this._value,function(t){return n._updateValue(t)},function(t){n._animation=null,e&&e(t)},r)},n.addListener=function(t){var e=String(z++);return this._listeners[e]=t,e},n.removeListener=function(t){delete this._listeners[t]},n.removeAllListeners=function(){this._listeners={}},n.stopTracking=function(){this._tracking&&this._tracking.__detach(),this._tracking=null},n.track=function(t){this.stopTracking(),this._tracking=t},e}(d),I=function(t){return"auto"===t},N=function(t,e){var n,r=e[0],i=e[1];return o({},t,((n={})[r]=new D(i),n))},L=function(t,e){return function(n,r){var i,a=r[0],s=r[1];return o({},n,((i={})[a]="auto"===s?"height"===a?e:t:s,i))}};var B={animationIterationCount:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0};var G=["Webkit","Ms","Moz","O"];function H(t,e,n){return null==e||"boolean"==typeof e||""===e?"":n||"number"!=typeof e||0===e||B.hasOwnProperty(t)&&B[t]?(""+e).trim():e+"px"}Object.keys(B).forEach(function(t){G.forEach(function(e){B[function(t,e){return t+e.charAt(0).toUpperCase()+e.substring(1)}(e,t)]=B[t]})}),_=j,y=function(t,r){var i=r.native,a=r.children,s=r.from,u=r.to;return Object.values(s).concat(Object.values(u)).some(I)?new Promise(function(l){var c=t.getForwardProps(r),f=Object.entries(o({},s,u)),p=document.createElement("div");p.style.cssText="position:static;visibility:hidden;",document.body.appendChild(p);var h=i?f.reduce(N,c):o({},s,u,c);n.render(e.createElement("div",{ref:function(t){if(t){var e=t.clientHeight,n=t.clientWidth;document.body.removeChild(p),l(o({},r,{from:Object.entries(s).reduce(L(n,e),s),to:Object.entries(u).reduce(L(n,e),u)}))}}},a(h)),p)}):r},function(t,e){g={fn:t,transform:e}}(function(t,e){if(t.setNativeProps)t.setNativeProps(e);else{if(!t.nodeType||void 0===t.setAttribute)return!1;!function(t,e){var n=t.style;for(var r in e)if(e.hasOwnProperty(r)){var i=0===r.indexOf("--"),o=H(r,e[r],i);"float"===r&&(r="cssFloat"),i?n.setProperty(r,o):n[r]=o}}(t,e.style),function(t,e){var n;for(var r in e)"style"!==r&&(n=e[r],t.getAttribute(r)&&t.setAttribute(r,n))}(t,e)}},function(t){return t});var K=["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","marquee","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"].reduce(function(t,e){var n;return o({},t,((n={})[e]=b(e),n))},{}),$=function(){function t(){}var e=t.prototype;return e.start=function(t,e,n,r){},e.stop=function(){},e.__debouncedOnEnd=function(t){var e=this.__onEnd;this.__onEnd=null,e&&e(t)},t}(),X=function(t,e){return void 0===t||null===t?e:t},Y=function(t,e){return{tension:(n=t,3.62*(n-30)+194),friction:function(t){return 3*(t-8)+25}(e)};var n},J=function(t){function e(e){var n;(n=t.call(this)||this).onUpdate=function(){var t=n._lastPosition,e=n._lastVelocity,r=n._lastPosition,i=n._lastVelocity,o=Date.now();o>n._lastTime+64&&(o=n._lastTime+64);for(var a=Math.floor((o-n._lastTime)/1),s=0;s<a;++s){var u=e,l=n._tension*(n._to-r)-n._friction*i,c=(r=t+.001*u/2,i=e+.001*l/2),f=n._tension*(n._to-r)-n._friction*i;r=t+.001*c/2;var p=i=e+.001*f/2,h=n._tension*(n._to-r)-n._friction*i;r=t+.001*p/2;var d=i=e+.001*h/2,m=n._tension*(n._to-r)-n._friction*i;r=t+.001*p/2,i=e+.001*h/2,t+=.001*((u+2*(c+p)+d)/6),e+=.001*((l+2*(f+h)+m)/6)}if(n._lastTime=o,n._lastPosition=t,n._lastVelocity=e,n._onUpdate(t),n.__active){var v=!1;n._overshootClamping&&0!==n._tension&&(v=n._startPosition<n._to?t>n._to:t<n._to);var _=Math.abs(e)<=n._restSpeedThreshold,y=!0;if(0!==n._tension&&(y=Math.abs(n._to-t)<=n._restDisplacementThreshold),v||_&&y)return 0!==n._tension&&n._onUpdate(n._to),void n.__debouncedOnEnd({finished:!0});n._animationFrame=requestAnimationFrame(n.onUpdate)}},n._overshootClamping=X(e.overshootClamping,!1),n._restDisplacementThreshold=X(e.restDisplacementThreshold,1e-4),n._restSpeedThreshold=X(e.restSpeedThreshold,1e-4),n._initialVelocity=e.velocity,n._lastVelocity=X(e.velocity,0),n._to=e.to;var r=Y(X(e.tension,40),X(e.friction,7));return n._tension=r.tension,n._friction=r.friction,n._delay=void 0!==e.delay?e.delay:0,n}f(e,t);var n=e.prototype;return n.start=function(t,n,r,i){if(this.__active=!0,this._startPosition=t,this._lastPosition=this._startPosition,this._onUpdate=n,this.__onEnd=r,this._lastTime=Date.now(),i instanceof e){var o=i.getInternalState();this._lastPosition=o.lastPosition,this._lastVelocity=o.lastVelocity,this._lastTime=o.lastTime}void 0!==this._initialVelocity&&null!==this._initialVelocity&&(this._lastVelocity=this._initialVelocity),this._delay?this._timeout=setTimeout(this.onUpdate,this._delay):this.onUpdate()},n.getInternalState=function(){return{lastPosition:this._lastPosition,lastVelocity:this._lastVelocity,lastTime:this._lastTime}},n.stop=function(){this.__active=!1,clearTimeout(this._timeout),cancelAnimationFrame(this._animationFrame),this.__debouncedOnEnd({finished:!1})},e}($),Q=function(t){function e(e){var n;return(n=t.call(this)||this)._values=e.map(function(t){return new D(t)}),n}f(e,t);var n=e.prototype;return n.setValue=function(t){var e=this;t.forEach(function(t,n){return e._values[n].setValue(t)})},n.__getValue=function(){return this._values.map(function(t){return t.__getValue()})},n.stopAnimation=function(t){this._values.forEach(function(t){return t.stopAnimation()}),t&&t(this.__getValue())},n.__attach=function(){for(var t=0;t<this._values.length;++t)this._values[t]instanceof p&&this._values[t].__addChild(this)},n.__detach=function(){for(var t=0;t<this._values.length;++t)this._values[t]instanceof p&&this._values[t].__removeChild(this)},e}(d);function Z(t,e,n){return void 0===n&&(n=J),function(t,e,n,r){var i,o,a,s,u,l,c=e.tension,f=e.friction,p=e.to;return t instanceof Q?(i=t._values.map(function(t,e){return n(t,{tension:c,friction:f,to:p[e]},r)}),a=0,s={},u=!((o={stopTogether:!1})&&!1===o.stopTogether),l={start:function(t){if(a===i.length)return t&&t({finished:!0});i.forEach(function(e,n){var r=function(e){if(s[n]=!0,++a===i.length)return a=0,t&&t(e);!e.finished&&u&&l.stop()};e?e.start(r):r({finished:!0})})},stop:function(){i.forEach(function(t,e){!s[e]&&t.stop(),s[e]=!0})}}):null}(t,e,Z,n)||{start:function(r){var i=t,o=e;i.stopTracking(),e.to instanceof p?i.track(new h(i,e.to,n,o,r)):i.animate(new n(o),r)},stop:function(){t.stopAnimation()}}}var tt=function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t},et={default:{tension:170,friction:26},gentle:{tension:120,friction:14},wobbly:{tension:180,friction:12},stiff:{tension:210,friction:20},slow:{tension:280,friction:60}},nt=function(t){function e(){for(var e,n,r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];return e=n=t.call.apply(t,[this].concat(i))||this,n.state={props:void 0},n.animations={},n.callback=function(){n.props.onFrame&&n.props.onFrame(n.animatedProps.__getValue()),!n.props.native&&n.forceUpdate()},e||tt(n)}f(e,t);var n=e.prototype;return n.componentWillUnmount=function(){this.stop()},n.componentWillMount=function(){this.updatePropsAsync(this.props)},n.componentWillReceiveProps=function(t){this.updatePropsAsync(t)},n.updatePropsAsync=function(t){var e=this;if(t.inject&&(t=t.inject(this,t)).then)return t.then(function(t){return e.updateProps(t,!0)});this.updateProps(t)},n.updateProps=function(t,e){var n=this;void 0===e&&(e=!1);var r=t.impl,i=t.from,a=t.to,s=t.config,u=t.attach,l=t.immediate,c=t.hold,f=t.reset,p=(t.onFrame,t.onRest),h=Object.entries(o({},i,a));this.interpolators={},this.animations=h.reduce(function(t,e,a){var h,d=e[0],m=e[1],v=!1===f&&n.animations[d]||(n.animations[d]={}),_="number"==typeof m,y=!_&&Array.isArray(m),g=void 0!==i[d]?i[d]:m,b=g instanceof D,w=_||y?m:1;if(_&&u){var x=u(n),k=x&&x.animations[d];k&&(w=k.animation)}if(b)v.animation=v.interpolation=g;else if(_||"auto"===w)v.animation=v.interpolation=v.animation||new D(g);else if(y)v.animation=v.interpolation=v.animation||new Q(g);else{var P=v.interpolation&&v.interpolation._interpolation(v.animation._value);v.animation=new D(0),v.interpolation=v.animation.interpolate({range:[0,1],output:[void 0!==P?P:g,m]})}return!l||!0!==l&&-1===l.indexOf(d)||v.animation.setValue(w),v.stopped=!1,v.start=function(t){var e=function(){if(n.animations[d].stopped=!0,Object.values(n.animations).every(function(t){return t.stopped})){var e=o({},n.props.from,n.props.to);p&&p(e),t&&t(e)}};if(c&&(!0===c||-1!==c.indexOf(d)))return e();Z(v.animation,o({to:w},s),r).start(function(t){return t.finished&&e()})},v.stop=function(){v.stopped=!0,v.animation.stopAnimation()},n.interpolators[d]=v.interpolation,o({},t,((h={})[d]=v,h))},{});var d=this.animatedProps;this.animatedProps=new v(this.interpolators,this.callback),d&&d.__detach(),e&&this.forceUpdate(),this.start()},n.start=function(){var t=this;return new Promise(function(e){return t.getAnimations().forEach(function(t){return t.start(e)})})},n.stop=function(){this.getAnimations().forEach(function(t){return t.stop()})},n.getAnimations=function(){return Object.values(this.animations)},n.getValues=function(){return this.animatedProps?this.animatedProps.__getValue():{}},n.getAnimatedValues=function(){return this.props.native?this.interpolators:this.getValues()},n.getForwardProps=function(t){void 0===t&&(t=this.props);var e=t;e.to,e.from,e.config,e.native,e.onRest,e.onFrame,e.children,e.render,e.reset,e.immediate,e.impl,e.inject,e.hold;return c(e,["to","from","config","native","onRest","onFrame","children","render","reset","immediate","impl","inject","hold"])},n.render=function(){var t=this.props,e=t.children,n=t.render,r=this.getAnimatedValues();if(r&&Object.keys(r).length){var i=o({},r,this.getForwardProps());return n?n(o({},i,{children:e})):e(i)}return null},e}(e.PureComponent);nt.defaultProps={from:{},to:{},config:et.default,native:!1,immediate:!1,reset:!1,impl:J,inject:y};var rt=function(){return null},it=function(t,e){return"function"==typeof t?t(e):t},ot=function(t){function n(e){var n;n=t.call(this)||this;var r=e.children,i=e.render,o=e.keys,a=e.items,s=e.from,u=void 0===s?{}:s,l=e.enter,c=void 0===l?{}:l,f=(e.leave,e.update);return r=i||r||rt,"function"==typeof o&&(o=a.map(o)),Array.isArray(r)||(r=[r],o=o?[o]:r),n.state={transitionKeys:o,transitions:r.map(function(t,e){var n=a?a[e]:o[e];return{children:t,key:o[e],item:n,to:it(c,n),from:it(u,n),update:it(f,n)}})},n}f(n,t);var r=n.prototype;return r.componentWillReceiveProps=function(t){var e=this,n=this.state,r=n.transitions,i=n.transitionKeys,o=t.children,a=t.render,s=t.keys,u=t.items,l=t.from,c=void 0===l?{}:l,f=t.enter,p=void 0===f?{}:f,h=t.leave,d=void 0===h?{}:h,m=t.update;o=a||o||rt,"function"==typeof s&&(s=u.map(s)),Array.isArray(o)||(o=[o],s=s?[s]:o);var v=new Set(s),_=new Set(i),y=s.filter(function(t){return!_.has(t)}),g=i.filter(function(t){return!v.has(t)}),b=s.filter(function(t){return _.has(t)});r=r.map(function(t){if(void 0===t.destroy){var e=s.indexOf(t.key),n=o[e];n&&(t.children=n),m&&-1!==b.indexOf(t.key)&&(t.to=it(m,u?u[e]:s[e])||t.to)}return t}),y.length&&y.forEach(function(t){var e=s.indexOf(t),n=o[e],i=u?u[e]:s[e],a={children:n,key:s[e],item:i,to:it(p,i),from:it(c,i)};r=r.slice(0,e).concat([a],r.slice(e))}),g.length&&g.forEach(function(t){var n=r.find(function(e){return e.key===t});if(n){var i={destroy:!0,children:n.children,key:n.key,to:it(d,n.item),from:it(c,n.item),onRest:function(){return e.setState(function(t){return{transitions:t.transitions.filter(function(t){return t!==i})}})}};r=r.map(function(t){return t===n?i:t})}}),i=r.filter(function(t){return void 0===t.destroy}).map(function(t){return t.key});var w=s.map(function(t){return r.find(function(e){return e.key===t})});r.forEach(function(t,e){t.destroy&&!w.find(function(e){return e.key===t.key})&&(w=w.slice(0,e).concat([t],w.slice(e)))}),this.setState({transitions:w,transitionKeys:i})},r.getValues=function(){},r.render=function(){var t=this,n=this.props,r=n.render,i=(n.from,n.enter,n.leave,n.native),a=void 0!==i&&i,s=n.config,u=void 0===s?et.default:s,f=(n.keys,n.items,n.onFrame),p=n.onRest,h=c(n,["render","from","enter","leave","native","config","keys","items","onFrame","onRest"]),d=o({native:a,config:u},h);return this.state.transitions.map(function(n,i){var o=n.key,a=n.item,s=n.children,u=c(n,["key","item","children"]);return e.createElement(nt,l({key:o,onRest:p&&function(t){return p(a,t)},onFrame:f&&function(t){return f(a,t)}},u,d,{render:r&&s,children:r?t.props.children:s}))})},n}(e.PureComponent),at=function(t){function n(){return t.apply(this,arguments)||this}f(n,t);var r=n.prototype;return r.getValues=function(){return this.instance&&this.instance.getValues()},r.render=function(){var t=this,n=this.props,r=n.children,i=n.render,a=n.from,s=void 0===a?{}:a,u=n.to,f=void 0===u?{}:u,p=n.native,h=void 0!==p&&p,d=n.config,m=void 0===d?et.default:d,v=n.keys,_=n.onRest,y=c(n,["children","render","from","to","native","config","keys","onRest"]),g=new Set,b=o({},y,{native:h,config:m,from:s,to:f});return(i||r).map(function(n,o){return e.createElement(nt,l({ref:function(e){return 0===o&&(t.instance=e)},onRest:0===o?_:null,key:v[o]},b,{attach:function(t){return function(t,e){return g.add(e),0===t?void 0:Array.from(g)[t-1]}(o,t)},render:i&&n,children:i?r:n}))})},n}(e.PureComponent),st="__global_unique_id__",ut=function(){return a[st]=(a[st]||0)+1};function lt(t){return function(){return t}}var ct=function(){};ct.thatReturns=lt,ct.thatReturnsFalse=lt(!1),ct.thatReturnsTrue=lt(!0),ct.thatReturnsNull=lt(null),ct.thatReturnsThis=function(){return this},ct.thatReturnsArgument=function(t){return t};var ft=ct;if("production"!==process.env.NODE_ENV){ft=function(t,e){if(void 0===e)throw new Error("`warning(condition, format, ...args)` requires a warning message argument");if(0!==e.indexOf("Failed Composite propType: ")&&!t){for(var n=arguments.length,r=Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];(function(t){for(var e=arguments.length,n=Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];var i=0,o="Warning: "+t.replace(/%s/g,function(){return n[i++]});"undefined"!=typeof console&&console.error(o);try{throw new Error(o)}catch(t){}}).apply(void 0,[e].concat(r))}}}var pt=ft,ht=u(function(t,n){n.__esModule=!0;s(e);var i=s(r),o=s(ut),a=s(pt);function s(t){return t&&t.__esModule?t:{default:t}}function u(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function c(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var f=1073741823;n.default=function(t,n){var r,s,p="__create-react-context-"+(0,o.default)()+"__",h=function(t){function e(){var n,r,i,o;u(this,e);for(var a=arguments.length,s=Array(a),c=0;c<a;c++)s[c]=arguments[c];return n=r=l(this,t.call.apply(t,[this].concat(s))),r.emitter=(i=r.props.value,o=[],{on:function(t){o.push(t)},off:function(t){o=o.filter(function(e){return e!==t})},get:function(){return i},set:function(t,e){i=t,o.forEach(function(t){return t(i,e)})}}),l(r,n)}return c(e,t),e.prototype.getChildContext=function(){var t;return(t={})[p]=this.emitter,t},e.prototype.componentWillReceiveProps=function(t){if(this.props.value!==t.value){var e=this.props.value,r=t.value,i=void 0;((o=e)===(s=r)?0!==o||1/o==1/s:o!=o&&s!=s)?i=0:(i="function"==typeof n?n(e,r):f,"production"!==process.env.NODE_ENV&&(0,a.default)((i&f)===i,"calculateChangedBits: Expected the return value to be a 31-bit integer. Instead received: %s",i),0!=(i|=0)&&this.emitter.set(t.value,i))}var o,s},e.prototype.render=function(){return this.props.children},e}(e.Component);h.childContextTypes=((r={})[p]=i.default.object.isRequired,r);var d=function(e){function n(){var t,r;u(this,n);for(var i=arguments.length,o=Array(i),a=0;a<i;a++)o[a]=arguments[a];return t=r=l(this,e.call.apply(e,[this].concat(o))),r.state={value:r.getValue()},r.onUpdate=function(t,e){0!=((0|r.observedBits)&e)&&r.setState({value:r.getValue()})},l(r,t)}return c(n,e),n.prototype.componentWillReceiveProps=function(t){var e=t.observedBits;this.observedBits=void 0===e||null===e?f:e},n.prototype.componentDidMount=function(){this.context[p]&&this.context[p].on(this.onUpdate);var t=this.props.observedBits;this.observedBits=void 0===t||null===t?f:t},n.prototype.componentWillUnmount=function(){this.context[p]&&this.context[p].off(this.onUpdate)},n.prototype.getValue=function(){return this.context[p]?this.context[p].get():t},n.prototype.render=function(){return(t=this.props.children,Array.isArray(t)?t[0]:t)(this.state.value);var t},n}(e.Component);return d.contextTypes=((s={})[p]=i.default.object,s),{Provider:h,Consumer:d}},t.exports=n.default});s(ht);var dt=s(u(function(t,n){n.__esModule=!0;var r=o(e),i=o(ht);function o(t){return t&&t.__esModule?t:{default:t}}n.default=r.default.createContext||i.default,t.exports=n.default})),mt=b("div"),vt=dt(null),_t=vt.Provider,yt=vt.Consumer;function gt(t){return t?"scrollLeft":"scrollTop"}var bt=function(t){function n(){return t.apply(this,arguments)||this}f(n,t);var r=n.prototype;return r.componentDidMount=function(){var t=this.parent;t&&(t.layers=t.layers.concat(this),t.update())},r.componentWillUnmount=function(){var t=this,e=this.parent;e&&(e.layers=e.layers.filter(function(e){return e!==t}),e.update())},r.setPosition=function(t,e,n){void 0===n&&(n=!1);var r=this.parent.props,i=r.config,a=r.impl,s=Math.floor(this.props.offset)*t,u=t*this.props.offset+s*this.props.speed,l=parseFloat(-e*this.props.speed+u);n?this.animatedTranslate.setValue(l):Z(this.animatedTranslate,o({to:l},i),a).start()},r.setHeight=function(t,e){void 0===e&&(e=!1);var n=this.parent.props,r=n.config,i=n.impl,a=parseFloat(t*this.props.factor);e?this.animatedSpace.setValue(a):Z(this.animatedSpace,o({to:a},r),i).start()},r.initialize=function(){var t=this.props,e=this.parent,n=Math.floor(t.offset)*e.space,r=e.space*t.offset+n*t.speed,i=parseFloat(-e.current*t.speed+r);this.animatedTranslate=new D(i),this.animatedSpace=new D(e.space*t.factor)},r.renderLayer=function(){var t,n=this.props,r=n.style,i=n.children,a=(n.offset,n.speed,n.factor,n.className),s=c(n,["style","children","offset","speed","factor","className"]),u=this.parent.props.horizontal,f=this.animatedTranslate.interpolate({range:[0,1],output:u?["translate3d(0px,0px,0px)","translate3d(1px,0,0)"]:["translate3d(0px,0px,0px)","translate3d(0,1px,0)"]});return e.createElement(mt,l({},s,{className:a,style:o((t={position:"absolute",backgroundSize:"auto",backgroundRepeat:"no-repeat",willChange:"transform"},t[u?"height":"width"]="100%",t[u?"width":"height"]=this.animatedSpace,t.WebkitTransform=f,t.MsTransform=f,t.transform=f,t),r)}),i)},r.render=function(){var t=this;return e.createElement(yt,null,function(e){return e&&!t.parent&&(t.parent=e,t.initialize()),t.renderLayer()})},n}(e.PureComponent);bt.defaultProps={factor:1,offset:0,speed:0};var wt=function(t){function n(){for(var e,n,r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];return e=n=t.call.apply(t,[this].concat(i))||this,n.state={ready:!1},n.layers=[],n.space=0,n.current=0,n.offset=0,n.busy=!1,n.moveItems=function(){n.layers.forEach(function(t){return t.setPosition(n.space,n.current)}),n.busy=!1},n.scrollerRaf=function(){return requestAnimationFrame(n.moveItems)},n.onScroll=function(t){var e=n.props.horizontal;n.busy||(n.busy=!0,n.scrollerRaf(),n.current=t.target[gt(e)])},n.update=function(){var t=n.props,e=t.scrolling,r=t.horizontal,i=gt(r);n.container&&(n.space=n.container[r?"clientWidth":"clientHeight"],e?n.current=n.container[i]:n.container[i]=n.current=n.offset*n.space,n.content&&(n.content.style[r?"width":"height"]=n.space*n.props.pages+"px"),n.layers.forEach(function(t){t.setHeight(n.space,!0),t.setPosition(n.space,n.current,!0)}))},n.updateRaf=function(){requestAnimationFrame(n.update),setTimeout(n.update,150)},n.scrollStop=function(t){return n.animatedScroll&&n.animatedScroll.stopAnimation()},e||tt(n)}f(n,t);var r=n.prototype;return r.scrollTo=function(t){var e=this.props,n=e.horizontal,r=e.config,i=e.impl,a=gt(n);this.scrollStop(),this.offset=t;var s=this.container;this.animatedScroll=new D(s[a]),this.animatedScroll.addListener(function(t){var e=t.value;return s[a]=e}),Z(this.animatedScroll,o({to:t*this.space},r),i).start()},r.componentDidMount=function(){window.addEventListener("resize",this.updateRaf,!1),this.update(),this.setState({ready:!0})},r.componentWillUnmount=function(){window.removeEventListener("resize",this.updateRaf,!1)},r.componentDidUpdate=function(){this.update()},r.render=function(){var t,n=this,r=this.props,i=r.style,a=r.innerStyle,s=r.pages,u=r.className,l=r.scrolling,c=r.children,f=r.horizontal,p=l?"scroll":"hidden";return e.createElement("div",{ref:function(t){return n.container=t},onScroll:this.onScroll,onWheel:l?this.scrollStop:null,onTouchStart:l?this.scrollStop:null,style:o({position:"absolute",width:"100%",height:"100%",overflow:p,overflowY:f?"hidden":p,overflowX:f?p:"hidden",WebkitOverflowScrolling:"touch",WebkitTransform:"translate(0px,0px)",MsTransform:"translate(0px,0px)",transform:"translate3d(0px,0px,0px)"},i),className:u},this.state.ready&&e.createElement("div",{ref:function(t){return n.content=t},style:o((t={position:"absolute"},t[f?"height":"width"]="100%",t.WebkitTransform="translate(0px,0px)",t.MsTransform="translate(0px,0px)",t.transform="translate3d(0px,0px,0px)",t.overflow="hidden",t[f?"width":"height"]=this.space*s,t),a)},e.createElement(_t,{value:this},c)))},n}(e.PureComponent);wt.Layer=bt,wt.defaultProps={config:et.slow,scrolling:!0,horizontal:!1,impl:J};var xt=function(t){function n(){for(var e,n,r=arguments.length,i=new Array(r),a=0;a<r;a++)i[a]=arguments[a];return e=n=t.call.apply(t,[this].concat(i))||this,n.state={primitive:void 0,props:{},resolve:function(){return null}},n.next=function(t,e){return new Promise(function(r){var i=n.instance&&n.instance.getValues(),a="function"==typeof e.from?e.from:o({},n.state.props.from,i,e.from);n.setState(function(n){return{primitive:t,props:o({},e,{from:a}),resolve:r}})})},e||tt(n)}f(n,t);var r=n.prototype;return r.componentDidMount=function(){this.props.script&&this.props.script(this.next)},r.render=function(){var t=this,n=this.state,r=n.primitive,i=n.props,o=n.resolve,a=this.props,s=(a.script,c(a,["script"]));return r?e.createElement(r,l({ref:function(e){return t.instance=e}},s,i,{onRest:o})):null},n}(e.Component);t.Spring=nt,t.Keyframes=xt,t.Transition=ot,t.Trail=at,t.Parallax=wt,t.ParallaxLayer=bt,t.Animation=$,t.SpringAnimation=J,t.AnimatedValue=D,t.config=et,t.animated=K,t.controller=Z,t.interpolate=function(t,e){return new U(t,e)},t.createAnimatedComponent=b,Object.defineProperty(t,"__esModule",{value:!0})}); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("react"),require("react-dom"),require("prop-types")):"function"==typeof define&&define.amd?define(["exports","react","react-dom","prop-types"],e):e(t.ReactSpring={},t.React,t.ReactDOM,t.PropTypes)}(this,function(t,e,n,r){"use strict";e=e&&e.hasOwnProperty("default")?e.default:e,n=n&&n.hasOwnProperty("default")?n.default:n,r=r&&r.hasOwnProperty("default")?r.default:r;var i=function(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t};var o=function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable}))),r.forEach(function(e){i(t,e,n[e])})}return t},a="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function s(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function u(t,e){return t(e={exports:{}},e.exports),e.exports}var l=u(function(t){function e(){return t.exports=e=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},e.apply(this,arguments)}t.exports=e});var c=function(t,e){if(null==t)return{};var n,r,i={},o=Object.keys(t);for(r=0;r<o.length;r++)n=o[r],e.indexOf(n)>=0||(i[n]=t[n]);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(r=0;r<a.length;r++)n=a[r],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i};var f=function(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e},p=function(){function t(){}var e=t.prototype;return e.__attach=function(){},e.__detach=function(){},e.__getValue=function(){},e.__getAnimatedValue=function(){return this.__getValue()},e.__addChild=function(t){},e.__removeChild=function(t){},e.__getChildren=function(){return[]},t}(),h=function(t){function e(e,n,r,i,o){var a;return(a=t.call(this)||this)._value=e,a._parent=n,a._animationClass=r,a._animationConfig=i,a._callback=o,a.__attach(),a._hey=1,a}f(e,t);var n=e.prototype;return n.__getValue=function(){return this._parent.__getValue()},n.__attach=function(){this._parent.__addChild(this)},n.__detach=function(){this._parent.__removeChild(this)},n.update=function(){this._value.animate(new this._animationClass(o({},this._animationConfig,{to:this._animationConfig.to.__getValue()})),this._callback)},e}(p),d=function(t){function e(){var e;return(e=t.call(this)||this)._children=[],e}f(e,t);var n=e.prototype;return n.__addChild=function(t){t instanceof h&&(this._tracked=!0),0===this._children.length&&this.__attach(),this._children.push(t)},n.__removeChild=function(t){var e=this._children.indexOf(t);-1!==e?(this._children.splice(e,1),0===this._children.length&&this.__detach()):console.warn("Trying to remove a child that doesn't exist")},n.__getChildren=function(){return this._children},e}(p),m=function(t){function e(e){var n;return n=t.call(this)||this,e=e||{},n._style=e,n}f(e,t);var n=e.prototype;return n.__getValue=function(){var t={};for(var e in this._style){var n=this._style[e];t[e]=n instanceof p?n.__getValue():n}return t},n.__getAnimatedValue=function(){var t={};for(var e in this._style){var n=this._style[e];n instanceof p&&(t[e]=n.__getAnimatedValue())}return t},n.__attach=function(){for(var t in this._style){var e=this._style[t];e instanceof p&&e.__addChild(this)}},n.__detach=function(){for(var t in this._style){var e=this._style[t];e instanceof p&&e.__removeChild(this)}},e}(d),v=function(t){function e(e,n){var r;return r=t.call(this)||this,e.style&&(e=o({},e,{style:new m(e.style)})),r._props=e,r._callback=n,r.__attach(),r}f(e,t);var n=e.prototype;return n.__getValue=function(){var t={};for(var e in this._props){var n=this._props[e];t[e]=n instanceof p?n.__getValue():n}return t},n.__getAnimatedValue=function(){var t={};for(var e in this._props){var n=this._props[e];n instanceof p&&(t[e]=n.__getAnimatedValue())}return t},n.__attach=function(){for(var t in this._props){var e=this._props[t];e instanceof p&&e.__addChild(this)}},n.__detach=function(){for(var t in this._props){var e=this._props[t];e instanceof p&&e.__removeChild(this)}},n.update=function(){this._callback()},e}(p),_=function(){function t(){}return t.create=function(t){return function(){return t.apply(void 0,arguments)}},t}(),y=void 0,g=void 0;function b(t){return function(n){function r(){return n.apply(this,arguments)||this}f(r,n);var i=r.prototype;return i.componentWillUnmount=function(){this._propsAnimated&&this._propsAnimated.__detach()},i.setNativeProps=function(t){!1===g.fn(this.node,t,this)&&this.forceUpdate()},i.componentWillMount=function(){this.attachProps(this.props)},i.attachProps=function(t){var e=this,n=this._propsAnimated;this._propsAnimated=new v(t,function(){e.node&&!1===g.fn(e.node,e._propsAnimated.__getAnimatedValue(),e)&&e.forceUpdate()}),n&&n.__detach()},i.componentWillReceiveProps=function(t){this.attachProps(t)},i.render=function(){var n=this,r=this._propsAnimated.__getValue(),i=r.style,o=c(r,["style"]);return e.createElement(t,l({},o,{style:g.transform(i),ref:function(t){return n.node=t}}))},r}(e.Component)}function w(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+(e-t)*(2/3-n)*6:t}function x(t,e,n){var r=n<.5?n*(1+e):n+e-n*e,i=2*n-r,o=w(i,r,t+1/3),a=w(i,r,t),s=w(i,r,t-1/3);return Math.round(255*o)<<24|Math.round(255*a)<<16|Math.round(255*s)<<8}var k="[-+]?\\d*\\.?\\d+",P=k+"%";function A(){return"\\(\\s*("+(t=arguments,Array.prototype.slice.call(t,0)).join(")\\s*,\\s*(")+")\\s*\\)";var t}var O={rgb:new RegExp("rgb"+A(k,k,k)),rgba:new RegExp("rgba"+A(k,k,k,k)),hsl:new RegExp("hsl"+A(k,P,P)),hsla:new RegExp("hsla"+A(k,P,P,k)),hex3:/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex4:/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#([0-9a-fA-F]{6})$/,hex8:/^#([0-9a-fA-F]{8})$/};function V(t){var e=parseInt(t,10);return e<0?0:e>255?255:e}function E(t){return(parseFloat(t)%360+360)%360/360}function S(t){var e=parseFloat(t);return e<0?0:e>1?255:Math.round(255*e)}function C(t){var e=parseFloat(t,10);return e<0?0:e>100?1:e/100}var T={transparent:0,aliceblue:4042850303,antiquewhite:4209760255,aqua:16777215,aquamarine:2147472639,azure:4043309055,beige:4126530815,bisque:4293182719,black:255,blanchedalmond:4293643775,blue:65535,blueviolet:2318131967,brown:2771004159,burlywood:3736635391,burntsienna:3934150143,cadetblue:1604231423,chartreuse:2147418367,chocolate:3530104575,coral:4286533887,cornflowerblue:1687547391,cornsilk:4294499583,crimson:3692313855,cyan:16777215,darkblue:35839,darkcyan:9145343,darkgoldenrod:3095792639,darkgray:2846468607,darkgreen:6553855,darkgrey:2846468607,darkkhaki:3182914559,darkmagenta:2332068863,darkolivegreen:1433087999,darkorange:4287365375,darkorchid:2570243327,darkred:2332033279,darksalmon:3918953215,darkseagreen:2411499519,darkslateblue:1211993087,darkslategray:793726975,darkslategrey:793726975,darkturquoise:13554175,darkviolet:2483082239,deeppink:4279538687,deepskyblue:12582911,dimgray:1768516095,dimgrey:1768516095,dodgerblue:512819199,firebrick:2988581631,floralwhite:4294635775,forestgreen:579543807,fuchsia:4278255615,gainsboro:3705462015,ghostwhite:4177068031,gold:4292280575,goldenrod:3668254975,gray:2155905279,green:8388863,greenyellow:2919182335,grey:2155905279,honeydew:4043305215,hotpink:4285117695,indianred:3445382399,indigo:1258324735,ivory:4294963455,khaki:4041641215,lavender:3873897215,lavenderblush:4293981695,lawngreen:2096890111,lemonchiffon:4294626815,lightblue:2916673279,lightcoral:4034953471,lightcyan:3774873599,lightgoldenrodyellow:4210742015,lightgray:3553874943,lightgreen:2431553791,lightgrey:3553874943,lightpink:4290167295,lightsalmon:4288707327,lightseagreen:548580095,lightskyblue:2278488831,lightslategray:2005441023,lightslategrey:2005441023,lightsteelblue:2965692159,lightyellow:4294959359,lime:16711935,limegreen:852308735,linen:4210091775,magenta:4278255615,maroon:2147483903,mediumaquamarine:1724754687,mediumblue:52735,mediumorchid:3126187007,mediumpurple:2473647103,mediumseagreen:1018393087,mediumslateblue:2070474495,mediumspringgreen:16423679,mediumturquoise:1221709055,mediumvioletred:3340076543,midnightblue:421097727,mintcream:4127193855,mistyrose:4293190143,moccasin:4293178879,navajowhite:4292783615,navy:33023,oldlace:4260751103,olive:2155872511,olivedrab:1804477439,orange:4289003775,orangered:4282712319,orchid:3664828159,palegoldenrod:4008225535,palegreen:2566625535,paleturquoise:2951671551,palevioletred:3681588223,papayawhip:4293907967,peachpuff:4292524543,peru:3448061951,pink:4290825215,plum:3718307327,powderblue:2967529215,purple:2147516671,rebeccapurple:1714657791,red:4278190335,rosybrown:3163525119,royalblue:1097458175,saddlebrown:2336560127,salmon:4202722047,sandybrown:4104413439,seagreen:780883967,seashell:4294307583,sienna:2689740287,silver:3233857791,skyblue:2278484991,slateblue:1784335871,slategray:1887473919,slategrey:1887473919,snow:4294638335,springgreen:16744447,steelblue:1182971135,tan:3535047935,teal:8421631,thistle:3636451583,tomato:4284696575,turquoise:1088475391,violet:4001558271,wheat:4125012991,white:4294967295,whitesmoke:4126537215,yellow:4294902015,yellowgreen:2597139199},j=function(t){return t},R=function(){function t(){}return t.create=function(t){if("function"==typeof t)return function(){return t.apply(void 0,arguments)};if(t.output&&"string"==typeof t.output[0])return function(t){var e=t.output,n=(e=e.map(function(t){return t.replace(W,F)}).map(function(t){return t.replace(U,F)}))[0].match(M).map(function(){return[]});e.forEach(function(t){t.match(M).forEach(function(t,e){return n[e].push(+t)})});var r=e[0].match(M).map(function(e,r){return R.create(o({},t,{output:n[r]}))});return function(t){var n=0;return e[0].replace(M,function(){return r[n++](t)}).replace(/rgba\(([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+)\)/gi,function(t,e,n,r,i){return"rgba("+Math.round(e)+", "+Math.round(n)+", "+Math.round(r)+", "+i+")"})}}(t);var e=t.output,n=t.range,r=t.easing||j,i="extend";void 0!==t.extrapolateLeft?i=t.extrapolateLeft:void 0!==t.extrapolate&&(i=t.extrapolate);var a="extend";return void 0!==t.extrapolateRight?a=t.extrapolateRight:void 0!==t.extrapolate&&(a=t.extrapolate),function(t){var o=function(t,e){for(var n=1;n<e.length-1&&!(e[n]>=t);++n);return n-1}(t,n);return function(t,e,n,r,i,o,a,s){var u=t;if(u<e){if("identity"===a)return u;"clamp"===a&&(u=e)}if(u>n){if("identity"===s)return u;"clamp"===s&&(u=n)}if(r===i)return r;if(e===n)return t<=e?r:i;e===-1/0?u=-u:n===1/0?u-=e:u=(u-e)/(n-e);u=o(u),r===-1/0?u=-u:i===1/0?u+=r:u=u*(i-r)+r;return u}(t,n[o],n[o+1],e[o],e[o+1],r,i,a)}},t}();function F(t){var e,n,r="number"==typeof(e=t)?e>>>0===e&&e>=0&&e<=4294967295?e:null:(n=O.hex6.exec(e))?parseInt(n[1]+"ff",16)>>>0:T.hasOwnProperty(e)?T[e]:(n=O.rgb.exec(e))?(V(n[1])<<24|V(n[2])<<16|V(n[3])<<8|255)>>>0:(n=O.rgba.exec(e))?(V(n[1])<<24|V(n[2])<<16|V(n[3])<<8|S(n[4]))>>>0:(n=O.hex3.exec(e))?parseInt(n[1]+n[1]+n[2]+n[2]+n[3]+n[3]+"ff",16)>>>0:(n=O.hex8.exec(e))?parseInt(n[1],16)>>>0:(n=O.hex4.exec(e))?parseInt(n[1]+n[1]+n[2]+n[2]+n[3]+n[3]+n[4]+n[4],16)>>>0:(n=O.hsl.exec(e))?(255|x(E(n[1]),C(n[2]),C(n[3])))>>>0:(n=O.hsla.exec(e))?(x(E(n[1]),C(n[2]),C(n[3]))|S(n[4]))>>>0:null;return null===r?t:"rgba("+((4278190080&(r=r||0))>>>24)+", "+((16711680&r)>>>16)+", "+((65280&r)>>>8)+", "+(255&r)/255+")"}var M=/[0-9\.-]+/g,W=/(#[\d\w]+|\w+\((?:\d+%?(?:,\s)*){3}(?:\d*\.?\d+)?\))/,U=new RegExp("("+Object.keys(T).join("|")+")","g");var q=function(t){function e(e,n){var r;return(r=t.call(this)||this)._parents=Array.isArray(e)?e:[e],r._interpolation=_.create(n),r}f(e,t);var n=e.prototype;return n.__getValue=function(){return this._interpolation.apply(this,this._parents.map(function(t){return t.__getValue()}))},n.__attach=function(){for(var t=0;t<this._parents.length;++t)this._parents[t]instanceof p&&this._parents[t].__addChild(this)},n.__detach=function(){for(var t=0;t<this._parents.length;++t)this._parents[t]instanceof p&&this._parents[t].__removeChild(this)},n.interpolate=function(t){return new e(this,t)},e}(d),D=0;var z=function(t){function e(e){var n;return(n=t.call(this)||this)._value=e,n._animation=null,n._animatedStyles=new Set,n._listeners={},n}f(e,t);var n=e.prototype;return n.__detach=function(){this.stopAnimation()},n.__getValue=function(){return this._value},n._update=function(){!function t(e,n){"function"==typeof e.update?n.add(e):e.__getChildren().forEach(function(e){return t(e,n)})}(this,this._animatedStyles)},n._flush=function(){0===this._animatedStyles.size&&this._update(),this._animatedStyles.forEach(function(t){return t.update()})},n._updateValue=function(t){for(var e in this._value=t,this._flush(),this._listeners)this._listeners[e]({value:this.__getValue()})},n.setValue=function(t){this._animation&&(this._animation.stop(),this._animation=null),this._animatedStyles.clear(),this._updateValue(t)},n.stopAnimation=function(t){this.stopTracking(),this._animation&&this._animation.stop(),this._animation=null,t&&t(this.__getValue())},n.interpolate=function(t){return new q(this,t)},n.animate=function(t,e){var n=this,r=this._animation;this._animation&&this._animation.stop(),this._animation=t,this._animatedStyles.clear(),t.start(this._value,function(t){return n._updateValue(t)},function(t){n._animation=null,e&&e(t)},r)},n.addListener=function(t){var e=String(D++);return this._listeners[e]=t,e},n.removeListener=function(t){delete this._listeners[t]},n.removeAllListeners=function(){this._listeners={}},n.stopTracking=function(){this._tracking&&this._tracking.__detach(),this._tracking=null},n.track=function(t){this.stopTracking(),this._tracking=t},e}(d),I=function(t){return"auto"===t},N=function(t,e){var n,r=e[0],i=e[1];return o({},t,((n={})[r]=new z(i),n))},L=function(t,e){return function(n,r){var i,a=r[0],s=r[1];return o({},n,((i={})[a]="auto"===s?"height"===a?e:t:s,i))}};var B={animationIterationCount:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0};var G=["Webkit","Ms","Moz","O"];function H(t,e,n){return null==e||"boolean"==typeof e||""===e?"":n||"number"!=typeof e||0===e||B.hasOwnProperty(t)&&B[t]?(""+e).trim():e+"px"}Object.keys(B).forEach(function(t){G.forEach(function(e){B[function(t,e){return t+e.charAt(0).toUpperCase()+e.substring(1)}(e,t)]=B[t]})}),_=R,y=function(t,r){var i=r.native,a=r.children,s=r.from,u=r.to;if(Object.values(s).concat(Object.values(u)).some(I)){var l=t.getForwardProps(r),c=Object.entries(o({},s,u)),f=document.createElement("div");f.style.cssText="position:static;visibility:hidden;",document.body.appendChild(f);var p=i?c.reduce(N,l):o({},s,u,l);return n.createPortal(e.createElement("div",{ref:function(e){if(e){var n=e.clientHeight,i=e.clientWidth;document.body.removeChild(f),requestAnimationFrame(function(){return t.updateProps(o({},r,{from:Object.entries(s).reduce(L(i,n),s),to:Object.entries(u).reduce(L(i,n),u)}),!0)})}}},a(p)),f)}},function(t,e){g={fn:t,transform:e}}(function(t,e){if(t.setNativeProps)t.setNativeProps(e);else{if(!t.nodeType||void 0===t.setAttribute)return!1;!function(t,e){var n=t.style;for(var r in e)if(e.hasOwnProperty(r)){var i=0===r.indexOf("--"),o=H(r,e[r],i);"float"===r&&(r="cssFloat"),i?n.setProperty(r,o):n[r]=o}}(t,e.style),function(t,e){var n;for(var r in e)"style"!==r&&(n=e[r],t.getAttribute(r)&&t.setAttribute(r,n))}(t,e)}},function(t){return t});var K=["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","marquee","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"].reduce(function(t,e){var n;return o({},t,((n={})[e]=b(e),n))},{}),$=function(){function t(){}var e=t.prototype;return e.start=function(t,e,n,r){},e.stop=function(){},e.__debouncedOnEnd=function(t){var e=this.__onEnd;this.__onEnd=null,e&&e(t)},t}(),X=function(t,e){return void 0===t||null===t?e:t},Y=function(t,e){return{tension:(n=t,3.62*(n-30)+194),friction:function(t){return 3*(t-8)+25}(e)};var n},J=function(t){function e(e){var n;(n=t.call(this)||this).onUpdate=function(){var t=n._lastPosition,e=n._lastVelocity,r=n._lastPosition,i=n._lastVelocity,o=Date.now();o>n._lastTime+64&&(o=n._lastTime+64);for(var a=Math.floor((o-n._lastTime)/1),s=0;s<a;++s){var u=e,l=n._tension*(n._to-r)-n._friction*i,c=(r=t+.001*u/2,i=e+.001*l/2),f=n._tension*(n._to-r)-n._friction*i;r=t+.001*c/2;var p=i=e+.001*f/2,h=n._tension*(n._to-r)-n._friction*i;r=t+.001*p/2;var d=i=e+.001*h/2,m=n._tension*(n._to-r)-n._friction*i;r=t+.001*p/2,i=e+.001*h/2,t+=.001*((u+2*(c+p)+d)/6),e+=.001*((l+2*(f+h)+m)/6)}if(n._lastTime=o,n._lastPosition=t,n._lastVelocity=e,n._onUpdate(t),n.__active){var v=!1;n._overshootClamping&&0!==n._tension&&(v=n._startPosition<n._to?t>n._to:t<n._to);var _=Math.abs(e)<=n._restSpeedThreshold,y=!0;if(0!==n._tension&&(y=Math.abs(n._to-t)<=n._restDisplacementThreshold),v||_&&y)return 0!==n._tension&&n._onUpdate(n._to),void n.__debouncedOnEnd({finished:!0});n._animationFrame=requestAnimationFrame(n.onUpdate)}},n._overshootClamping=X(e.overshootClamping,!1),n._restDisplacementThreshold=X(e.restDisplacementThreshold,1e-4),n._restSpeedThreshold=X(e.restSpeedThreshold,1e-4),n._initialVelocity=e.velocity,n._lastVelocity=X(e.velocity,0),n._to=e.to;var r=Y(X(e.tension,40),X(e.friction,7));return n._tension=r.tension,n._friction=r.friction,n._delay=void 0!==e.delay?e.delay:0,n}f(e,t);var n=e.prototype;return n.start=function(t,n,r,i){if(this.__active=!0,this._startPosition=t,this._lastPosition=this._startPosition,this._onUpdate=n,this.__onEnd=r,this._lastTime=Date.now(),i instanceof e){var o=i.getInternalState();this._lastPosition=o.lastPosition,this._lastVelocity=o.lastVelocity,this._lastTime=o.lastTime}void 0!==this._initialVelocity&&null!==this._initialVelocity&&(this._lastVelocity=this._initialVelocity),this._delay?this._timeout=setTimeout(this.onUpdate,this._delay):this.onUpdate()},n.getInternalState=function(){return{lastPosition:this._lastPosition,lastVelocity:this._lastVelocity,lastTime:this._lastTime}},n.stop=function(){this.__active=!1,clearTimeout(this._timeout),cancelAnimationFrame(this._animationFrame),this.__debouncedOnEnd({finished:!1})},e}($),Q=function(t){function e(e){var n;return(n=t.call(this)||this)._values=e.map(function(t){return new z(t)}),n}f(e,t);var n=e.prototype;return n.setValue=function(t){var e=this;t.forEach(function(t,n){return e._values[n].setValue(t)})},n.__getValue=function(){return this._values.map(function(t){return t.__getValue()})},n.stopAnimation=function(t){this._values.forEach(function(t){return t.stopAnimation()}),t&&t(this.__getValue())},n.__attach=function(){for(var t=0;t<this._values.length;++t)this._values[t]instanceof p&&this._values[t].__addChild(this)},n.__detach=function(){for(var t=0;t<this._values.length;++t)this._values[t]instanceof p&&this._values[t].__removeChild(this)},e}(d);function Z(t,e,n){return void 0===n&&(n=J),function(t,e,n,r){var i,o,a,s,u,l,c=e.tension,f=e.friction,p=e.to;return t instanceof Q?(i=t._values.map(function(t,e){return n(t,{tension:c,friction:f,to:p[e]},r)}),a=0,s={},u=!((o={stopTogether:!1})&&!1===o.stopTogether),l={start:function(t){if(a===i.length)return t&&t({finished:!0});i.forEach(function(e,n){var r=function(e){if(s[n]=!0,++a===i.length)return a=0,t&&t(e);!e.finished&&u&&l.stop()};e?e.start(r):r({finished:!0})})},stop:function(){i.forEach(function(t,e){!s[e]&&t.stop(),s[e]=!0})}}):null}(t,e,Z,n)||{start:function(r){var i=t,o=e;i.stopTracking(),e.to instanceof p?i.track(new h(i,e.to,n,o,r)):i.animate(new n(o),r)},stop:function(){t.stopAnimation()}}}var tt=function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t},et={default:{tension:170,friction:26},gentle:{tension:120,friction:14},wobbly:{tension:180,friction:12},stiff:{tension:210,friction:20},slow:{tension:280,friction:60}},nt=function(t){function e(){for(var e,n,r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];return e=n=t.call.apply(t,[this].concat(i))||this,n.state={props:void 0},n.animations={},n.callback=function(){n.props.onFrame&&n.props.onFrame(n.animatedProps.__getValue()),!n.props.native&&n.forceUpdate()},e||tt(n)}f(e,t);var n=e.prototype;return n.componentWillUnmount=function(){this.stop()},n.componentWillMount=function(){this.updatePropsAsync(this.props)},n.componentWillReceiveProps=function(t){this.updatePropsAsync(t)},n.updatePropsAsync=function(t){t.inject&&(this.inject=t.inject(this,t),this.inject)||this.updateProps(t)},n.updateProps=function(t,e){var n=this;void 0===e&&(e=!1);var r=t.impl,i=t.from,a=t.to,s=t.config,u=t.attach,l=t.immediate,c=t.hold,f=t.reset,p=(t.onFrame,t.onRest),h=Object.entries(o({},i,a));this.interpolators={},this.animations=h.reduce(function(t,e,a){var h,d=e[0],m=e[1],v=!1===f&&n.animations[d]||(n.animations[d]={}),_="number"==typeof m,y=!_&&Array.isArray(m),g=void 0!==i[d]?i[d]:m,b=g instanceof z,w=_||y?m:1;if(_&&u){var x=u(n),k=x&&x.animations[d];k&&(w=k.animation)}if(b)v.animation=v.interpolation=g;else if(_||"auto"===w)v.animation=v.interpolation=v.animation||new z(g);else if(y)v.animation=v.interpolation=v.animation||new Q(g);else{var P=v.interpolation&&v.interpolation._interpolation(v.animation._value);v.animation=new z(0),v.interpolation=v.animation.interpolate({range:[0,1],output:[void 0!==P?P:g,m]})}return!l||!0!==l&&-1===l.indexOf(d)||v.animation.setValue(w),v.stopped=!1,v.start=function(t){var e=function(){if(n.animations[d].stopped=!0,Object.values(n.animations).every(function(t){return t.stopped})){var e=o({},n.props.from,n.props.to);p&&p(e),t&&t(e)}};if(c&&(!0===c||-1!==c.indexOf(d)))return e();Z(v.animation,o({to:w},s),r).start(function(t){return t.finished&&e()})},v.stop=function(){v.stopped=!0,v.animation.stopAnimation()},n.interpolators[d]=v.interpolation,o({},t,((h={})[d]=v,h))},{});var d=this.animatedProps;this.animatedProps=new v(this.interpolators,this.callback),d&&d.__detach(),this.updateToken=!0,e&&this.forceUpdate()},n.start=function(){var t=this;return new Promise(function(e){return t.getAnimations().forEach(function(t){return t.start(e)})})},n.stop=function(){this.getAnimations().forEach(function(t){return t.stop()})},n.flush=function(){this.getAnimations().forEach(function(t){var e=t.interpolation;return e._update&&e._update()})},n.getAnimations=function(){return Object.values(this.animations)},n.getValues=function(){return this.animatedProps?this.animatedProps.__getValue():{}},n.getAnimatedValues=function(){return this.props.native?this.interpolators:this.getValues()},n.getForwardProps=function(t){void 0===t&&(t=this.props);var e=t;e.to,e.from,e.config,e.native,e.onRest,e.onFrame,e.children,e.render,e.reset,e.immediate,e.impl,e.inject,e.hold;return c(e,["to","from","config","native","onRest","onFrame","children","render","reset","immediate","impl","inject","hold"])},n.componentDidUpdate=function(){this.updateToken&&(this.updateToken=!1,this.start())},n.componentDidMount=function(){this.start()},n.render=function(){if(this.inject){var t=this.inject;return this.inject=void 0,t}var e=this.props,n=e.children,r=e.render,i=this.getAnimatedValues();if(i&&Object.keys(i).length){var a=o({},i,this.getForwardProps());return r?r(o({},a,{children:n})):n(a)}return null},e}(e.PureComponent);nt.defaultProps={from:{},to:{},config:et.default,native:!1,immediate:!1,reset:!1,impl:J,inject:y};var rt=function(){return null},it=function(t,e){return"function"==typeof t?t(e):t},ot=function(t){function n(e){var n;n=t.call(this)||this;var r=e.children,i=e.render,o=e.keys,a=e.items,s=e.from,u=void 0===s?{}:s,l=e.enter,c=void 0===l?{}:l,f=(e.leave,e.update);return r=i||r||rt,"function"==typeof o&&(o=a.map(o)),Array.isArray(r)||(r=[r],o=o?[o]:r),n.state={transitionKeys:o,transitions:r.map(function(t,e){var n=a?a[e]:o[e];return{children:t,key:o[e],item:n,to:it(c,n),from:it(u,n),update:it(f,n)}})},n}f(n,t);var r=n.prototype;return r.componentWillReceiveProps=function(t){var e=this,n=this.state,r=n.transitions,i=n.transitionKeys,o=t.children,a=t.render,s=t.keys,u=t.items,l=t.from,c=void 0===l?{}:l,f=t.enter,p=void 0===f?{}:f,h=t.leave,d=void 0===h?{}:h,m=t.update;o=a||o||rt,"function"==typeof s&&(s=u.map(s)),Array.isArray(o)||(o=[o],s=s?[s]:o);var v=new Set(s),_=new Set(i),y=s.filter(function(t){return!_.has(t)}),g=i.filter(function(t){return!v.has(t)}),b=s.filter(function(t){return _.has(t)});r=r.map(function(t){if(void 0===t.destroy){var e=s.indexOf(t.key),n=o[e];n&&(t.children=n),m&&-1!==b.indexOf(t.key)&&(t.to=it(m,u?u[e]:s[e])||t.to)}return t}),y.length&&y.forEach(function(t){var e=s.indexOf(t),n=o[e],i=u?u[e]:s[e],a={children:n,key:s[e],item:i,to:it(p,i),from:it(c,i)};r=r.slice(0,e).concat([a],r.slice(e))}),g.length&&g.forEach(function(t){var n=r.find(function(e){return e.key===t});if(n){var i={destroy:!0,children:n.children,key:n.key,to:it(d,n.item),from:it(c,n.item),onRest:function(){return e.setState(function(t){return{transitions:t.transitions.filter(function(t){return t!==i})}})}};r=r.map(function(t){return t===n?i:t})}}),i=r.filter(function(t){return void 0===t.destroy}).map(function(t){return t.key});var w=s.map(function(t){return r.find(function(e){return e.key===t})});r.forEach(function(t,e){t.destroy&&!w.find(function(e){return e.key===t.key})&&(w=w.slice(0,e).concat([t],w.slice(e)))}),this.setState({transitions:w,transitionKeys:i})},r.getValues=function(){},r.render=function(){var t=this,n=this.props,r=n.render,i=(n.from,n.enter,n.leave,n.native),a=void 0!==i&&i,s=n.config,u=void 0===s?et.default:s,f=(n.keys,n.items,n.onFrame),p=n.onRest,h=c(n,["render","from","enter","leave","native","config","keys","items","onFrame","onRest"]),d=o({native:a,config:u},h);return this.state.transitions.map(function(n,i){var o=n.key,a=n.item,s=n.children,u=c(n,["key","item","children"]);return e.createElement(nt,l({key:o,onRest:p&&function(t){return p(a,t)},onFrame:f&&function(t){return f(a,t)}},u,d,{render:r&&s,children:r?t.props.children:s}))})},n}(e.PureComponent),at=function(t){function n(){return t.apply(this,arguments)||this}f(n,t);var r=n.prototype;return r.getValues=function(){return this.instance&&this.instance.getValues()},r.componentDidMount=function(){this.instance&&this.instance.flush()},r.componentDidUpdate=function(){this.instance&&this.instance.flush()},r.render=function(){var t=this,n=this.props,r=n.children,i=n.render,a=n.from,s=void 0===a?{}:a,u=n.to,f=void 0===u?{}:u,p=n.native,h=void 0!==p&&p,d=n.config,m=void 0===d?et.default:d,v=n.keys,_=n.onRest,y=c(n,["children","render","from","to","native","config","keys","onRest"]),g=new Set,b=o({},y,{native:h,config:m,from:s,to:f});return(i||r).map(function(n,o){return e.createElement(nt,l({ref:function(e){return 0===o&&(t.instance=e)},onRest:0===o?_:null,key:v[o]},b,{attach:function(t){return function(t,e){return g.add(e),0===t?void 0:Array.from(g)[t-1]}(o,t)},render:i&&n,children:i?r:n}))})},n}(e.PureComponent),st="__global_unique_id__",ut=function(){return a[st]=(a[st]||0)+1};function lt(t){return function(){return t}}var ct=function(){};ct.thatReturns=lt,ct.thatReturnsFalse=lt(!1),ct.thatReturnsTrue=lt(!0),ct.thatReturnsNull=lt(null),ct.thatReturnsThis=function(){return this},ct.thatReturnsArgument=function(t){return t};var ft=ct;if("production"!==process.env.NODE_ENV){ft=function(t,e){if(void 0===e)throw new Error("`warning(condition, format, ...args)` requires a warning message argument");if(0!==e.indexOf("Failed Composite propType: ")&&!t){for(var n=arguments.length,r=Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];(function(t){for(var e=arguments.length,n=Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];var i=0,o="Warning: "+t.replace(/%s/g,function(){return n[i++]});"undefined"!=typeof console&&console.error(o);try{throw new Error(o)}catch(t){}}).apply(void 0,[e].concat(r))}}}var pt=ft,ht=u(function(t,n){n.__esModule=!0;s(e);var i=s(r),o=s(ut),a=s(pt);function s(t){return t&&t.__esModule?t:{default:t}}function u(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function c(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var f=1073741823;n.default=function(t,n){var r,s,p="__create-react-context-"+(0,o.default)()+"__",h=function(t){function e(){var n,r,i,o;u(this,e);for(var a=arguments.length,s=Array(a),c=0;c<a;c++)s[c]=arguments[c];return n=r=l(this,t.call.apply(t,[this].concat(s))),r.emitter=(i=r.props.value,o=[],{on:function(t){o.push(t)},off:function(t){o=o.filter(function(e){return e!==t})},get:function(){return i},set:function(t,e){i=t,o.forEach(function(t){return t(i,e)})}}),l(r,n)}return c(e,t),e.prototype.getChildContext=function(){var t;return(t={})[p]=this.emitter,t},e.prototype.componentWillReceiveProps=function(t){if(this.props.value!==t.value){var e=this.props.value,r=t.value,i=void 0;((o=e)===(s=r)?0!==o||1/o==1/s:o!=o&&s!=s)?i=0:(i="function"==typeof n?n(e,r):f,"production"!==process.env.NODE_ENV&&(0,a.default)((i&f)===i,"calculateChangedBits: Expected the return value to be a 31-bit integer. Instead received: %s",i),0!=(i|=0)&&this.emitter.set(t.value,i))}var o,s},e.prototype.render=function(){return this.props.children},e}(e.Component);h.childContextTypes=((r={})[p]=i.default.object.isRequired,r);var d=function(e){function n(){var t,r;u(this,n);for(var i=arguments.length,o=Array(i),a=0;a<i;a++)o[a]=arguments[a];return t=r=l(this,e.call.apply(e,[this].concat(o))),r.state={value:r.getValue()},r.onUpdate=function(t,e){0!=((0|r.observedBits)&e)&&r.setState({value:r.getValue()})},l(r,t)}return c(n,e),n.prototype.componentWillReceiveProps=function(t){var e=t.observedBits;this.observedBits=void 0===e||null===e?f:e},n.prototype.componentDidMount=function(){this.context[p]&&this.context[p].on(this.onUpdate);var t=this.props.observedBits;this.observedBits=void 0===t||null===t?f:t},n.prototype.componentWillUnmount=function(){this.context[p]&&this.context[p].off(this.onUpdate)},n.prototype.getValue=function(){return this.context[p]?this.context[p].get():t},n.prototype.render=function(){return(t=this.props.children,Array.isArray(t)?t[0]:t)(this.state.value);var t},n}(e.Component);return d.contextTypes=((s={})[p]=i.default.object,s),{Provider:h,Consumer:d}},t.exports=n.default});s(ht);var dt=s(u(function(t,n){n.__esModule=!0;var r=o(e),i=o(ht);function o(t){return t&&t.__esModule?t:{default:t}}n.default=r.default.createContext||i.default,t.exports=n.default})),mt=b("div"),vt=dt(null),_t=vt.Provider,yt=vt.Consumer;function gt(t){return t?"scrollLeft":"scrollTop"}var bt=function(t){function n(){return t.apply(this,arguments)||this}f(n,t);var r=n.prototype;return r.componentDidMount=function(){var t=this.parent;t&&(t.layers=t.layers.concat(this),t.update())},r.componentWillUnmount=function(){var t=this,e=this.parent;e&&(e.layers=e.layers.filter(function(e){return e!==t}),e.update())},r.setPosition=function(t,e,n){void 0===n&&(n=!1);var r=this.parent.props,i=r.config,a=r.impl,s=Math.floor(this.props.offset)*t,u=t*this.props.offset+s*this.props.speed,l=parseFloat(-e*this.props.speed+u);n?this.animatedTranslate.setValue(l):Z(this.animatedTranslate,o({to:l},i),a).start()},r.setHeight=function(t,e){void 0===e&&(e=!1);var n=this.parent.props,r=n.config,i=n.impl,a=parseFloat(t*this.props.factor);e?this.animatedSpace.setValue(a):Z(this.animatedSpace,o({to:a},r),i).start()},r.initialize=function(){var t=this.props,e=this.parent,n=Math.floor(t.offset)*e.space,r=e.space*t.offset+n*t.speed,i=parseFloat(-e.current*t.speed+r);this.animatedTranslate=new z(i),this.animatedSpace=new z(e.space*t.factor)},r.renderLayer=function(){var t,n=this.props,r=n.style,i=n.children,a=(n.offset,n.speed,n.factor,n.className),s=c(n,["style","children","offset","speed","factor","className"]),u=this.parent.props.horizontal,f=this.animatedTranslate.interpolate({range:[0,1],output:u?["translate3d(0px,0px,0px)","translate3d(1px,0,0)"]:["translate3d(0px,0px,0px)","translate3d(0,1px,0)"]});return e.createElement(mt,l({},s,{className:a,style:o((t={position:"absolute",backgroundSize:"auto",backgroundRepeat:"no-repeat",willChange:"transform"},t[u?"height":"width"]="100%",t[u?"width":"height"]=this.animatedSpace,t.WebkitTransform=f,t.MsTransform=f,t.transform=f,t),r)}),i)},r.render=function(){var t=this;return e.createElement(yt,null,function(e){return e&&!t.parent&&(t.parent=e,t.initialize()),t.renderLayer()})},n}(e.PureComponent);bt.defaultProps={factor:1,offset:0,speed:0};var wt=function(t){function n(){for(var e,n,r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];return e=n=t.call.apply(t,[this].concat(i))||this,n.state={ready:!1},n.layers=[],n.space=0,n.current=0,n.offset=0,n.busy=!1,n.moveItems=function(){n.layers.forEach(function(t){return t.setPosition(n.space,n.current)}),n.busy=!1},n.scrollerRaf=function(){return requestAnimationFrame(n.moveItems)},n.onScroll=function(t){var e=n.props.horizontal;n.busy||(n.busy=!0,n.scrollerRaf(),n.current=t.target[gt(e)])},n.update=function(){var t=n.props,e=t.scrolling,r=t.horizontal,i=gt(r);n.container&&(n.space=n.container[r?"clientWidth":"clientHeight"],e?n.current=n.container[i]:n.container[i]=n.current=n.offset*n.space,n.content&&(n.content.style[r?"width":"height"]=n.space*n.props.pages+"px"),n.layers.forEach(function(t){t.setHeight(n.space,!0),t.setPosition(n.space,n.current,!0)}))},n.updateRaf=function(){requestAnimationFrame(n.update),setTimeout(n.update,150)},n.scrollStop=function(t){return n.animatedScroll&&n.animatedScroll.stopAnimation()},e||tt(n)}f(n,t);var r=n.prototype;return r.scrollTo=function(t){var e=this.props,n=e.horizontal,r=e.config,i=e.impl,a=gt(n);this.scrollStop(),this.offset=t;var s=this.container;this.animatedScroll=new z(s[a]),this.animatedScroll.addListener(function(t){var e=t.value;return s[a]=e}),Z(this.animatedScroll,o({to:t*this.space},r),i).start()},r.componentDidMount=function(){window.addEventListener("resize",this.updateRaf,!1),this.update(),this.setState({ready:!0})},r.componentWillUnmount=function(){window.removeEventListener("resize",this.updateRaf,!1)},r.componentDidUpdate=function(){this.update()},r.render=function(){var t,n=this,r=this.props,i=r.style,a=r.innerStyle,s=r.pages,u=r.className,l=r.scrolling,c=r.children,f=r.horizontal,p=l?"scroll":"hidden";return e.createElement("div",{ref:function(t){return n.container=t},onScroll:this.onScroll,onWheel:l?this.scrollStop:null,onTouchStart:l?this.scrollStop:null,style:o({position:"absolute",width:"100%",height:"100%",overflow:p,overflowY:f?"hidden":p,overflowX:f?p:"hidden",WebkitOverflowScrolling:"touch",WebkitTransform:"translate(0px,0px)",MsTransform:"translate(0px,0px)",transform:"translate3d(0px,0px,0px)"},i),className:u},this.state.ready&&e.createElement("div",{ref:function(t){return n.content=t},style:o((t={position:"absolute"},t[f?"height":"width"]="100%",t.WebkitTransform="translate(0px,0px)",t.MsTransform="translate(0px,0px)",t.transform="translate3d(0px,0px,0px)",t.overflow="hidden",t[f?"width":"height"]=this.space*s,t),a)},e.createElement(_t,{value:this},c)))},n}(e.PureComponent);wt.Layer=bt,wt.defaultProps={config:et.slow,scrolling:!0,horizontal:!1,impl:J};var xt=function(t){function n(){for(var e,n,r=arguments.length,i=new Array(r),a=0;a<r;a++)i[a]=arguments[a];return e=n=t.call.apply(t,[this].concat(i))||this,n.state={primitive:void 0,props:{},resolve:function(){return null}},n.next=function(t,e){return new Promise(function(r){var i=n.instance&&n.instance.getValues(),a="function"==typeof e.from?e.from:o({},n.state.props.from,i,e.from);n.setState(function(n){return{primitive:t,props:o({},e,{from:a}),resolve:r}})})},e||tt(n)}f(n,t);var r=n.prototype;return r.componentDidMount=function(){this.props.script&&this.props.script(this.next)},r.render=function(){var t=this,n=this.state,r=n.primitive,i=n.props,o=n.resolve,a=this.props,s=(a.script,c(a,["script"]));return r?e.createElement(r,l({ref:function(e){return t.instance=e}},s,i,{onRest:o})):null},n}(e.Component);t.Spring=nt,t.Keyframes=xt,t.Transition=ot,t.Trail=at,t.Parallax=wt,t.ParallaxLayer=bt,t.Animation=$,t.SpringAnimation=J,t.AnimatedValue=z,t.config=et,t.animated=K,t.controller=Z,t.interpolate=function(t,e){return new q(t,e)},t.createAnimatedComponent=b,Object.defineProperty(t,"__esModule",{value:!0})}); |
{ | ||
"name": "react-spring", | ||
"version": "4.2.0", | ||
"version": "4.2.1-beta.0", | ||
"description": "Animate React with ease", | ||
@@ -5,0 +5,0 @@ "main": "dist/react-spring.cjs.js", |
@@ -18,25 +18,25 @@ [![Build Status](https://travis-ci.org/drcmda/react-spring.svg?branch=master)](https://travis-ci.org/drcmda/react-spring) [![npm version](https://badge.fury.io/js/react-spring.svg)](https://badge.fury.io/js/react-spring) | ||
<p align="middle"> | ||
<img src="assets/spring.gif" width="285" /> | ||
<img src="assets/transitions.gif" width="285" /> | ||
<img src="assets/trails.gif" width="285" /> | ||
<a href="https://codesandbox.io/embed/oln44nx8xq"><img src="assets/spring.gif" width="285" /></a> | ||
<a href="https://codesandbox.io/embed/j150ykxrv"><img src="assets/transitions.gif" width="285" /></a> | ||
<a href="https://codesandbox.io/embed/vvmv6x01l5"><img src="assets/trails.gif" width="285" /></a> | ||
</p> | ||
<p align="middle"> | ||
<img src="assets/tree.gif" width="285" /> | ||
<img src="assets/sunburst.gif" width="285" /> | ||
<img src="assets/areas.gif" width="285" /> | ||
<a href="https://codesandbox.io/embed/9jrjqvq954"><img src="assets/tree.gif" width="285" /></a> | ||
<a href="https://codesandbox.io/embed/nww6yxo0jl"><img src="assets/sunburst.gif" width="285" /></a> | ||
<a href="https://codesandbox.io/embed/j3x61vjz5v"><img src="assets/areas.gif" width="285" /></a> | ||
</p> | ||
<p align="middle"> | ||
<img src="assets/gestures.gif" width="285" /> | ||
<img src="assets/reveals.gif" width="285" /> | ||
<img src="assets/morph.gif" width="285" /> | ||
<a href="https://codesandbox.io/embed/jzn14k0ppy"><img src="assets/gestures.gif" width="285" /></a> | ||
<a href="https://codesandbox.io/embed/yj52v5689"><img src="assets/reveals.gif" width="285" /></a> | ||
<a href="https://codesandbox.io/embed/lwpkp46om"><img src="assets/morph.gif" width="285" /></a> | ||
</p> | ||
<p align="middle"> | ||
<img src="assets/vertical.gif" width="285" /> | ||
<img src="assets/horizontal.gif" width="285" /> | ||
<img src="assets/keyframes-trail.gif" width="285" /> | ||
<a href="https://codesandbox.io/embed/0oonqxnpjl"><img src="assets/vertical.gif" width="285" /></a> | ||
<a href="https://codesandbox.io/embed/548lqnmk6l"><img src="assets/horizontal.gif" width="285" /></a> | ||
<a href="https://codesandbox.io/embed/zl35mrkqmm"><img src="assets/keyframes-trail.gif" width="285" /></a> | ||
</p> | ||
<p align="middle"> | ||
<img src="assets/dragndrop.gif" width="285" /> | ||
<img src="assets/stream.gif" width="285" /> | ||
<img src="assets/time.gif" width="285" /> | ||
<a href="https://codesandbox.io/embed/l9zqz0m18z"><img src="assets/dragndrop.gif" width="285" /></a> | ||
<a href="https://codesandbox.io/embed/py3p5p11m7"><img src="assets/stream.gif" width="285" /></a> | ||
<a href="https://codesandbox.io/embed/q9lozyymr9"><img src="assets/time.gif" width="285" /></a> | ||
</p> | ||
@@ -209,3 +209,3 @@ | ||
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ||
| <sub>Libraries animate by having React recalculate the component-tree on every frame. Here it attempts to animate a component consisting of ~300 sub-components, plowing through the frame budget and causing jank.</sub> | <sub>React-spring with the `native` property renders the component _only once_, from then on the animation will be applied directly to the dom in a requestAnimationFrame-loop, similar to how gsap and d3 do it.</sub> | | ||
| <sub>Most libs animate by having React recalculate the component-tree on every frame. Here it attempts to animate a component consisting of ~300 sub-components, plowing through the frame budget and causing jank.</sub> | <sub>React-spring with the `native` property renders the component _only once_, from then on the animation will be applied directly to the dom in a requestAnimationFrame-loop, similar to how gsap and d3 do it.</sub> | | ||
@@ -212,0 +212,0 @@ ```jsx |
@@ -23,3 +23,3 @@ import Animation from '../animated/Animation' | ||
this._lastVelocity = withDefault(config.velocity, 0) | ||
this._toValue = config.toValue | ||
this._to = config.to | ||
var springConfig = fromOrigamiTensionAndFriction( | ||
@@ -88,3 +88,3 @@ withDefault(config.tension, 40), | ||
const omega1 = omega0 * Math.sqrt(1.0 - zeta * zeta) // exponential decay | ||
const x0 = this._toValue - this._startPosition // calculate the oscillation from x0 = 1 to x = 0 | ||
const x0 = this._to - this._startPosition // calculate the oscillation from x0 = 1 to x = 0 | ||
@@ -98,3 +98,3 @@ let position = 0.0 | ||
position = | ||
this._toValue - | ||
this._to - | ||
envelope * | ||
@@ -117,3 +117,3 @@ ((v0 + zeta * omega0 * x0) / omega1 * Math.sin(omega1 * t) + | ||
const envelope = Math.exp(-omega0 * t) | ||
position = this._toValue - envelope * (x0 + (v0 + omega0 * x0) * t) | ||
position = this._to - envelope * (x0 + (v0 + omega0 * x0) * t) | ||
velocity = envelope * (v0 * (t * omega0 - 1) + t * x0 * (omega0 * omega0)) | ||
@@ -135,5 +135,5 @@ } | ||
isOvershooting = | ||
this._startPosition < this._toValue | ||
? position > this._toValue | ||
: position < this._toValue | ||
this._startPosition < this._to | ||
? position > this._to | ||
: position < this._to | ||
} | ||
@@ -144,3 +144,3 @@ const isVelocity = Math.abs(velocity) <= this._restSpeedThreshold | ||
isDisplacement = | ||
Math.abs(this._toValue - position) <= this._restDisplacementThreshold | ||
Math.abs(this._to - position) <= this._restDisplacementThreshold | ||
} | ||
@@ -151,5 +151,5 @@ | ||
// Ensure that we end up with a round value | ||
this._lastPosition = this._toValue | ||
this._lastPosition = this._to | ||
this._lastVelocity = 0 | ||
this._onUpdate(this._toValue) | ||
this._onUpdate(this._to) | ||
} | ||
@@ -156,0 +156,0 @@ return this.__debouncedOnEnd({ finished: true }) |
@@ -8,3 +8,3 @@ import Animation from '../animated/Animation' | ||
super() | ||
this._toValue = config.toValue | ||
this._to = config.to | ||
this._easing = config.easing !== undefined ? config.easing : easeInOut | ||
@@ -23,3 +23,3 @@ this._duration = config.duration !== undefined ? config.duration : 500 | ||
if (this._duration === 0) { | ||
this._onUpdate(this._toValue) | ||
this._onUpdate(this._to) | ||
this.__debouncedOnEnd({ finished: true }) | ||
@@ -41,5 +41,4 @@ } else { | ||
this._duration === 0 | ||
? this._toValue | ||
: this._fromValue + | ||
this._easing(1) * (this._toValue - this._fromValue) | ||
? this._to | ||
: this._fromValue + this._easing(1) * (this._to - this._fromValue) | ||
) | ||
@@ -52,3 +51,3 @@ this.__debouncedOnEnd({ finished: true }) | ||
this._easing((now - this._startTime) / this._duration) * | ||
(this._toValue - this._fromValue) | ||
(this._to - this._fromValue) | ||
) | ||
@@ -55,0 +54,0 @@ if (this.__active) |
@@ -57,5 +57,8 @@ import AnimatedWithChildren from './AnimatedWithChildren' | ||
_update() { | ||
findAnimatedStyles(this, this._animatedStyles) | ||
} | ||
_flush() { | ||
//if (this._animatedStyles.size === 0 || this._tracked) this._update() | ||
findAnimatedStyles(this, this._animatedStyles) | ||
if (this._animatedStyles.size === 0) this._update() | ||
this._animatedStyles.forEach(animatedStyle => animatedStyle.update()) | ||
@@ -62,0 +65,0 @@ } |
@@ -19,39 +19,46 @@ import React from 'react' | ||
// Dry-route props back if nothing's using 'auto' in there | ||
if (![...Object.values(from), ...Object.values(to)].some(check)) return props | ||
if (![...Object.values(from), ...Object.values(to)].some(check)) return | ||
return new Promise(res => { | ||
const forward = spring.getForwardProps(props) | ||
const allProps = Object.entries({ ...from, ...to }) | ||
const portal = document.createElement('div') | ||
portal.style.cssText = 'position:static;visibility:hidden;' | ||
document.body.appendChild(portal) | ||
const forward = spring.getForwardProps(props) | ||
const allProps = Object.entries({ ...from, ...to }) | ||
const portal = document.createElement('div') | ||
portal.style.cssText = 'position:static;visibility:hidden;' | ||
document.body.appendChild(portal) | ||
// Collect to-state props | ||
const componentProps = native | ||
? allProps.reduce(convert, forward) | ||
: { ...from, ...to, ...forward } | ||
// Collect to-state props | ||
const componentProps = native | ||
? allProps.reduce(convert, forward) | ||
: { ...from, ...to, ...forward } | ||
// Render to-state vdom to portal | ||
ReactDOM.render( | ||
<div | ||
ref={ref => { | ||
if (ref) { | ||
// Once it's rendered out, fetch bounds | ||
const height = ref.clientHeight | ||
const width = ref.clientWidth | ||
// Render to-state vdom to portal | ||
return ReactDOM.createPortal( | ||
<div | ||
ref={ref => { | ||
if (ref) { | ||
// Once it's rendered out, fetch bounds | ||
const height = ref.clientHeight | ||
const width = ref.clientWidth | ||
// Remove portal and resolve promise with updated props | ||
document.body.removeChild(portal) | ||
res({ | ||
...props, | ||
from: Object.entries(from).reduce(overwrite(width, height), from), | ||
to: Object.entries(to).reduce(overwrite(width, height), to), | ||
}) | ||
} | ||
}}> | ||
{children(componentProps)} | ||
</div>, | ||
portal | ||
) | ||
}) | ||
// Remove portal and resolve promise with updated props | ||
document.body.removeChild(portal) | ||
// Defer to next frame, or else the springs updateToken is canceled | ||
requestAnimationFrame(() => | ||
spring.updateProps( | ||
{ | ||
...props, | ||
from: Object.entries(from).reduce( | ||
overwrite(width, height), | ||
from | ||
), | ||
to: Object.entries(to).reduce(overwrite(width, height), to), | ||
}, | ||
true | ||
) | ||
) | ||
} | ||
}}> | ||
{children(componentProps)} | ||
</div>, | ||
portal | ||
) | ||
} |
@@ -68,5 +68,4 @@ import React from 'react' | ||
if (props.inject) { | ||
props = props.inject(this, props) | ||
// This is in order to not waste time, if it isn't a promise, don't stall | ||
if (props.then) return props.then(props => this.updateProps(props, true)) | ||
this.inject = props.inject(this, props) | ||
if (this.inject) return | ||
} | ||
@@ -170,4 +169,4 @@ this.updateProps(props) | ||
this.updateToken = true | ||
if (force) this.forceUpdate() | ||
this.start() | ||
} | ||
@@ -185,2 +184,8 @@ | ||
flush() { | ||
this.getAnimations().forEach( | ||
({ interpolation }) => interpolation._update && interpolation._update() | ||
) | ||
} | ||
callback = () => { | ||
@@ -223,3 +228,24 @@ if (this.props.onFrame) this.props.onFrame(this.animatedProps.__getValue()) | ||
componentDidUpdate() { | ||
// Animation has to start *after* render, since at that point the scene | ||
// graph should be established, so we do it here. Unfortunatelly, non-native | ||
// animations call forceUpdate, so it's causing a loop. updateToken prevents | ||
// that as it gets set only on prop changes. | ||
if (this.updateToken) { | ||
this.updateToken = false | ||
this.start() | ||
} | ||
} | ||
componentDidMount() { | ||
this.start() | ||
} | ||
render() { | ||
if (this.inject) { | ||
const content = this.inject | ||
this.inject = undefined | ||
return content | ||
} | ||
const { children, render } = this.props | ||
@@ -226,0 +252,0 @@ const values = this.getAnimatedValues() |
@@ -28,2 +28,10 @@ import React from 'react' | ||
componentDidMount() { | ||
this.instance && this.instance.flush() | ||
} | ||
componentDidUpdate() { | ||
this.instance && this.instance.flush() | ||
} | ||
render() { | ||
@@ -30,0 +38,0 @@ const { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
346832
7900
2