Socket
Socket
Sign inDemoInstall

rebound

Package Overview
Dependencies
0
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.12 to 0.0.13

2

component.json
{
"name": "rebound",
"version": "0.0.10",
"version": "0.0.13",
"description": "A simple library for modeling spring dynamics",

@@ -5,0 +5,0 @@ "repository": "facebook/rebound-js",

{
"name": "rebound",
"version": "0.0.12",
"version": "0.0.13",
"description": "A simple library for modeling spring dynamics",

@@ -5,0 +5,0 @@ "main": "rebound.js",

@@ -687,3 +687,3 @@ // Rebound

if (this._timeAccumulator > 0) {
this.interpolate(this._timeAccumulator / Spring.SOLVER_TIMESTEP_SEC);
this._interpolate(this._timeAccumulator / Spring.SOLVER_TIMESTEP_SEC);
}

@@ -774,3 +774,3 @@

interpolate: function(alpha) {
_interpolate: function(alpha) {
this._currentState.position = this._currentState.position *

@@ -1121,3 +1121,6 @@ alpha + this._previousState.position * (1 - alpha);

window.msRequestAnimationFrame ||
window.oRequestAnimationFrame;
window.oRequestAnimationFrame ||
function(callback) {
window.setTimeout(callback, 1000 / 60);
};
}

@@ -1124,0 +1127,0 @@ if (!_onFrame && typeof process !== 'undefined' && process.title === 'node') {

@@ -1,1 +0,1 @@

!function(){function a(a,b){var c=a.indexOf(b);-1!=c&&a.splice(c,1)}var b={},c=b.util={},d=Array.prototype.concat,e=Array.prototype.slice;c.bind=function(a,b){var c=e.call(arguments,2);return function(){a.apply(b,d.call(c,e.call(arguments)))}},c.extend=function(a,b){for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c])};var f=b.SpringSystem=function(a){this._springRegistry={},this._activeSprings=[],this.listeners=[],this._idleSpringIndices=[],this.looper=a||new j,this.looper.springSystem=this};c.extend(f.prototype,{_springRegistry:null,_isIdle:!0,_lastTimeMillis:-1,_activeSprings:null,listeners:null,_idleSpringIndices:null,setLooper:function(a){this.looper=a,a.springSystem=this},createSpring:function(a,b){var c;return c=void 0===a||void 0===b?i.DEFAULT_ORIGAMI_SPRING_CONFIG:i.fromOrigamiTensionAndFriction(a,b),this.createSpringWithConfig(c)},createSpringWithBouncinessAndSpeed:function(a,b){var c;return c=void 0===a||void 0===b?i.DEFAULT_ORIGAMI_SPRING_CONFIG:i.fromBouncinessAndSpeed(a,b),this.createSpringWithConfig(c)},createSpringWithConfig:function(a){var b=new g(this);return this.registerSpring(b),b.setSpringConfig(a),b},getIsIdle:function(){return this._isIdle},getSpringById:function(a){return this._springRegistry[a]},getAllSprings:function(){var a=[];for(var b in this._springRegistry)this._springRegistry.hasOwnProperty(b)&&a.push(this._springRegistry[b]);return a},registerSpring:function(a){this._springRegistry[a.getId()]=a},deregisterSpring:function(b){a(this._activeSprings,b),delete this._springRegistry[b.getId()]},advance:function(a,b){for(;this._idleSpringIndices.length>0;)this._idleSpringIndices.pop();for(var c=0,d=this._activeSprings.length;d>c;c++){var e=this._activeSprings[c];e.systemShouldAdvance()?e.advance(a/1e3,b/1e3):this._idleSpringIndices.push(this._activeSprings.indexOf(e))}for(;this._idleSpringIndices.length>0;){var f=this._idleSpringIndices.pop();f>=0&&this._activeSprings.splice(f,1)}},loop:function(a){var b;-1===this._lastTimeMillis&&(this._lastTimeMillis=a-1);var c=a-this._lastTimeMillis;this._lastTimeMillis=a;var d=0,e=this.listeners.length;for(d=0;e>d;d++)b=this.listeners[d],b.onBeforeIntegrate&&b.onBeforeIntegrate(this);for(this.advance(a,c),0===this._activeSprings.length&&(this._isIdle=!0,this._lastTimeMillis=-1),d=0;e>d;d++)b=this.listeners[d],b.onAfterIntegrate&&b.onAfterIntegrate(this);this._isIdle||this.looper.run()},activateSpring:function(a){var b=this._springRegistry[a];-1==this._activeSprings.indexOf(b)&&this._activeSprings.push(b),this.getIsIdle()&&(this._isIdle=!1,this.looper.run())},addListener:function(a){this.listeners.push(a)},removeListener:function(b){a(this.listeners,b)},removeAllListeners:function(){this.listeners=[]}});var g=b.Spring=function p(a){this._id="s"+p._ID++,this._springSystem=a,this.listeners=[],this._currentState=new h,this._previousState=new h,this._tempState=new h};c.extend(g,{_ID:0,MAX_DELTA_TIME_SEC:.064,SOLVER_TIMESTEP_SEC:.001}),c.extend(g.prototype,{_id:0,_springConfig:null,_overshootClampingEnabled:!1,_currentState:null,_previousState:null,_tempState:null,_startValue:0,_endValue:0,_wasAtRest:!0,_restSpeedThreshold:.001,_displacementFromRestThreshold:.001,listeners:null,_timeAccumulator:0,_springSystem:null,destroy:function(){this.listeners=[],this.frames=[],this._springSystem.deregisterSpring(this)},getId:function(){return this._id},setSpringConfig:function(a){return this._springConfig=a,this},getSpringConfig:function(){return this._springConfig},setCurrentValue:function(a,b){return this._startValue=a,this._currentState.position=a,b||this.setAtRest(),this.notifyPositionUpdated(!1,!1),this},getStartValue:function(){return this._startValue},getCurrentValue:function(){return this._currentState.position},getCurrentDisplacementDistance:function(){return this.getDisplacementDistanceForState(this._currentState)},getDisplacementDistanceForState:function(a){return Math.abs(this._endValue-a.position)},setEndValue:function(a){if(this._endValue==a&&this.isAtRest())return this;this._startValue=this.getCurrentValue(),this._endValue=a,this._springSystem.activateSpring(this.getId());for(var b=0,c=this.listeners.length;c>b;b++){var d=this.listeners[b],e=d.onSpringEndStateChange;e&&e(this)}return this},getEndValue:function(){return this._endValue},setVelocity:function(a){return a===this._currentState.velocity?this:(this._currentState.velocity=a,this._springSystem.activateSpring(this.getId()),this)},getVelocity:function(){return this._currentState.velocity},setRestSpeedThreshold:function(a){return this._restSpeedThreshold=a,this},getRestSpeedThreshold:function(){return this._restSpeedThreshold},setRestDisplacementThreshold:function(a){this._displacementFromRestThreshold=a},getRestDisplacementThreshold:function(){return this._displacementFromRestThreshold},setOvershootClampingEnabled:function(a){return this._overshootClampingEnabled=a,this},isOvershootClampingEnabled:function(){return this._overshootClampingEnabled},isOvershooting:function(){var a=this._startValue,b=this._endValue;return this._springConfig.tension>0&&(b>a&&this.getCurrentValue()>b||a>b&&this.getCurrentValue()<b)},advance:function(a,b){var c=this.isAtRest();if(!c||!this._wasAtRest){var d=b;b>g.MAX_DELTA_TIME_SEC&&(d=g.MAX_DELTA_TIME_SEC),this._timeAccumulator+=d;for(var e,f,h,i,j,k,l,m,n,o,p=this._springConfig.tension,q=this._springConfig.friction,r=this._currentState.position,s=this._currentState.velocity,t=this._tempState.position,u=this._tempState.velocity;this._timeAccumulator>=g.SOLVER_TIMESTEP_SEC;)this._timeAccumulator-=g.SOLVER_TIMESTEP_SEC,this._timeAccumulator<g.SOLVER_TIMESTEP_SEC&&(this._previousState.position=r,this._previousState.velocity=s),e=s,f=p*(this._endValue-t)-q*s,t=r+e*g.SOLVER_TIMESTEP_SEC*.5,u=s+f*g.SOLVER_TIMESTEP_SEC*.5,h=u,i=p*(this._endValue-t)-q*u,t=r+h*g.SOLVER_TIMESTEP_SEC*.5,u=s+i*g.SOLVER_TIMESTEP_SEC*.5,j=u,k=p*(this._endValue-t)-q*u,t=r+j*g.SOLVER_TIMESTEP_SEC*.5,u=s+k*g.SOLVER_TIMESTEP_SEC*.5,l=u,m=p*(this._endValue-t)-q*u,n=1/6*(e+2*(h+j)+l),o=1/6*(f+2*(i+k)+m),r+=n*g.SOLVER_TIMESTEP_SEC,s+=o*g.SOLVER_TIMESTEP_SEC;this._tempState.position=t,this._tempState.velocity=u,this._currentState.position=r,this._currentState.velocity=s,this._timeAccumulator>0&&this.interpolate(this._timeAccumulator/g.SOLVER_TIMESTEP_SEC),(this.isAtRest()||this._overshootClampingEnabled&&this.isOvershooting())&&(this._springConfig.tension>0?(this._startValue=this._endValue,this._currentState.position=this._endValue):(this._endValue=this._currentState.position,this._startValue=this._endValue),this.setVelocity(0),c=!0);var v=!1;this._wasAtRest&&(this._wasAtRest=!1,v=!0);var w=!1;c&&(this._wasAtRest=!0,w=!0),this.notifyPositionUpdated(v,w)}},notifyPositionUpdated:function(a,b){for(var c=0,d=this.listeners.length;d>c;c++){var e=this.listeners[c];a&&e.onSpringActivate&&e.onSpringActivate(this),e.onSpringUpdate&&e.onSpringUpdate(this),b&&e.onSpringAtRest&&e.onSpringAtRest(this)}},systemShouldAdvance:function(){return!this.isAtRest()||!this.wasAtRest()},wasAtRest:function(){return this._wasAtRest},isAtRest:function(){return Math.abs(this._currentState.velocity)<this._restSpeedThreshold&&(this.getDisplacementDistanceForState(this._currentState)<=this._displacementFromRestThreshold||0===this._springConfig.tension)},setAtRest:function(){return this._endValue=this._currentState.position,this._tempState.position=this._currentState.position,this._currentState.velocity=0,this},interpolate:function(a){this._currentState.position=this._currentState.position*a+this._previousState.position*(1-a),this._currentState.velocity=this._currentState.velocity*a+this._previousState.velocity*(1-a)},getListeners:function(){return this.listeners},addListener:function(a){return this.listeners.push(a),this},removeListener:function(b){return a(this.listeners,b),this},removeAllListeners:function(){return this.listeners=[],this},currentValueIsApproximately:function(a){return Math.abs(this.getCurrentValue()-a)<=this.getRestDisplacementThreshold()}});var h=function(){};c.extend(h.prototype,{position:0,velocity:0});var i=b.SpringConfig=function(a,b){this.tension=a,this.friction=b},j=b.AnimationLooper=function(){this.springSystem=null;var a=this,b=function(){a.springSystem.loop(Date.now())};this.run=function(){c.onFrame(b)}};b.SimulationLooper=function(a){this.springSystem=null;var b=0,c=!1;a=a||16.667,this.run=function(){if(!c){for(c=!0;!this.springSystem.getIsIdle();)this.springSystem.loop(b+=a);c=!1}}},b.SteppingSimulationLooper=function(){this.springSystem=null;var a=0;this.run=function(){},this.step=function(b){this.springSystem.loop(a+=b)}};var k=b.OrigamiValueConverter={tensionFromOrigamiValue:function(a){return 3.62*(a-30)+194},origamiValueFromTension:function(a){return(a-194)/3.62+30},frictionFromOrigamiValue:function(a){return 3*(a-8)+25},origamiFromFriction:function(a){return(a-25)/3+8}},l=b.BouncyConversion=function(a,b){this.bounciness=a,this.speed=b;var c=this.normalize(a/1.7,0,20);c=this.projectNormal(c,0,.8);var d=this.normalize(b/1.7,0,20);this.bouncyTension=this.projectNormal(d,.5,200),this.bouncyFriction=this.quadraticOutInterpolation(c,this.b3Nobounce(this.bouncyTension),.01)};c.extend(l.prototype,{normalize:function(a,b,c){return(a-b)/(c-b)},projectNormal:function(a,b,c){return b+a*(c-b)},linearInterpolation:function(a,b,c){return a*c+(1-a)*b},quadraticOutInterpolation:function(a,b,c){return this.linearInterpolation(2*a-a*a,b,c)},b3Friction1:function(a){return 7e-4*Math.pow(a,3)-.031*Math.pow(a,2)+.64*a+1.28},b3Friction2:function(a){return 44e-6*Math.pow(a,3)-.006*Math.pow(a,2)+.36*a+2},b3Friction3:function(a){return 4.5e-7*Math.pow(a,3)-332e-6*Math.pow(a,2)+.1078*a+5.84},b3Nobounce:function(a){var b=0;return b=18>=a?this.b3Friction1(a):a>18&&44>=a?this.b3Friction2(a):this.b3Friction3(a)}}),c.extend(i,{fromOrigamiTensionAndFriction:function(a,b){return new i(k.tensionFromOrigamiValue(a),k.frictionFromOrigamiValue(b))},fromBouncinessAndSpeed:function(a,c){var d=new b.BouncyConversion(a,c);return this.fromOrigamiTensionAndFriction(d.bouncyTension,d.bouncyFriction)},coastingConfigWithOrigamiFriction:function(a){return new i(0,k.frictionFromOrigamiValue(a))}}),i.DEFAULT_ORIGAMI_SPRING_CONFIG=i.fromOrigamiTensionAndFriction(40,7),c.extend(i.prototype,{friction:0,tension:0});var m={};c.hexToRGB=function(a){if(m[a])return m[a];a=a.replace("#",""),3===a.length&&(a=a[0]+a[0]+a[1]+a[1]+a[2]+a[2]);var b=a.match(/.{2}/g),c={r:parseInt(b[0],16),g:parseInt(b[1],16),b:parseInt(b[2],16)};return m[a]=c,c},c.rgbToHex=function(a,b,c){return a=a.toString(16),b=b.toString(16),c=c.toString(16),a=a.length<2?"0"+a:a,b=b.length<2?"0"+b:b,c=c.length<2?"0"+c:c,"#"+a+b+c};var n=b.MathUtil={mapValueInRange:function(a,b,c,d,e){var f=c-b,g=e-d,h=(a-b)/f;return d+h*g},interpolateColor:function(a,b,d,e,f,g){e=void 0===e?0:e,f=void 0===f?1:f,b=c.hexToRGB(b),d=c.hexToRGB(d);var h=Math.floor(c.mapValueInRange(a,e,f,b.r,d.r)),i=Math.floor(c.mapValueInRange(a,e,f,b.g,d.g)),j=Math.floor(c.mapValueInRange(a,e,f,b.b,d.b));return g?"rgb("+h+","+i+","+j+")":c.rgbToHex(h,i,j)},degreesToRadians:function(a){return a*Math.PI/180},radiansToDegrees:function(a){return 180*a/Math.PI}};c.extend(c,n);var o;"undefined"!=typeof window&&(o=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.msRequestAnimationFrame||window.oRequestAnimationFrame),o||"undefined"==typeof process||"node"!==process.title||(o=setImmediate),c.onFrame=function(a){return o(a)},"undefined"!=typeof exports?c.extend(exports,b):"undefined"!=typeof window&&(window.rebound=b)}();
!function(){function a(a,b){var c=a.indexOf(b);-1!=c&&a.splice(c,1)}var b={},c=b.util={},d=Array.prototype.concat,e=Array.prototype.slice;c.bind=function(a,b){var c=e.call(arguments,2);return function(){a.apply(b,d.call(c,e.call(arguments)))}},c.extend=function(a,b){for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c])};var f=b.SpringSystem=function(a){this._springRegistry={},this._activeSprings=[],this.listeners=[],this._idleSpringIndices=[],this.looper=a||new j,this.looper.springSystem=this};c.extend(f.prototype,{_springRegistry:null,_isIdle:!0,_lastTimeMillis:-1,_activeSprings:null,listeners:null,_idleSpringIndices:null,setLooper:function(a){this.looper=a,a.springSystem=this},createSpring:function(a,b){var c;return c=void 0===a||void 0===b?i.DEFAULT_ORIGAMI_SPRING_CONFIG:i.fromOrigamiTensionAndFriction(a,b),this.createSpringWithConfig(c)},createSpringWithBouncinessAndSpeed:function(a,b){var c;return c=void 0===a||void 0===b?i.DEFAULT_ORIGAMI_SPRING_CONFIG:i.fromBouncinessAndSpeed(a,b),this.createSpringWithConfig(c)},createSpringWithConfig:function(a){var b=new g(this);return this.registerSpring(b),b.setSpringConfig(a),b},getIsIdle:function(){return this._isIdle},getSpringById:function(a){return this._springRegistry[a]},getAllSprings:function(){var a=[];for(var b in this._springRegistry)this._springRegistry.hasOwnProperty(b)&&a.push(this._springRegistry[b]);return a},registerSpring:function(a){this._springRegistry[a.getId()]=a},deregisterSpring:function(b){a(this._activeSprings,b),delete this._springRegistry[b.getId()]},advance:function(a,b){for(;this._idleSpringIndices.length>0;)this._idleSpringIndices.pop();for(var c=0,d=this._activeSprings.length;d>c;c++){var e=this._activeSprings[c];e.systemShouldAdvance()?e.advance(a/1e3,b/1e3):this._idleSpringIndices.push(this._activeSprings.indexOf(e))}for(;this._idleSpringIndices.length>0;){var f=this._idleSpringIndices.pop();f>=0&&this._activeSprings.splice(f,1)}},loop:function(a){var b;-1===this._lastTimeMillis&&(this._lastTimeMillis=a-1);var c=a-this._lastTimeMillis;this._lastTimeMillis=a;var d=0,e=this.listeners.length;for(d=0;e>d;d++)b=this.listeners[d],b.onBeforeIntegrate&&b.onBeforeIntegrate(this);for(this.advance(a,c),0===this._activeSprings.length&&(this._isIdle=!0,this._lastTimeMillis=-1),d=0;e>d;d++)b=this.listeners[d],b.onAfterIntegrate&&b.onAfterIntegrate(this);this._isIdle||this.looper.run()},activateSpring:function(a){var b=this._springRegistry[a];-1==this._activeSprings.indexOf(b)&&this._activeSprings.push(b),this.getIsIdle()&&(this._isIdle=!1,this.looper.run())},addListener:function(a){this.listeners.push(a)},removeListener:function(b){a(this.listeners,b)},removeAllListeners:function(){this.listeners=[]}});var g=b.Spring=function p(a){this._id="s"+p._ID++,this._springSystem=a,this.listeners=[],this._currentState=new h,this._previousState=new h,this._tempState=new h};c.extend(g,{_ID:0,MAX_DELTA_TIME_SEC:.064,SOLVER_TIMESTEP_SEC:.001}),c.extend(g.prototype,{_id:0,_springConfig:null,_overshootClampingEnabled:!1,_currentState:null,_previousState:null,_tempState:null,_startValue:0,_endValue:0,_wasAtRest:!0,_restSpeedThreshold:.001,_displacementFromRestThreshold:.001,listeners:null,_timeAccumulator:0,_springSystem:null,destroy:function(){this.listeners=[],this.frames=[],this._springSystem.deregisterSpring(this)},getId:function(){return this._id},setSpringConfig:function(a){return this._springConfig=a,this},getSpringConfig:function(){return this._springConfig},setCurrentValue:function(a,b){return this._startValue=a,this._currentState.position=a,b||this.setAtRest(),this.notifyPositionUpdated(!1,!1),this},getStartValue:function(){return this._startValue},getCurrentValue:function(){return this._currentState.position},getCurrentDisplacementDistance:function(){return this.getDisplacementDistanceForState(this._currentState)},getDisplacementDistanceForState:function(a){return Math.abs(this._endValue-a.position)},setEndValue:function(a){if(this._endValue==a&&this.isAtRest())return this;this._startValue=this.getCurrentValue(),this._endValue=a,this._springSystem.activateSpring(this.getId());for(var b=0,c=this.listeners.length;c>b;b++){var d=this.listeners[b],e=d.onSpringEndStateChange;e&&e(this)}return this},getEndValue:function(){return this._endValue},setVelocity:function(a){return a===this._currentState.velocity?this:(this._currentState.velocity=a,this._springSystem.activateSpring(this.getId()),this)},getVelocity:function(){return this._currentState.velocity},setRestSpeedThreshold:function(a){return this._restSpeedThreshold=a,this},getRestSpeedThreshold:function(){return this._restSpeedThreshold},setRestDisplacementThreshold:function(a){this._displacementFromRestThreshold=a},getRestDisplacementThreshold:function(){return this._displacementFromRestThreshold},setOvershootClampingEnabled:function(a){return this._overshootClampingEnabled=a,this},isOvershootClampingEnabled:function(){return this._overshootClampingEnabled},isOvershooting:function(){var a=this._startValue,b=this._endValue;return this._springConfig.tension>0&&(b>a&&this.getCurrentValue()>b||a>b&&this.getCurrentValue()<b)},advance:function(a,b){var c=this.isAtRest();if(!c||!this._wasAtRest){var d=b;b>g.MAX_DELTA_TIME_SEC&&(d=g.MAX_DELTA_TIME_SEC),this._timeAccumulator+=d;for(var e,f,h,i,j,k,l,m,n,o,p=this._springConfig.tension,q=this._springConfig.friction,r=this._currentState.position,s=this._currentState.velocity,t=this._tempState.position,u=this._tempState.velocity;this._timeAccumulator>=g.SOLVER_TIMESTEP_SEC;)this._timeAccumulator-=g.SOLVER_TIMESTEP_SEC,this._timeAccumulator<g.SOLVER_TIMESTEP_SEC&&(this._previousState.position=r,this._previousState.velocity=s),e=s,f=p*(this._endValue-t)-q*s,t=r+e*g.SOLVER_TIMESTEP_SEC*.5,u=s+f*g.SOLVER_TIMESTEP_SEC*.5,h=u,i=p*(this._endValue-t)-q*u,t=r+h*g.SOLVER_TIMESTEP_SEC*.5,u=s+i*g.SOLVER_TIMESTEP_SEC*.5,j=u,k=p*(this._endValue-t)-q*u,t=r+j*g.SOLVER_TIMESTEP_SEC*.5,u=s+k*g.SOLVER_TIMESTEP_SEC*.5,l=u,m=p*(this._endValue-t)-q*u,n=1/6*(e+2*(h+j)+l),o=1/6*(f+2*(i+k)+m),r+=n*g.SOLVER_TIMESTEP_SEC,s+=o*g.SOLVER_TIMESTEP_SEC;this._tempState.position=t,this._tempState.velocity=u,this._currentState.position=r,this._currentState.velocity=s,this._timeAccumulator>0&&this._interpolate(this._timeAccumulator/g.SOLVER_TIMESTEP_SEC),(this.isAtRest()||this._overshootClampingEnabled&&this.isOvershooting())&&(this._springConfig.tension>0?(this._startValue=this._endValue,this._currentState.position=this._endValue):(this._endValue=this._currentState.position,this._startValue=this._endValue),this.setVelocity(0),c=!0);var v=!1;this._wasAtRest&&(this._wasAtRest=!1,v=!0);var w=!1;c&&(this._wasAtRest=!0,w=!0),this.notifyPositionUpdated(v,w)}},notifyPositionUpdated:function(a,b){for(var c=0,d=this.listeners.length;d>c;c++){var e=this.listeners[c];a&&e.onSpringActivate&&e.onSpringActivate(this),e.onSpringUpdate&&e.onSpringUpdate(this),b&&e.onSpringAtRest&&e.onSpringAtRest(this)}},systemShouldAdvance:function(){return!this.isAtRest()||!this.wasAtRest()},wasAtRest:function(){return this._wasAtRest},isAtRest:function(){return Math.abs(this._currentState.velocity)<this._restSpeedThreshold&&(this.getDisplacementDistanceForState(this._currentState)<=this._displacementFromRestThreshold||0===this._springConfig.tension)},setAtRest:function(){return this._endValue=this._currentState.position,this._tempState.position=this._currentState.position,this._currentState.velocity=0,this},_interpolate:function(a){this._currentState.position=this._currentState.position*a+this._previousState.position*(1-a),this._currentState.velocity=this._currentState.velocity*a+this._previousState.velocity*(1-a)},getListeners:function(){return this.listeners},addListener:function(a){return this.listeners.push(a),this},removeListener:function(b){return a(this.listeners,b),this},removeAllListeners:function(){return this.listeners=[],this},currentValueIsApproximately:function(a){return Math.abs(this.getCurrentValue()-a)<=this.getRestDisplacementThreshold()}});var h=function(){};c.extend(h.prototype,{position:0,velocity:0});var i=b.SpringConfig=function(a,b){this.tension=a,this.friction=b},j=b.AnimationLooper=function(){this.springSystem=null;var a=this,b=function(){a.springSystem.loop(Date.now())};this.run=function(){c.onFrame(b)}};b.SimulationLooper=function(a){this.springSystem=null;var b=0,c=!1;a=a||16.667,this.run=function(){if(!c){for(c=!0;!this.springSystem.getIsIdle();)this.springSystem.loop(b+=a);c=!1}}},b.SteppingSimulationLooper=function(){this.springSystem=null;var a=0;this.run=function(){},this.step=function(b){this.springSystem.loop(a+=b)}};var k=b.OrigamiValueConverter={tensionFromOrigamiValue:function(a){return 3.62*(a-30)+194},origamiValueFromTension:function(a){return(a-194)/3.62+30},frictionFromOrigamiValue:function(a){return 3*(a-8)+25},origamiFromFriction:function(a){return(a-25)/3+8}},l=b.BouncyConversion=function(a,b){this.bounciness=a,this.speed=b;var c=this.normalize(a/1.7,0,20);c=this.projectNormal(c,0,.8);var d=this.normalize(b/1.7,0,20);this.bouncyTension=this.projectNormal(d,.5,200),this.bouncyFriction=this.quadraticOutInterpolation(c,this.b3Nobounce(this.bouncyTension),.01)};c.extend(l.prototype,{normalize:function(a,b,c){return(a-b)/(c-b)},projectNormal:function(a,b,c){return b+a*(c-b)},linearInterpolation:function(a,b,c){return a*c+(1-a)*b},quadraticOutInterpolation:function(a,b,c){return this.linearInterpolation(2*a-a*a,b,c)},b3Friction1:function(a){return 7e-4*Math.pow(a,3)-.031*Math.pow(a,2)+.64*a+1.28},b3Friction2:function(a){return 44e-6*Math.pow(a,3)-.006*Math.pow(a,2)+.36*a+2},b3Friction3:function(a){return 4.5e-7*Math.pow(a,3)-332e-6*Math.pow(a,2)+.1078*a+5.84},b3Nobounce:function(a){var b=0;return b=18>=a?this.b3Friction1(a):a>18&&44>=a?this.b3Friction2(a):this.b3Friction3(a)}}),c.extend(i,{fromOrigamiTensionAndFriction:function(a,b){return new i(k.tensionFromOrigamiValue(a),k.frictionFromOrigamiValue(b))},fromBouncinessAndSpeed:function(a,c){var d=new b.BouncyConversion(a,c);return this.fromOrigamiTensionAndFriction(d.bouncyTension,d.bouncyFriction)},coastingConfigWithOrigamiFriction:function(a){return new i(0,k.frictionFromOrigamiValue(a))}}),i.DEFAULT_ORIGAMI_SPRING_CONFIG=i.fromOrigamiTensionAndFriction(40,7),c.extend(i.prototype,{friction:0,tension:0});var m={};c.hexToRGB=function(a){if(m[a])return m[a];a=a.replace("#",""),3===a.length&&(a=a[0]+a[0]+a[1]+a[1]+a[2]+a[2]);var b=a.match(/.{2}/g),c={r:parseInt(b[0],16),g:parseInt(b[1],16),b:parseInt(b[2],16)};return m[a]=c,c},c.rgbToHex=function(a,b,c){return a=a.toString(16),b=b.toString(16),c=c.toString(16),a=a.length<2?"0"+a:a,b=b.length<2?"0"+b:b,c=c.length<2?"0"+c:c,"#"+a+b+c};var n=b.MathUtil={mapValueInRange:function(a,b,c,d,e){var f=c-b,g=e-d,h=(a-b)/f;return d+h*g},interpolateColor:function(a,b,d,e,f,g){e=void 0===e?0:e,f=void 0===f?1:f,b=c.hexToRGB(b),d=c.hexToRGB(d);var h=Math.floor(c.mapValueInRange(a,e,f,b.r,d.r)),i=Math.floor(c.mapValueInRange(a,e,f,b.g,d.g)),j=Math.floor(c.mapValueInRange(a,e,f,b.b,d.b));return g?"rgb("+h+","+i+","+j+")":c.rgbToHex(h,i,j)},degreesToRadians:function(a){return a*Math.PI/180},radiansToDegrees:function(a){return 180*a/Math.PI}};c.extend(c,n);var o;"undefined"!=typeof window&&(o=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.msRequestAnimationFrame||window.oRequestAnimationFrame||function(a){window.setTimeout(a,1e3/60)}),o||"undefined"==typeof process||"node"!==process.title||(o=setImmediate),c.onFrame=function(a){return o(a)},"undefined"!=typeof exports?c.extend(exports,b):"undefined"!=typeof window&&(window.rebound=b)}();

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc