Comparing version 0.3.6 to 0.3.7
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
function Temporisation(t,i,n,s){this.start=t,this.end=t+i,this.duration=i,this.properties=s,this.to=n}function AbstractTween(t,i){if(this._object=t,(null===i||void 0===i)&&t instanceof Array){i=[];for(var n=0;n<t.length;n+=1)i[n]=n}this._properties=i,this._from=null,this._interpolations=null,this._index=0,this._transitions=[],this._relative=!1,this._time=0,this._duration=0}var Transition=require("./Transition"),TransitionRelative=require("./TransitionRelative"),easingFunctions=require("./easing"),interpolationFunctions=require("./interpolation");Temporisation.prototype.update=function(t){for(var i=0;i<this.properties.length;i+=1){var n=this.properties[i];t[n]=this.to[n]}},module.exports=AbstractTween,AbstractTween.prototype.relative=function(t){return this._relative=t,this},AbstractTween.prototype.reset=function(){return this._index=0,this._duration=0,this._transitions=[],this},AbstractTween.prototype.interpolations=function(t){for(var i=0;i<this._properties.length;i+=1){var n=this._properties[i],s=t[n];void 0!==s?"string"==typeof s&&(void 0===interpolationFunctions[s]?(console.warn("[AbstractTween.interpolations] Given interpolation does not exist"),t[n]=interpolationFunctions.linear):t[n]=interpolationFunctions[s]):t[n]=interpolationFunctions.linear}return this._interpolations=t,this},AbstractTween.prototype.from=function(t){return this._from=t,this._transitions.length>0&&(this._transitions[0].from=t),this},AbstractTween.prototype._setFrom=function(){this._from={};for(var t=0;t<this._properties.length;t+=1){var i=this._properties[t];this._from[i]=this._relative===!0?0:this._object[i]}return this._from},AbstractTween.prototype._getLastTransitionEnding=function(){return this._transitions.length>0?this._transitions[this._transitions.length-1].to:null===this._from?this._setFrom():this._from},AbstractTween.prototype.to=function(t,i,n,s,e){"string"==typeof n&&(void 0===easingFunctions[n]?(console.warn("[AbstractTween.to] Given easing does not exist"),n=void 0):n=easingFunctions[n]);var r=this._getLastTransitionEnding(),o=this._relative===!0?TransitionRelative:Transition,a=new o(this._properties,r,t,this._duration,i,n,s,this._interpolations,e);return this._transitions.push(a),this._duration+=i,this},AbstractTween.prototype.wait=function(t){var i=this._getLastTransitionEnding();return this._transitions.push(new Temporisation(this._duration,t,i,this._properties)),this._duration+=t,this},AbstractTween.prototype._update=function(){for(var t=this._transitions[this._index];t.end<=this._time;){if(this._index===this._transitions.length-1)return void t.update(this._object,1);t=this._transitions[++this._index]}for(;this._time<=t.start;){if(0===this._index)return void t.update(this._object,0);t=this._transitions[--this._index]}t.update(this._object,(this._time-t.start)/t.duration)},AbstractTween.prototype._validate=function(){return 0===this._transitions.length?(console.warn("[AbstractTween._validate] Cannot start a tween with no transition:",this),!1):!0}; | ||
function Temporisation(t,i,n,s){this.start=t,this.end=t+i,this.duration=i,this.properties=s,this.to=n}function AbstractTween(t,i){if(this._object=t,(null===i||void 0===i)&&t instanceof Array){i=[];for(var n=0;n<t.length;n+=1)i[n]=n}this._properties=i,this._from=null,this._interpolations=null,this._index=0,this._transitions=[],this._relative=!1,this._time=0,this._duration=0}var Transition=require("./Transition"),TransitionRelative=require("./TransitionRelative"),easingFunctions=require("./easing"),interpolationFunctions=require("./interpolation");Temporisation.prototype.update=function(t){for(var i=0;i<this.properties.length;i+=1){var n=this.properties[i];t[n]=this.to[n]}},module.exports=AbstractTween,AbstractTween.prototype.relative=function(t){return this._relative=t,this},AbstractTween.prototype.reset=function(){return this._index=0,this._duration=0,this._transitions=[],this},AbstractTween.prototype.interpolations=function(t){for(var i=0;i<this._properties.length;i+=1){var n=this._properties[i],s=t[n];void 0!==s?"string"==typeof s&&(void 0===interpolationFunctions[s]?(console.warn("[AbstractTween.interpolations] Given interpolation does not exist"),t[n]=interpolationFunctions.linear):t[n]=interpolationFunctions[s]):t[n]=interpolationFunctions.linear}return this._interpolations=t,this},AbstractTween.prototype.from=function(t){return this._from=t,this._transitions.length>0&&(this._transitions[0].from=t),this},AbstractTween.prototype._setFrom=function(){this._from={};for(var t=0;t<this._properties.length;t+=1){var i=this._properties[t];this._from[i]=this._relative===!0?0:this._object[i]}return this._from},AbstractTween.prototype._getLastTransitionEnding=function(){return this._transitions.length>0?this._relative===!0?this._setFrom():this._transitions[this._transitions.length-1].to:null===this._from?this._setFrom():this._from},AbstractTween.prototype.to=function(t,i,n,s,e){"string"==typeof n&&(void 0===easingFunctions[n]?(console.warn("[AbstractTween.to] Given easing does not exist"),n=void 0):n=easingFunctions[n]);var r=this._getLastTransitionEnding(),o=this._relative===!0?TransitionRelative:Transition,a=new o(this._properties,r,t,this._duration,i,n,s,this._interpolations,e);return this._transitions.push(a),this._duration+=i,this},AbstractTween.prototype.wait=function(t){var i=this._getLastTransitionEnding();return this._transitions.push(new Temporisation(this._duration,t,i,this._properties)),this._duration+=t,this},AbstractTween.prototype._update=function(){for(var t=this._transitions[this._index];t.end<=this._time;){if(this._index===this._transitions.length-1)return void t.update(this._object,1);this._relative===!0&&t.update(this._object,1),t=this._transitions[++this._index]}for(;this._time<=t.start;){if(0===this._index)return void t.update(this._object,0);this._relative===!0&&t.update(this._object,0),t=this._transitions[--this._index]}t.update(this._object,(this._time-t.start)/t.duration)},AbstractTween.prototype._validate=function(){return 0===this._transitions.length?(console.warn("[AbstractTween._validate] Cannot start a tween with no transition:",this),!1):!0}; | ||
@@ -61,3 +61,3 @@ },{"./Transition":16,"./TransitionRelative":17,"./easing":20,"./interpolation":23}],2:[function(require,module,exports){ | ||
},{"./Player":9,"./TINA":12}],20:[function(require,module,exports){ | ||
var PI=Math.PI,PI_OVER_TWO=Math.PI/2,TWO_PI=2*Math.PI,EXP=2.718281828;exports.none=function(){return 1},exports.linear=function(t){return t},exports.flash=function(t,n){return t+t*n-t*t*n},exports.parabolic=function(t){var n=2*t-1;return 1-n*n},exports.trigo=function(t,n){return.5*(1-Math.cos(TWO_PI*t*n))},exports.elastic=function(t,n){if(1===t)return 1;n/=n+1;var r=(1+n)*Math.log(1-t)/Math.log(n);return Math.cos(r-PI_OVER_TWO)*Math.pow(n,r)},exports.quadIn=function(t){return t*t},exports.quadOut=function(t){return 2*t-t*t},exports.quadInOut=function(t){return.5>t?2*t*t:2*(2*t-t*t)-1},exports.cubicIn=function(t){return t*t*t},exports.cubicOut=function(t){return 3*t-3*t*t+t*t*t},exports.cubicInOut=function(t){return.5>t?4*t*t*t:4*(3*t-3*t*t+t*t*t)-3},exports.quarticIn=function(t){return t*t*t*t},exports.quarticOut=function(t){var n=t*t;return 4*t-6*n+4*n*t-n*n},exports.quarticOut=function(t){if(.5>t)return 8*t*t*t*t;var n=t*t;return 8*(4*t-6*n+4*n*t-n*n)-7},exports.polyIn=function(t,n){return Math.pow(t,n)},exports.polyOut=function(t,n){return 1-Math.pow(1-t,n)},exports.polyInOut=function(t,n){return.5>t?Math.pow(2*t,n)/2:(2-Math.pow(2*(1-t),n))/2},exports.sineIn=function(t){return 1-Math.cos(PI_OVER_TWO*t)},exports.sineOut=function(t){return Math.sin(PI_OVER_TWO*t)},exports.sineInOut=function(t){return.5>t?(1-Math.cos(PI*t))/2:(1+Math.sin(PI*(t-.5)))/2},exports.expIn=function(t,n){return(1-Math.pow(EXP,n*t))/(1-Math.pow(EXP,n))},exports.expOut=function(t,n){return(1-Math.pow(EXP,-n*t))/(1-Math.pow(EXP,-n))},exports.expInOut=function(t,n){return.5>t?(1-Math.pow(EXP,2*n*t))/(1-Math.pow(EXP,n))/2:.5+(1-Math.pow(EXP,n-2*n*t))/(1-Math.pow(EXP,-n))/2},exports.circIn=function(t){return 1-Math.sqrt(1-Math.pow(t,2))},exports.circOut=function(t){return Math.sqrt(1-Math.pow(1-t,2))},exports.circInOut=function(t){return.5>t?(1-Math.sqrt(1-4*t*t))/2:(1+Math.sqrt(-3+8*t-4*t*t))/2},exports.elasticIn=function(t,n){if(0===t)return 0;n/=n+1;var r=(1+n)*Math.log(t)/Math.log(n);return Math.cos(r)*Math.pow(n,r)},exports.elasticOut=function(t,n){if(1===t)return 1;n/=n+1;var r=(1+n)*Math.log(1-t)/Math.log(n);return 1-Math.cos(r)*Math.pow(n,r)},exports.elasticInOut=function(t,n){var r;return.5>t?0===t?0:(n/=n+1,r=(1+n)*Math.log(2*t)/Math.log(n),.5*Math.cos(r)*Math.pow(n,r)):1===t?1:(n/=n+1,r=(1+n)*Math.log(2-2*t)/Math.log(n),.5+.5*(1-Math.cos(r)*Math.pow(n,r)))},exports.bounceIn=function(t,n){if(0===t)return 0;n/=n+1;var r=(1+n)*Math.log(t)/Math.log(n);return Math.abs(Math.cos(r)*Math.pow(n,r))},exports.bounceOut=function(t,n){if(1===t)return 1;n/=n+1;var r=(1+n)*Math.log(1-t)/Math.log(n);return 1-Math.abs(Math.cos(r)*Math.pow(n,r))},exports.bounceInOut=function(t,n){var r;return.5>t?0===t?0:(n/=n+1,r=(1+n)*Math.log(2*t)/Math.log(n),Math.abs(.5*Math.cos(r)*Math.pow(n,r))):1===t?1:(n/=n+1,r=(1+n)*Math.log(2-2*t)/Math.log(n),.5+.5*(1-Math.abs(Math.cos(r)*Math.pow(n,r))))},exports.backIn=function(t,n){return t*t*((n+1)*t-n)},exports.backOut=function(t,n){return t-=1,t*t*((n+1)*t+n)+1},exports.backInOut=function(t,n){return.5>t?(t*=2,.5*(t*t*((n+1)*t-n))):(t=2*t-2,.5*(t*t*((n+1)*t+n))+1)}; | ||
var PI=Math.PI,PI_OVER_TWO=Math.PI/2,TWO_PI=2*Math.PI,EXP=2.718281828;exports.none=function(){return 1},exports.linear=function(t){return t},exports.flash=function(t,n){return t+t*n-t*t*n},exports.parabolic=function(t){var n=2*t-1;return 1-n*n},exports.trigo=function(t,n){return.5*(1-Math.cos(TWO_PI*t*n))},exports.elastic=function(t,n){if(1===t)return 1;n/=n+1;var r=(1+n)*Math.log(1-t)/Math.log(n);return Math.cos(r-PI_OVER_TWO)*Math.pow(n,r)},exports.quadIn=function(t){return t*t},exports.quadOut=function(t){return 2*t-t*t},exports.quadInOut=function(t){return.5>t?2*t*t:2*(2*t-t*t)-1},exports.cubicIn=function(t){return t*t*t},exports.cubicOut=function(t){return 3*t-3*t*t+t*t*t},exports.cubicInOut=function(t){return.5>t?4*t*t*t:4*(3*t-3*t*t+t*t*t)-3},exports.quarticIn=function(t){return t*t*t*t},exports.quarticOut=function(t){var n=t*t;return 4*t-6*n+4*n*t-n*n},exports.quarticInOut=function(t){if(.5>t)return 8*t*t*t*t;var n=t*t;return 8*(4*t-6*n+4*n*t-n*n)-7},exports.polyIn=function(t,n){return Math.pow(t,n)},exports.polyOut=function(t,n){return 1-Math.pow(1-t,n)},exports.polyInOut=function(t,n){return.5>t?Math.pow(2*t,n)/2:(2-Math.pow(2*(1-t),n))/2},exports.sineIn=function(t){return 1-Math.cos(PI_OVER_TWO*t)},exports.sineOut=function(t){return Math.sin(PI_OVER_TWO*t)},exports.sineInOut=function(t){return.5>t?(1-Math.cos(PI*t))/2:(1+Math.sin(PI*(t-.5)))/2},exports.expIn=function(t,n){return(1-Math.pow(EXP,n*t))/(1-Math.pow(EXP,n))},exports.expOut=function(t,n){return(1-Math.pow(EXP,-n*t))/(1-Math.pow(EXP,-n))},exports.expInOut=function(t,n){return.5>t?(1-Math.pow(EXP,2*n*t))/(1-Math.pow(EXP,n))/2:.5+(1-Math.pow(EXP,n-2*n*t))/(1-Math.pow(EXP,-n))/2},exports.circIn=function(t){return 1-Math.sqrt(1-Math.pow(t,2))},exports.circOut=function(t){return Math.sqrt(1-Math.pow(1-t,2))},exports.circInOut=function(t){return.5>t?(1-Math.sqrt(1-4*t*t))/2:(1+Math.sqrt(-3+8*t-4*t*t))/2},exports.elasticIn=function(t,n){if(0===t)return 0;n/=n+1;var r=(1+n)*Math.log(t)/Math.log(n);return Math.cos(r)*Math.pow(n,r)},exports.elasticOut=function(t,n){if(1===t)return 1;n/=n+1;var r=(1+n)*Math.log(1-t)/Math.log(n);return 1-Math.cos(r)*Math.pow(n,r)},exports.elasticInOut=function(t,n){var r;return.5>t?0===t?0:(n/=n+1,r=(1+n)*Math.log(2*t)/Math.log(n),.5*Math.cos(r)*Math.pow(n,r)):1===t?1:(n/=n+1,r=(1+n)*Math.log(2-2*t)/Math.log(n),.5+.5*(1-Math.cos(r)*Math.pow(n,r)))},exports.bounceIn=function(t,n){if(0===t)return 0;n/=n+1;var r=(1+n)*Math.log(t)/Math.log(n);return Math.abs(Math.cos(r)*Math.pow(n,r))},exports.bounceOut=function(t,n){if(1===t)return 1;n/=n+1;var r=(1+n)*Math.log(1-t)/Math.log(n);return 1-Math.abs(Math.cos(r)*Math.pow(n,r))},exports.bounceInOut=function(t,n){var r;return.5>t?0===t?0:(n/=n+1,r=(1+n)*Math.log(2*t)/Math.log(n),Math.abs(.5*Math.cos(r)*Math.pow(n,r))):1===t?1:(n/=n+1,r=(1+n)*Math.log(2-2*t)/Math.log(n),.5+.5*(1-Math.abs(Math.cos(r)*Math.pow(n,r))))},exports.backIn=function(t,n){return t*t*((n+1)*t-n)},exports.backOut=function(t,n){return t-=1,t*t*((n+1)*t+n)+1},exports.backInOut=function(t,n){return.5>t?(t*=2,.5*(t*t*((n+1)*t-n))):(t=2*t-2,.5*(t*t*((n+1)*t+n))+1)}; | ||
@@ -64,0 +64,0 @@ },{}],21:[function(require,module,exports){ |
{ | ||
"name": "tina", | ||
"version": "0.3.6", | ||
"version": "0.3.7", | ||
"description": "Tweening and INterpolations for Animation", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -136,3 +136,3 @@ var Transition = require('./Transition'); | ||
if (this._transitions.length > 0) { | ||
return this._transitions[this._transitions.length - 1].to; | ||
return (this._relative === true) ? this._setFrom() : this._transitions[this._transitions.length - 1].to; | ||
} else { | ||
@@ -187,3 +187,2 @@ return (this._from === null) ? this._setFrom() : this._from; | ||
var transition = this._transitions[this._index]; | ||
while (transition.end <= this._time) { | ||
@@ -195,2 +194,6 @@ if (this._index === (this._transitions.length - 1)) { | ||
if (this._relative === true ) { | ||
transition.update(this._object, 1); | ||
} | ||
transition = this._transitions[++this._index]; | ||
@@ -205,2 +208,6 @@ } | ||
if (this._relative === true ) { | ||
transition.update(this._object, 0); | ||
} | ||
transition = this._transitions[--this._index]; | ||
@@ -207,0 +214,0 @@ } |
@@ -107,3 +107,3 @@ /** | ||
exports.quarticOut = function (t) { | ||
exports.quarticInOut = function (t) { | ||
if (t < 0.5) { | ||
@@ -110,0 +110,0 @@ return 8 * t * t * t * t; |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
741269
8000