rxan-core
Version:
Core library for rxan (rxjs animation)
3 lines (2 loc) • 3.5 kB
JavaScript
import{Scheduler as n,animationFrameScheduler as r,defer as t,interval as e,concat as o}from"rxjs";import{map as u,takeWhile as i,take as a}from"rxjs/operators";var f=r,c=function(r){return function(t){if(!(t instanceof n))throw e=r.name,o="scheduler parameter for ".concat(e," is not an instance of Scheduler"),new TypeError(o);var e,o;return r(t)}},h=function(n){return function(n){return function(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:f;return n(r)}}(c(n))},s=function(n){return t((function(){var r=n.now();return e(0,n).pipe(u((function(){return n.now()-r})))}))},p=h(s),d=h((function(n){return function(r){if("number"!=typeof r)throw new TypeError("second argument (duration) of during should be a number");if(r<=0)throw new RangeError("second argument (duration) of during should be a positive number");return s(n).pipe(u((function(n){return n/r})),i((function(n){return n<1})),(function(n){return o(n,[1])}))}})),m=h((function(n){return function(r,t){if("number"!=typeof r)throw new TypeError("second argument (period) of periodOf should be a number");if(r<=0)throw new RangeError("second argument (period) of periodOf should be a positive number");if(t){if("number"!=typeof t)throw new TypeError("third argument (cycles) of periodOf should be undefined or a number");if(t<=0)throw new RangeError("third argument (cycles) of periodOf should be a positive number")}return t=t||Number.POSITIVE_INFINITY,e(r,n).pipe(u((function(n){return n+1})),a(t))}})),l=h((function(n){return function(r,t){if("number"!=typeof r)throw new TypeError("second argument (period) of toggle should be a number");if(r<=0)throw new RangeError("second argument (period) of toggle should be a positive number");if(t){if("number"!=typeof t)throw new TypeError("third argument (cycles) of toggle should be undefined or a number");if(t<=0)throw new RangeError("third argument (cycles) of toggle should be a positive number")}return t=t||Number.POSITIVE_INFINITY,e(r,n).pipe(u((function(n){return n%2==0})),a(t))}})),g=function(n){return function(r){if(r<0||r>1)throw t=n.name,e="input of ".concat(t," should be smaller than 1, and larger than 0"),new RangeError(e);var t,e;return n(r)}},b=function(n){if(!n.in||!n.out||!n.inout)throw new TypeError("input of withDomainChecker should have in, out, inout property.");var r=g(n);return r.in=g(n.in),r.out=g(n.out),r.inout=g(n.inout),r},w=function(n){return function(r){return 1-n(1-r)}},v=function(n){return function(r){return r<.5?n(2*r)/2:1-n(2*(1-r))/2}},E=function(n){return n};E.in=E,E.out=w(E),E.inout=v(E);var y=function(n){return n*n};y.in=y,y.out=w(y),y.inout=v(y);var I=function(n){return n*n*n};I.in=I,I.out=w(I),I.inout=v(I);var M=function(n){return 1-Math.cos(n*Math.PI/2)};M.in=M,M.out=function(n){return Math.sin(n*Math.PI/2)},M.inout=function(n){return(1-Math.cos(n*Math.PI))/2};var T=function(n){return 0===n?0:Math.pow(2,10*(n-1))};T.in=T,T.out=w(T),T.inout=v(T);var O=Math.PI,N=Math.pow,P=Math.sin,R=function(n){return 0===n?0:N(2,10*(n-1))*P(6.5*n*O)};R.in=R,R.out=w(R),R.inout=v(R);var _=function(n){return 1-Math.sqrt(1-n*n)};_.in=_,_.out=w(_),_.inout=v(_);var x=function(n){return n*n*(Math.E*n-Math.E+1)};x.in=x,x.out=w(x),x.inout=v(x);var j=b(E),S=b(y),k=b(I),q=b(M),F=b(T),V=b(R),Y=b(_),z=b(x),C=Object.freeze({__proto__:null,linear:j,quadratic:S,cubic:k,sine:q,exponential:F,elastic:V,circle:Y,back:z});export{d as during,C as easing,p as msElapsed,m as periodOf,l as toggle};
//# sourceMappingURL=index.esm.min.js.map