troika-animation
Advanced tools
Comparing version 0.38.0 to 0.39.0
@@ -6,2 +6,10 @@ # Change Log | ||
# [0.39.0](https://github.com/protectwise/troika/compare/v0.38.1...v0.39.0) (2021-02-15) | ||
**Note:** Version bump only for package troika-animation | ||
# [0.38.0](https://github.com/protectwise/troika/compare/v0.37.0...v0.38.0) (2021-01-24) | ||
@@ -8,0 +16,0 @@ |
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : | ||
typeof define === 'function' && define.amd ? define(['exports'], factory) : | ||
(global = global || self, factory(global.troika_animation = {})); | ||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.troika_animation = {})); | ||
}(this, (function (exports) { 'use strict'; | ||
@@ -6,0 +6,0 @@ |
@@ -1,7 +0,7 @@ | ||
'use strict';(function(e,p){"object"===typeof exports&&"undefined"!==typeof module?p(exports):"function"===typeof define&&define.amd?define(["exports"],p):(e=e||self,p(e.troika_animation={}))})(this,function(e){function p(a,b){return function(c){return.5>c?.5*a(2*c):.5*b(2*c-1)+.5}}function u(a){return function(b){return k(b,a)}}function v(a){return function(b){return 1-k(1-b,a)}}function w(a){return function(b){return.5>b?.5*k(2*b,a):.5*(1-k(1-(2*b-1),a))+.5}}function t(a,b,c){return a+(b-a)*c}function R(a, | ||
b){return a.totalElapsed-b.totalElapsed}function S(){}function T(a){return a.runner$running}function U(a){return!a.runner$stopped}function V(){var a=Date.now();q=null;x&&(r=r.filter(T),x=!1);if(r.length){for(var b=r.length;0<b--;)r[b]._tick(a);B()}}function B(){q||(q=y.requestAnimationFrame(V))}var k=Math.pow,C=Math.PI,G=Math.sqrt,H=C/2,W=2*C,z=u(2),D=v(2),l=w(2),n=u(3),X=v(3),Y=w(3),Z=u(4),aa=v(4),ba=w(4),ca=u(5),da=v(5),ea=w(5),I=function(a){return 1-G(1-a*a)},J=function(a){return G(1-k(a-1,2))}, | ||
fa=p(I,J),K=function(a){return 0===a||1===a?a:1-E(1-a)},E=function(a){return 0===a||1===a?a:Math.pow(2,-10*a)*Math.sin((a-.075)*W/.3)+1},ha=p(K,E),L=function(a){return 1-F(1-a)},F=function(a){return a<1/2.75?7.5625*a*a:a<2/2.75?7.5625*(a-=1.5/2.75)*a+.75:a<2.5/2.75?7.5625*(a-=2.25/2.75)*a+.9375:7.5625*(a-=2.625/2.75)*a+.984375},ia=p(L,F),M=Object.freeze({__proto__:null,linear:function(a){return a},easeInQuad:z,easeOutQuad:D,easeInOutQuad:l,easeInCubic:n,easeOutCubic:X,easeInOutCubic:Y,easeInQuart:Z, | ||
easeOutQuart:aa,easeInOutQuart:ba,easeInQuint:ca,easeOutQuint:da,easeInOutQuint:ea,easeInSine:function(a){return 1-Math.cos(a*H)},easeOutSine:function(a){return Math.sin(a*H)},easeInOutSine:function(a){return-.5*(Math.cos(C*a)-1)},easeInExpo:function(a){return 0===a?0:k(2,10*(a-1))},easeOutExpo:function(a){return 1===a?1:1-k(2,-10*a)},easeInOutExpo:function(a){return 0===a||1===a?a:.5>a?.5*k(2,10*(2*a-1)):.5*(1-k(2,-10*(2*a-1)))+.5},easeInCirc:I,easeOutCirc:J,easeInOutCirc:fa,easeInElastic:K,easeOutElastic:E, | ||
easeInOutElastic:ha,easeInBack:function(a){return a*a*(2.70158*a-1.70158)},easeOutBack:function(a){return--a*a*(2.70158*a+1.70158)+1},easeInOutBack:function(a){return 1>(a*=2)?.5*a*a*(3.5949095*a-2.5949095):.5*((a-=2)*a*(3.5949095*a+2.5949095)+2)},easeInBounce:L,easeOutBounce:F,easeInOutBounce:ia}),N=function(){var a,b,c=Object.create(null),f=0;return function(g){if("number"===typeof g)return g;if("string"===typeof g){if(g in c)return c[g];a||(a=document.createElement("canvas"),b=a.getContext("2d")); | ||
a.width=a.height=1;b.fillStyle=g;b.fillRect(0,0,1,1);var d=b.getImageData(0,0,1,1).data;d=d[0]<<16^d[1]<<8^d[2];2048<f&&(c=Object.create(null),f=0);c[g]=d;f++;return d}return g&&g.isColor?g.getHex():0}}(),O=Object.freeze({__proto__:null,number:t,color:function(a,b,c){a=N(a);b=N(b);var f=t(a>>16&255,b>>16&255,c),g=t(a>>8&255,b>>8&255,c);a=t(a&255,b&255,c);return f<<16^g<<8^a}});n=function(){};n.prototype.gotoElapsedTime=function(a){};n.prototype.gotoEnd=function(){};n.prototype.isDoneAtElapsedTime= | ||
'use strict';(function(e,p){"object"===typeof exports&&"undefined"!==typeof module?p(exports):"function"===typeof define&&define.amd?define(["exports"],p):(e="undefined"!==typeof globalThis?globalThis:e||self,p(e.troika_animation={}))})(this,function(e){function p(a,b){return function(c){return.5>c?.5*a(2*c):.5*b(2*c-1)+.5}}function u(a){return function(b){return k(b,a)}}function v(a){return function(b){return 1-k(1-b,a)}}function w(a){return function(b){return.5>b?.5*k(2*b,a):.5*(1-k(1-(2*b-1),a))+ | ||
.5}}function t(a,b,c){return a+(b-a)*c}function R(a,b){return a.totalElapsed-b.totalElapsed}function S(){}function T(a){return a.runner$running}function U(a){return!a.runner$stopped}function V(){var a=Date.now();q=null;x&&(r=r.filter(T),x=!1);if(r.length){for(var b=r.length;0<b--;)r[b]._tick(a);B()}}function B(){q||(q=y.requestAnimationFrame(V))}var k=Math.pow,C=Math.PI,G=Math.sqrt,H=C/2,W=2*C,z=u(2),D=v(2),l=w(2),n=u(3),X=v(3),Y=w(3),Z=u(4),aa=v(4),ba=w(4),ca=u(5),da=v(5),ea=w(5),I=function(a){return 1- | ||
G(1-a*a)},J=function(a){return G(1-k(a-1,2))},fa=p(I,J),K=function(a){return 0===a||1===a?a:1-E(1-a)},E=function(a){return 0===a||1===a?a:Math.pow(2,-10*a)*Math.sin((a-.075)*W/.3)+1},ha=p(K,E),L=function(a){return 1-F(1-a)},F=function(a){return a<1/2.75?7.5625*a*a:a<2/2.75?7.5625*(a-=1.5/2.75)*a+.75:a<2.5/2.75?7.5625*(a-=2.25/2.75)*a+.9375:7.5625*(a-=2.625/2.75)*a+.984375},ia=p(L,F),M=Object.freeze({__proto__:null,linear:function(a){return a},easeInQuad:z,easeOutQuad:D,easeInOutQuad:l,easeInCubic:n, | ||
easeOutCubic:X,easeInOutCubic:Y,easeInQuart:Z,easeOutQuart:aa,easeInOutQuart:ba,easeInQuint:ca,easeOutQuint:da,easeInOutQuint:ea,easeInSine:function(a){return 1-Math.cos(a*H)},easeOutSine:function(a){return Math.sin(a*H)},easeInOutSine:function(a){return-.5*(Math.cos(C*a)-1)},easeInExpo:function(a){return 0===a?0:k(2,10*(a-1))},easeOutExpo:function(a){return 1===a?1:1-k(2,-10*a)},easeInOutExpo:function(a){return 0===a||1===a?a:.5>a?.5*k(2,10*(2*a-1)):.5*(1-k(2,-10*(2*a-1)))+.5},easeInCirc:I,easeOutCirc:J, | ||
easeInOutCirc:fa,easeInElastic:K,easeOutElastic:E,easeInOutElastic:ha,easeInBack:function(a){return a*a*(2.70158*a-1.70158)},easeOutBack:function(a){return--a*a*(2.70158*a+1.70158)+1},easeInOutBack:function(a){return 1>(a*=2)?.5*a*a*(3.5949095*a-2.5949095):.5*((a-=2)*a*(3.5949095*a+2.5949095)+2)},easeInBounce:L,easeOutBounce:F,easeInOutBounce:ia}),N=function(){var a,b,c=Object.create(null),f=0;return function(g){if("number"===typeof g)return g;if("string"===typeof g){if(g in c)return c[g];a||(a=document.createElement("canvas"), | ||
b=a.getContext("2d"));a.width=a.height=1;b.fillStyle=g;b.fillRect(0,0,1,1);var d=b.getImageData(0,0,1,1).data;d=d[0]<<16^d[1]<<8^d[2];2048<f&&(c=Object.create(null),f=0);c[g]=d;f++;return d}return g&&g.isColor?g.getHex():0}}(),O=Object.freeze({__proto__:null,number:t,color:function(a,b,c){a=N(a);b=N(b);var f=t(a>>16&255,b>>16&255,c),g=t(a>>8&255,b>>8&255,c);a=t(a&255,b&255,c);return f<<16^g<<8^a}});n=function(){};n.prototype.gotoElapsedTime=function(a){};n.prototype.gotoEnd=function(){};n.prototype.isDoneAtElapsedTime= | ||
function(a){};var P=function(a){return a};z=function(a){function b(b,f,g,d,h,m,e,l,k){void 0===d&&(d=750);void 0===h&&(h=0);void 0===m&&(m=P);void 0===e&&(e=1);void 0===l&&(l="forward");void 0===k&&(k="number");a.call(this);this.callback=b;this.fromValue=f;this.toValue=g;this.duration=d;this.delay=h;this.easing="string"===typeof m?M[m]||P:m;this.iterations=e;this.direction=l;this.interpolate="function"===typeof k?k:O[k]||t;this.totalElapsed=9007199254740991>this.iterations?this.delay+this.duration* | ||
@@ -8,0 +8,0 @@ this.iterations:9007199254740991}a&&(b.__proto__=a);b.prototype=Object.create(a&&a.prototype);b.prototype.constructor=b;b.prototype.gotoElapsedTime=function(a){var b=this.duration,c=this.delay;if(a>=c){a=Math.min(a,this.totalElapsed)-c;c=a%b/b;0===c&&0!==a&&(c=1);c=this.easing(c);if("reverse"===this.direction||"alternate"===this.direction&&0===Math.ceil(a/b)%2)c=1-c;this.callback(this.interpolate(this.fromValue,this.toValue,c))}};b.prototype.gotoEnd=function(){this.gotoElapsedTime(this.totalElapsed)}; |
{ | ||
"name": "troika-animation", | ||
"version": "0.38.0", | ||
"version": "0.39.0", | ||
"description": "Troika Animation Utilities", | ||
@@ -16,3 +16,3 @@ "author": "Jason Johnston <jason.johnston@protectwise.com>", | ||
"module:src": "src/index.js", | ||
"gitHead": "d48144bf99a2eaf2089c0cd2a8065506161dfdf4" | ||
"gitHead": "8c276e7cf6580ebd57d3fee8b2575dac27667491" | ||
} |
@@ -123,4 +123,4 @@ # Troika Animation | ||
- `"number"` - simple linear interpolation between two numeric values (the default). | ||
- `"color"` - interprets the start/end values as RGB colors, and interpolates each color channel independently. | ||
- `"color"` - interprets the start/end values as RGB colors, and interpolates each color channel independently. The start/end values can be 24-bit integers or any CSS color string value, and the interpolated values will always be returned as 24-bit integers (8 bits red, 8 bits green, 8 bits blue.) | ||
If you need a different interpolation, you can provide a custom function. It takes three parameters: the start value, the end value, and the progress between them (the output of the easing function.) It must return an in-between value of the appropriate type. | ||
If you need a different interpolation, you can provide a custom function. Your function will take three parameters: the start value, the end value, and the progress between them (the output of the easing function) in the range from `0` to `1`. It must return an in-between value of the appropriate type. |
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
122338
2651