* Recursive functions found in `examples.js` and `css.js`. Now `Maximum call stack size exceeded` error is completely eliminated
* Further optimization for the Tween object constructor
This commit is contained in:
thednp 2016-10-12 06:44:42 +03:00
parent 35a4cdb8c0
commit 0b8d77c19b
23 changed files with 148 additions and 157 deletions

View file

@ -1,6 +1,6 @@
{
"name": "KUTE.js",
"version": "1.5.94",
"version": "1.5.95",
"homepage": "http://thednp.github.io/kute.js",
"authors": [
"thednp"

View file

@ -35,10 +35,11 @@ bm3.chain(bm4);
//callback functions
function onMarginTop() { var css = KUTE.gCS(box,'marginTop'); box.innerHTML = parseInt(css)+'px'+'<br>MARGIN'; }
function onMarginBottom() { var css = KUTE.gCS(box,'marginBottom'); box.innerHTML = 'MARGIN<br>'+parseInt(css)+'px'; }
function onPadding() { var css = KUTE.gCS(box,'paddingTop'); box.innerHTML = parseInt(css)+'px<br>PADDING'; }
function onMargin() { var css = KUTE.gCS(box,'marginTop'); box.innerHTML = 'MARGIN<br>'+parseInt(css)+'px'; }
function onMarginTop() { box.innerHTML = parseInt(box.style.marginTop)+'px'+'<br>MARGIN'; }
function onMarginBottom() { box.innerHTML = 'MARGIN<br>'+parseInt(box.style.marginBottom)+'px'; }
function onPadding() { box.innerHTML = parseInt(box.style.paddingTop)+'px<br>PADDING'; }
function onMargin() { box.innerHTML = 'MARGIN<br>'+parseInt(box.style.marginTop)+'px'; }
function onComplete() { box.innerHTML = 'BOX<br>&nbsp;MODEL&nbsp;'; }
btb.addEventListener('click', function(e){

View file

@ -132,10 +132,15 @@ bm3.chain(bm4);
//callback functions
function onWidth() { var css = box.currentStyle || window.getComputedStyle(box); box.innerHTML = 'WIDTH<br>'+parseInt(css.width)+'px'; }
function onHeight() { var css = box.currentStyle || window.getComputedStyle(box); box.innerHTML = 'HEIGHT<br>'+parseInt(css.height)+'px'; }
function onLeft() { var css = box.currentStyle || window.getComputedStyle(box); box.innerHTML = 'LEFT<br>'+parseInt(css.left)+'px'; }
function onTop() { var css = box.currentStyle || window.getComputedStyle(box); box.innerHTML = 'TOP<br>'+parseInt(css.top)+'px'; }
// function onWidth() { var css = box.currentStyle || window.getComputedStyle(box); box.innerHTML = 'WIDTH<br>'+parseInt(css.width)+'px'; }
// function onHeight() { var css = box.currentStyle || window.getComputedStyle(box); box.innerHTML = 'HEIGHT<br>'+parseInt(css.height)+'px'; }
// function onLeft() { var css = box.currentStyle || window.getComputedStyle(box); box.innerHTML = 'LEFT<br>'+parseInt(css.left)+'px'; }
// function onTop() { var css = box.currentStyle || window.getComputedStyle(box); box.innerHTML = 'TOP<br>'+parseInt(css.top)+'px'; }
function onWidth() { box.innerHTML = 'WIDTH<br>'+parseInt(box.offsetWidth)+'px'; }
function onHeight() { box.innerHTML = 'HEIGHT<br>'+parseInt(box.offsetWidth)+'px'; }
function onLeft() { box.innerHTML = 'LEFT<br>'+parseInt(box.offsetLeft)+'px'; }
function onTop() { box.innerHTML = 'TOP<br>'+parseInt(box.offsetTop)+'px'; }
function onComplete() { box.innerHTML = 'BOX<br>MODEL'; }
btb.addEventListener('click', function(e){

View file

@ -1,2 +1,2 @@
// KUTE.js v1.5.94 | © dnp_theme | Attributes Plugin | MIT-License
// KUTE.js v1.5.95 | © dnp_theme | Attributes Plugin | MIT-License
!function(t,e){if("function"==typeof define&&define.amd)define(["kute.js"],e);else if("object"==typeof module&&"function"==typeof require)module.exports=e(require("kute.js"));else{if("undefined"==typeof t.KUTE)throw new Error("Attributes Plugin require KUTE.js.");e(t.KUTE)}}(this,function(t){"use strict";var e,r="undefined"!=typeof global?global:window,n=t,i=r.dom,o=n.prS,u=n.pp,a=r.Interpolate.unit,f=r.Interpolate.number,s=r.Interpolate.color,c=function(t,e){return t.getAttribute(e)},l=["fill","stroke","stop-color"],p=n.truC,d=n.truD,v=function(t){return t.replace(/[A-Z]/g,"-$&").toLowerCase()};o.attr=function(t,e,r){var n={};for(var i in r){var o=v(i).replace(/_+[a-z]+/,""),u=c(t,o);n[o]=l.indexOf(v(i))!==-1?u||"rgba(0,0,0,0)":u||(/opacity/i.test(i)?1:0)}return n},u.attr=function(t,r,n){"attr"in i||(i.attr=function(t,e,r,n,o){for(var u in n)i.attributes[u](t,u,r[u],n[u],o)},e=i.attributes={});var o,u={};for(o in r){var b=v(o),g=c(n,b.replace(/_+[a-z]+/,""));if(l.indexOf(b)===-1&&(/(%|[a-z]+)$/.test(r[o])||/(%|[a-z]+)$/.test(g))){var y=d(g).u||d(r[o]).u,A=/%/.test(y)?"_percent":"_"+y;o+A in e||(e[o+A]=function(t,e,r,n,i){var o=o||v(e).replace(A,"");t.setAttribute(o,a(r.v,n.v,n.u,i))}),u[o+A]=d(r[o])}else l.indexOf(b)>-1?(o in e||(e[o]=function(t,e,n,i,o){var u=u||v(e);t.setAttribute(u,s(n,i,o,r.keepHex))}),u[o]=p(r[o])):(o in e||(e[o]=function(t,e,r,n,i){var o=o||v(e);t.setAttribute(o,f(r,n,i))}),u[o]=parseFloat(r[o]))}return u}});

View file

@ -1,2 +1,2 @@
// KUTE.js v1.5.94 | © dnp_theme | Bezier Plugin | MIT-License
// KUTE.js v1.5.95 | © dnp_theme | Bezier Plugin | MIT-License
!function(n,e){if("function"==typeof define&&define.amd)define(["kute.js"],e);else if("object"==typeof module&&"function"==typeof require)module.exports=e(require("kute.js"));else{if("undefined"==typeof n.KUTE)throw new Error("Bezier Easing functions depend on KUTE.js");n.Ease=e(n.KUTE)}}(this,function(n){"use strict";var e="undefined"!=typeof global?global:window,t={};t.Bezier=e.Bezier=function(n,e,t,u){return r.pB(n,e,t,u)};var r=t.Bezier.prototype=e.Bezier.prototype;return r.ni=4,r.nms=.001,r.sp=1e-7,r.smi=10,r.ksts=11,r.ksss=1/(r.ksts-1),r.f32as="Float32Array"in e,r.msv=r.f32as?new Float32Array(r.ksts):new Array(r.ksts),r.A=function(n,e){return 1-3*e+3*n},r.B=function(n,e){return 3*e-6*n},r.C=function(n){return 3*n},r.pB=function(n,e,t,u){this._p=!1;var s=this;return function(a){return s._p||r.pc(n,t,e,u),n===e&&t===u?a:0===a?0:1===a?1:r.cB(r.gx(a,n,t),e,u)}},r.cB=function(n,e,t){return((r.A(e,t)*n+r.B(e,t))*n+r.C(e))*n},r.gS=function(n,e,t){return 3*r.A(e,t)*n*n+2*r.B(e,t)*n+r.C(e)},r.bS=function(n,e,t,u,s){var a,i,o=0,c=r.sp,f=r.smi;do i=e+(t-e)/2,a=r.cB(i,u,s)-n,a>0?t=i:e=i;while(Math.abs(a)>c&&++o<f);return i},r.nri=function(n,e,t,u){var s=0,a=r.ni;for(s;s<a;++s){var i=r.gS(e,t,u);if(0===i)return e;var o=r.cB(e,t,u)-n;e-=o/i}return e},r.csv=function(n,e){var t=0,u=r.ksts;for(t;t<u;++t)r.msv[t]=r.cB(t*r.ksss,n,e)},r.gx=function(n,e,t){for(var u=0,s=1,a=r.ksts-1;s!=a&&r.msv[s]<=n;++s)u+=r.ksss;--s;var i=(n-r.msv[s])/(r.msv[s+1]-r.msv[s]),o=u+i*r.ksss,c=r.gS(o,e,t),f=u+r.ksss;return c>=r.nms?r.nri(n,o,e,t):0===c?o:r.bS(n,u,f,e,t)},r.pc=function(n,e,t,u){this._p=!0,n==t&&e==u||r.csv(n,e)},e.Ease={},e.Ease.easeIn=function(){return r.pB(.42,0,1,1)},e.Ease.easeOut=function(){return r.pB(0,0,.58,1)},e.Ease.easeInOut=function(){return r.pB(.5,.16,.49,.86)},e.Ease.easeInSine=function(){return r.pB(.47,0,.745,.715)},e.Ease.easeOutSine=function(){return r.pB(.39,.575,.565,1)},e.Ease.easeInOutSine=function(){return r.pB(.445,.05,.55,.95)},e.Ease.easeInQuad=function(){return r.pB(.55,.085,.68,.53)},e.Ease.easeOutQuad=function(){return r.pB(.25,.46,.45,.94)},e.Ease.easeInOutQuad=function(){return r.pB(.455,.03,.515,.955)},e.Ease.easeInCubic=function(){return r.pB(.55,.055,.675,.19)},e.Ease.easeOutCubic=function(){return r.pB(.215,.61,.355,1)},e.Ease.easeInOutCubic=function(){return r.pB(.645,.045,.355,1)},e.Ease.easeInQuart=function(){return r.pB(.895,.03,.685,.22)},e.Ease.easeOutQuart=function(){return r.pB(.165,.84,.44,1)},e.Ease.easeInOutQuart=function(){return r.pB(.77,0,.175,1)},e.Ease.easeInQuint=function(){return r.pB(.755,.05,.855,.06)},e.Ease.easeOutQuint=function(){return r.pB(.23,1,.32,1)},e.Ease.easeInOutQuint=function(){return r.pB(.86,0,.07,1)},e.Ease.easeInExpo=function(){return r.pB(.95,.05,.795,.035)},e.Ease.easeOutExpo=function(){return r.pB(.19,1,.22,1)},e.Ease.easeInOutExpo=function(){return r.pB(1,0,0,1)},e.Ease.easeInCirc=function(){return r.pB(.6,.04,.98,.335)},e.Ease.easeOutCirc=function(){return r.pB(.075,.82,.165,1)},e.Ease.easeInOutCirc=function(){return r.pB(.785,.135,.15,.86)},e.Ease.easeInBack=function(){return r.pB(.6,-.28,.735,.045)},e.Ease.easeOutBack=function(){return r.pB(.175,.885,.32,1.275)},e.Ease.easeInOutBack=function(){return r.pB(.68,-.55,.265,1.55)},e.Ease.slowMo=function(){return r.pB(0,.5,1,.5)},e.Ease.slowMo1=function(){return r.pB(0,.7,1,.3)},e.Ease.slowMo2=function(){return r.pB(0,.9,1,.1)},t});

View file

@ -1,2 +1,2 @@
// KUTE.js v1.5.94 | © dnp_theme | CSS Plugin | MIT-License
// KUTE.js v1.5.95 | © dnp_theme | CSS Plugin | MIT-License
!function(t,r){if("function"==typeof define&&define.amd)define(["kute.js"],r);else if("object"==typeof module&&"function"==typeof require)module.exports=r(require("kute.js"));else{if("undefined"==typeof t.KUTE)throw new Error("CSS Plugin require KUTE.js.");r(t.KUTE)}}(this,function(t){"use strict";for(var r="undefined"!=typeof global?global:window,o=t,e=r.dom,i=o.pp,n=o.prS,d=o.gCS,u=o.truD,a=o.property("borderRadius"),f=o.property("borderTopLeftRadius"),p=o.property("borderTopRightRadius"),g=o.property("borderBottomLeftRadius"),l=o.property("borderBottomRightRadius"),c=["borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor","outlineColor"],s=["borderRadius","borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"],b=["right","bottom","minWidth","minHeight","maxWidth","maxHeight","padding","margin","paddingTop","paddingBottom","paddingLeft","paddingRight","marginTop","marginBottom","marginLeft","marginRight","borderWidth","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","outlineWidth"],h=["fontSize","lineHeight","letterSpacing","wordSpacing"],v=["clip"],m=["backgroundPosition"],R=s.concat(b,h),y=c.concat(v,s,b,h,m),T=y.length,x=(r.Interpolate.number,r.Interpolate.unit),B=B||{},L=0;L<T;L++){var C=y[L];c.indexOf(C)!==-1?B[C]="rgba(0,0,0,0)":R.indexOf(C)!==-1?B[C]=0:m.indexOf(C)!==-1?B[C]=[50,50]:"clip"===C&&(B[C]=[0,0,0,0])}for(var L=0,W=c.length;L<W;L++)C=c[L],i[C]=function(t,r){return i.cls(t,r)},n[C]=function(t,r,o){return d(t,r)||B[r]};for(var L=0,W=R.length;L<W;L++)C=R[L],i[C]=function(t,r){return i.box(t,r)},n[C]=function(t,r,o){return d(t,r)||B[r]};for(var L=0,W=s.length;L<W;L++)C=s[L],i[C]=function(t,r){return t in e||("borderRadius"===t?e[t]=function(t,r,o,e,i){t.style[a]=x(o.v,e.v,e.u,i)}:"borderTopLeftRadius"===t?e[t]=function(t,r,o,e,i){t.style[f]=x(o.v,e.v,e.u,i)}:"borderTopRightRadius"===t?e[t]=function(t,r,o,e,i){t.style[p]=x(o.v,e.v,e.u,i)}:"borderBottomLeftRadius"===t?e[t]=function(t,r,o,e,i){t.style[g]=x(o.v,e.v,e.u,i)}:"borderBottomRightRadius"===t&&(e[t]=function(t,r,o,e,i){t.style[l]=x(o.v,e.v,e.u,i)})),u(r)},n[C]=function(t,r,o){return d(t,r)||B[r]};return i.clip=function(t,r){if(t in e||(e[t]=function(t,r,o,e,i){var n=0,d=[];for(n;n<4;n++){var u=o[n].v,a=e[n].v,f=e[n].u||"px";d[n]=x(u,a,f,i)}t.style[r]="rect("+d+")"}),r instanceof Array)return[u(r[0]),u(r[1]),u(r[2]),u(r[3])];var o=r.replace(/rect|\(|\)/g,"");return o=/\,/g.test(o)?o.split(/\,/g):o.split(/\s/g),[u(o[0]),u(o[1]),u(o[2]),u(o[3])]},n.clip=function(t,r,o){var e=d(t,r),i=d(t,"width"),n=d(t,"height");return/rect/.test(e)?e:[0,i,n,0]},i.backgroundPosition=function(t,r){if(t in e||(e[t]=function(t,r,o,e,i){t.style[r]=x(o.x.v,e.x.v,"%",i)+" "+x(o.y.v,e.y.v,"%",i)}),r instanceof Array)return{x:u(r[0])||{v:50,u:"%"},y:u(r[1])||{v:50,u:"%"}};var o,i,n=r.replace(/top|left/g,0).replace(/right|bottom/g,100).replace(/center|middle/g,50);return n=/\,/g.test(n)?n.split(/\,/g):n.split(/\s/g),n=2===n.length?n:[n[0],50],o=u(n[0]),i=u(n[1]),{x:o,y:i}},n.backgroundPosition=function(t,r,o){return d(t,r)||B[r]},this});

View file

@ -1,2 +1,2 @@
// KUTE.js v1.5.94 | © dnp_theme | jQuery Plugin | MIT-License
// KUTE.js v1.5.95 | © dnp_theme | jQuery Plugin | MIT-License
!function(e,t){if("function"==typeof define&&define.amd)define(["./kute.js","jquery"],function(e,n){return t(n,e),e});else if("object"==typeof module&&"function"==typeof require){var n=require("./kute.js"),r=require("jquery");module.exports=t(r,n)}else{if("undefined"==typeof e.KUTE||"undefined"==typeof e.$&&"undefined"==typeof e.jQuery)throw new Error("jQuery Plugin for KUTE.js depend on KUTE.js and jQuery");var r=e.jQuery||e.$,n=e.KUTE;r.fn.KUTE=t(r,n)}}(this,function(e,t){"use strict";return e.fn.fromTo=function(e,n,r){var i=this.length>1?this:this[0],o=this.length>1?"allFromTo":"fromTo";return t[o](i,e,n,r)},e.fn.to=function(e,n){var r=this.length>1?this:this[0],i=this.length>1?"allTo":"to";return t[i](r,e,n)},this});

View file

@ -1,2 +1,2 @@
// KUTE.js v1.5.94 | © dnp_theme | Physics Plugin | MIT-License
// KUTE.js v1.5.95 | © dnp_theme | Physics Plugin | MIT-License
!function(t,n){if("function"==typeof define&&define.amd)define(["kute.js"],n);else if("object"==typeof module&&"function"==typeof require)module.exports=n(require("kute.js"));else{if("undefined"==typeof t.KUTE)throw new Error("Physics Easing functions for KUTE.js depend on KUTE.js");t.Physics=n(t.KUTE)}}(this,function(t){"use strict";var n="undefined"!=typeof global?global:window,r={};r.spring=n.spring=function(t){t=t||{};var n=Math.max(1,(t.frequency||300)/20),r=Math.pow(20,(t.friction||200)/100),e=t.anticipationStrength||0,o=(t.anticipationSize||0)/1e3;return function(t){var u,a,c,p,f,y,s,h;return y=t/(1-o)-o/(1-o),t<o?(h=o/(1-o)-o/(1-o),s=0/(1-o)-o/(1-o),f=Math.acos(1/i.A1(t,h)),c=(Math.acos(1/i.A1(t,s))-f)/(n*-o),u=i.A1):(u=i.A2,f=0,c=1),a=u(y,o,e,r),p=n*(t-o)*c+f,1-a*Math.cos(p)}};var i=r.spring.prototype=n.spring.prototype;i.A1=function(t,n,r){var i,e,o,u;return o=n/(1-n),u=0,e=(o-.8*u)/(o-u),i=(.8-e)/o,i*t*r/100+e},i.A2=function(t,n,r,i){return Math.pow(i/10,-t)*(1-t)},r.bounce=n.bounce=function(t){t=t||{};var n=Math.max(1,(t.frequency||300)/20),r=Math.pow(20,(t.friction||200)/100);return function(t){var i=Math.pow(r/10,-t)*(1-t),e=n*t*1+Math.PI/2;return i*Math.cos(e)}},r.gravity=n.gravity=function(t){var n,r,i,o,u,a;return t=t||{},n=(t.bounciness||400)/1250,i=(t.elasticity||200)/1e3,u=t.initialForce||!1,o=100,r=[],a=function(){var t,r;for(t=Math.sqrt(2/o),r={a:-t,b:t,H:1},u&&(r.a=0,r.b=2*r.b);r.H>.001;)a=r.b-r.a,r={a:r.b,b:r.b+a*n,H:r.H*n*n};return r.b}(),function(){var t,e,c,p;for(e=Math.sqrt(2/(o*a*a)),c={a:-e,b:e,H:1},u&&(c.a=0,c.b=2*c.b),r.push(c),t=a,p=[];c.b<1&&c.H>.001;)t=c.b-c.a,c={a:c.b,b:c.b+t*n,H:c.H*i},p.push(r.push(c));return p}(),function(n){var i,o,c;for(o=0,i=r[o];!(n>=i.a&&n<=i.b)&&(o+=1,i=r[o]););return c=i?e.getPointInCurve(i.a,i.b,i.H,n,t,a):u?0:1}};var e=r.gravity.prototype=n.gravity.prototype;e.getPointInCurve=function(t,n,r,i,e,o){var u,a;return o=n-t,a=2/o*i-1-2*t/o,u=a*a*r-r+1,e.initialForce&&(u=1-u),u},r.forceWithGravity=n.forceWithGravity=function(t){var n=t||{};return n.initialForce=!0,r.gravity(n)},r.bezier=n.BezierMultiPoint=function(t){t=t||{};var n=t.points,r=!1,i=[];return function(){var t,r;for(t in n){if(r=parseInt(t),r>=n.length-1)break;o.fn(n[r],n[r+1],i)}return i}(),function(t){return 0===t?0:1===t?1:o.yForX(t,i,r)}};var o=r.bezier.prototype=n.BezierMultiPoint.prototype;return o.fn=function(t,n,r){var i=function(r){return o.Bezier(r,t,t.cp[t.cp.length-1],n.cp[0],n)};return r.push(i)},o.Bezier=function(t,n,r,i,e){return{x:Math.pow(1-t,3)*n.x+3*Math.pow(1-t,2)*t*r.x+3*(1-t)*Math.pow(t,2)*i.x+Math.pow(t,3)*e.x,y:Math.pow(1-t,3)*n.y+3*Math.pow(1-t,2)*t*r.y+3*(1-t)*Math.pow(t,2)*i.y+Math.pow(t,3)*e.y}},o.yForX=function(t,n,r){var i,e,o,u,a,c,p,f,y=0,s=n.length;for(i=null,y;y<s&&(e=n[y],t>=e(0).x&&t<=e(1).x&&(i=e),null===i);y++);if(!i)return r?0:1;for(f=1e-4,u=0,c=1,a=(c+u)/2,p=i(a).x,o=0;Math.abs(t-p)>f&&o<100;)t>p?u=a:c=a,a=(c+u)/2,p=i(a).x,o++;return i(a).y},n.Physics={physicsInOut:function(t){var r;return t=t||{},r=t.friction||200,n.BezierMultiPoint({points:[{x:0,y:0,cp:[{x:.92-r/1e3,y:0}]},{x:1,y:1,cp:[{x:.08+r/1e3,y:1}]}]})},physicsIn:function(t){var r;return t=t||{},r=t.friction||200,n.BezierMultiPoint({points:[{x:0,y:0,cp:[{x:.92-r/1e3,y:0}]},{x:1,y:1,cp:[{x:1,y:1}]}]})},physicsOut:function(t){var r;return t=t||{},r=t.friction||200,n.BezierMultiPoint({points:[{x:0,y:0,cp:[{x:0,y:0}]},{x:1,y:1,cp:[{x:.08+r/1e3,y:1}]}]})},physicsBackOut:function(t){var r;return t=t||{},r=t.friction||200,n.BezierMultiPoint({points:[{x:0,y:0,cp:[{x:0,y:0}]},{x:1,y:1,cp:[{x:.735+r/1e3,y:1.3}]}]})},physicsBackIn:function(t){var r;return t=t||{},r=t.friction||200,n.BezierMultiPoint({points:[{x:0,y:0,cp:[{x:.28-r/1e3,y:-.6}]},{x:1,y:1,cp:[{x:1,y:1}]}]})},physicsBackInOut:function(t){var r;return t=t||{},r=t.friction||200,n.BezierMultiPoint({points:[{x:0,y:0,cp:[{x:.68-r/1e3,y:-.55}]},{x:1,y:1,cp:[{x:.265+r/1e3,y:1.45}]}]})}},r});

File diff suppressed because one or more lines are too long

View file

@ -1,2 +1,2 @@
// KUTE.js v1.5.94 | © dnp_theme | Text Plugin | MIT-License
// KUTE.js v1.5.95 | © dnp_theme | Text Plugin | MIT-License
!function(t,e){if("function"==typeof define&&define.amd)define(["kute.js"],e);else if("object"==typeof module&&"function"==typeof require)module.exports=e(require("kute.js"));else{if("undefined"==typeof t.KUTE)throw new Error("Text-Plugin require KUTE.js.");e(t.KUTE)}}(this,function(t){"use strict";var e="undefined"!=typeof global?global:window,n=t,r=e.dom,i=n.prS,u=n.pp,s=e.Interpolate.number,o=String("abcdefghijklmnopqrstuvwxyz").split(""),a=String("abcdefghijklmnopqrstuvwxyz".toUpperCase()).split(""),l=String("~!@#$%^&*()_+{}[];'<>,./?=-").split(""),f=String("0123456789").split(""),p=o.concat(a,f),h=(p.concat(l),Math.random),c=Math.floor,g=Math.min;return i.text=i.number=function(t,e,n){return t.innerHTML},u.text=function(t,e,n){return"text"in r||(r.text=function(t,e,n,r,i,u){var s=s||"alpha"===u.textChars?o:"upper"===u.textChars?a:"numeric"===u.textChars?f:"alphanumeric"===u.textChars?p:"symbols"===u.textChars?l:u.textChars?u.textChars.split(""):o,m=s.length,b=s[c(h()*m)],d="",x="",y=n.substring(0),C=r.substring(0);d=""!==n?y.substring(y.length,c(g(i*y.length,y.length))):"",x=C.substring(0,c(g(i*C.length,C.length))),t.innerHTML=i<1?x+b+d:r}),e},u.number=function(t,e,n){return"number"in r||(r.number=function(t,e,n,r,i){t.innerHTML=parseInt(s(n,r,i))}),parseInt(e)||0},this});

File diff suppressed because one or more lines are too long

View file

@ -1,2 +1,2 @@
// KUTE.js v1.5.94 | © dnp_theme | Attributes Plugin | MIT-License
// KUTE.js v1.5.95 | © dnp_theme | Attributes Plugin | MIT-License
!function(t,e){if("function"==typeof define&&define.amd)define(["kute.js"],e);else if("object"==typeof module&&"function"==typeof require)module.exports=e(require("kute.js"));else{if("undefined"==typeof t.KUTE)throw new Error("Attributes Plugin require KUTE.js.");e(t.KUTE)}}(this,function(t){"use strict";var e,r="undefined"!=typeof global?global:window,n=t,i=r.dom,o=n.prS,u=n.pp,a=r.Interpolate.unit,f=r.Interpolate.number,s=r.Interpolate.color,c=function(t,e){return t.getAttribute(e)},l=["fill","stroke","stop-color"],p=n.truC,d=n.truD,v=function(t){return t.replace(/[A-Z]/g,"-$&").toLowerCase()};o.attr=function(t,e,r){var n={};for(var i in r){var o=v(i).replace(/_+[a-z]+/,""),u=c(t,o);n[o]=l.indexOf(v(i))!==-1?u||"rgba(0,0,0,0)":u||(/opacity/i.test(i)?1:0)}return n},u.attr=function(t,r,n){"attr"in i||(i.attr=function(t,e,r,n,o){for(var u in n)i.attributes[u](t,u,r[u],n[u],o)},e=i.attributes={});var o,u={};for(o in r){var b=v(o),g=c(n,b.replace(/_+[a-z]+/,""));if(l.indexOf(b)===-1&&(/(%|[a-z]+)$/.test(r[o])||/(%|[a-z]+)$/.test(g))){var y=d(g).u||d(r[o]).u,A=/%/.test(y)?"_percent":"_"+y;o+A in e||(e[o+A]=function(t,e,r,n,i){var o=o||v(e).replace(A,"");t.setAttribute(o,a(r.v,n.v,n.u,i))}),u[o+A]=d(r[o])}else l.indexOf(b)>-1?(o in e||(e[o]=function(t,e,n,i,o){var u=u||v(e);t.setAttribute(u,s(n,i,o,r.keepHex))}),u[o]=p(r[o])):(o in e||(e[o]=function(t,e,r,n,i){var o=o||v(e);t.setAttribute(o,f(r,n,i))}),u[o]=parseFloat(r[o]))}return u}});

View file

@ -1,2 +1,2 @@
// KUTE.js v1.5.94 | © dnp_theme | Bezier Plugin | MIT-License
// KUTE.js v1.5.95 | © dnp_theme | Bezier Plugin | MIT-License
!function(n,e){if("function"==typeof define&&define.amd)define(["kute.js"],e);else if("object"==typeof module&&"function"==typeof require)module.exports=e(require("kute.js"));else{if("undefined"==typeof n.KUTE)throw new Error("Bezier Easing functions depend on KUTE.js");n.Ease=e(n.KUTE)}}(this,function(n){"use strict";var e="undefined"!=typeof global?global:window,t={};t.Bezier=e.Bezier=function(n,e,t,u){return r.pB(n,e,t,u)};var r=t.Bezier.prototype=e.Bezier.prototype;return r.ni=4,r.nms=.001,r.sp=1e-7,r.smi=10,r.ksts=11,r.ksss=1/(r.ksts-1),r.f32as="Float32Array"in e,r.msv=r.f32as?new Float32Array(r.ksts):new Array(r.ksts),r.A=function(n,e){return 1-3*e+3*n},r.B=function(n,e){return 3*e-6*n},r.C=function(n){return 3*n},r.pB=function(n,e,t,u){this._p=!1;var s=this;return function(a){return s._p||r.pc(n,t,e,u),n===e&&t===u?a:0===a?0:1===a?1:r.cB(r.gx(a,n,t),e,u)}},r.cB=function(n,e,t){return((r.A(e,t)*n+r.B(e,t))*n+r.C(e))*n},r.gS=function(n,e,t){return 3*r.A(e,t)*n*n+2*r.B(e,t)*n+r.C(e)},r.bS=function(n,e,t,u,s){var a,i,o=0,c=r.sp,f=r.smi;do i=e+(t-e)/2,a=r.cB(i,u,s)-n,a>0?t=i:e=i;while(Math.abs(a)>c&&++o<f);return i},r.nri=function(n,e,t,u){var s=0,a=r.ni;for(s;s<a;++s){var i=r.gS(e,t,u);if(0===i)return e;var o=r.cB(e,t,u)-n;e-=o/i}return e},r.csv=function(n,e){var t=0,u=r.ksts;for(t;t<u;++t)r.msv[t]=r.cB(t*r.ksss,n,e)},r.gx=function(n,e,t){for(var u=0,s=1,a=r.ksts-1;s!=a&&r.msv[s]<=n;++s)u+=r.ksss;--s;var i=(n-r.msv[s])/(r.msv[s+1]-r.msv[s]),o=u+i*r.ksss,c=r.gS(o,e,t),f=u+r.ksss;return c>=r.nms?r.nri(n,o,e,t):0===c?o:r.bS(n,u,f,e,t)},r.pc=function(n,e,t,u){this._p=!0,n==t&&e==u||r.csv(n,e)},e.Ease={},e.Ease.easeIn=function(){return r.pB(.42,0,1,1)},e.Ease.easeOut=function(){return r.pB(0,0,.58,1)},e.Ease.easeInOut=function(){return r.pB(.5,.16,.49,.86)},e.Ease.easeInSine=function(){return r.pB(.47,0,.745,.715)},e.Ease.easeOutSine=function(){return r.pB(.39,.575,.565,1)},e.Ease.easeInOutSine=function(){return r.pB(.445,.05,.55,.95)},e.Ease.easeInQuad=function(){return r.pB(.55,.085,.68,.53)},e.Ease.easeOutQuad=function(){return r.pB(.25,.46,.45,.94)},e.Ease.easeInOutQuad=function(){return r.pB(.455,.03,.515,.955)},e.Ease.easeInCubic=function(){return r.pB(.55,.055,.675,.19)},e.Ease.easeOutCubic=function(){return r.pB(.215,.61,.355,1)},e.Ease.easeInOutCubic=function(){return r.pB(.645,.045,.355,1)},e.Ease.easeInQuart=function(){return r.pB(.895,.03,.685,.22)},e.Ease.easeOutQuart=function(){return r.pB(.165,.84,.44,1)},e.Ease.easeInOutQuart=function(){return r.pB(.77,0,.175,1)},e.Ease.easeInQuint=function(){return r.pB(.755,.05,.855,.06)},e.Ease.easeOutQuint=function(){return r.pB(.23,1,.32,1)},e.Ease.easeInOutQuint=function(){return r.pB(.86,0,.07,1)},e.Ease.easeInExpo=function(){return r.pB(.95,.05,.795,.035)},e.Ease.easeOutExpo=function(){return r.pB(.19,1,.22,1)},e.Ease.easeInOutExpo=function(){return r.pB(1,0,0,1)},e.Ease.easeInCirc=function(){return r.pB(.6,.04,.98,.335)},e.Ease.easeOutCirc=function(){return r.pB(.075,.82,.165,1)},e.Ease.easeInOutCirc=function(){return r.pB(.785,.135,.15,.86)},e.Ease.easeInBack=function(){return r.pB(.6,-.28,.735,.045)},e.Ease.easeOutBack=function(){return r.pB(.175,.885,.32,1.275)},e.Ease.easeInOutBack=function(){return r.pB(.68,-.55,.265,1.55)},e.Ease.slowMo=function(){return r.pB(0,.5,1,.5)},e.Ease.slowMo1=function(){return r.pB(0,.7,1,.3)},e.Ease.slowMo2=function(){return r.pB(0,.9,1,.1)},t});

View file

@ -1,2 +1,2 @@
// KUTE.js v1.5.94 | © dnp_theme | CSS Plugin | MIT-License
// KUTE.js v1.5.95 | © dnp_theme | CSS Plugin | MIT-License
!function(t,r){if("function"==typeof define&&define.amd)define(["kute.js"],r);else if("object"==typeof module&&"function"==typeof require)module.exports=r(require("kute.js"));else{if("undefined"==typeof t.KUTE)throw new Error("CSS Plugin require KUTE.js.");r(t.KUTE)}}(this,function(t){"use strict";for(var r="undefined"!=typeof global?global:window,o=t,e=r.dom,i=o.pp,n=o.prS,d=o.gCS,u=o.truD,a=o.property("borderRadius"),f=o.property("borderTopLeftRadius"),p=o.property("borderTopRightRadius"),g=o.property("borderBottomLeftRadius"),l=o.property("borderBottomRightRadius"),c=["borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor","outlineColor"],s=["borderRadius","borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"],b=["right","bottom","minWidth","minHeight","maxWidth","maxHeight","padding","margin","paddingTop","paddingBottom","paddingLeft","paddingRight","marginTop","marginBottom","marginLeft","marginRight","borderWidth","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","outlineWidth"],h=["fontSize","lineHeight","letterSpacing","wordSpacing"],v=["clip"],m=["backgroundPosition"],R=s.concat(b,h),y=c.concat(v,s,b,h,m),T=y.length,x=(r.Interpolate.number,r.Interpolate.unit),B=B||{},L=0;L<T;L++){var C=y[L];c.indexOf(C)!==-1?B[C]="rgba(0,0,0,0)":R.indexOf(C)!==-1?B[C]=0:m.indexOf(C)!==-1?B[C]=[50,50]:"clip"===C&&(B[C]=[0,0,0,0])}for(var L=0,W=c.length;L<W;L++)C=c[L],i[C]=function(t,r){return i.cls(t,r)},n[C]=function(t,r,o){return d(t,r)||B[r]};for(var L=0,W=R.length;L<W;L++)C=R[L],i[C]=function(t,r){return i.box(t,r)},n[C]=function(t,r,o){return d(t,r)||B[r]};for(var L=0,W=s.length;L<W;L++)C=s[L],i[C]=function(t,r){return t in e||("borderRadius"===t?e[t]=function(t,r,o,e,i){t.style[a]=x(o.v,e.v,e.u,i)}:"borderTopLeftRadius"===t?e[t]=function(t,r,o,e,i){t.style[f]=x(o.v,e.v,e.u,i)}:"borderTopRightRadius"===t?e[t]=function(t,r,o,e,i){t.style[p]=x(o.v,e.v,e.u,i)}:"borderBottomLeftRadius"===t?e[t]=function(t,r,o,e,i){t.style[g]=x(o.v,e.v,e.u,i)}:"borderBottomRightRadius"===t&&(e[t]=function(t,r,o,e,i){t.style[l]=x(o.v,e.v,e.u,i)})),u(r)},n[C]=function(t,r,o){return d(t,r)||B[r]};return i.clip=function(t,r){if(t in e||(e[t]=function(t,r,o,e,i){var n=0,d=[];for(n;n<4;n++){var u=o[n].v,a=e[n].v,f=e[n].u||"px";d[n]=x(u,a,f,i)}t.style[r]="rect("+d+")"}),r instanceof Array)return[u(r[0]),u(r[1]),u(r[2]),u(r[3])];var o=r.replace(/rect|\(|\)/g,"");return o=/\,/g.test(o)?o.split(/\,/g):o.split(/\s/g),[u(o[0]),u(o[1]),u(o[2]),u(o[3])]},n.clip=function(t,r,o){var e=d(t,r),i=d(t,"width"),n=d(t,"height");return/rect/.test(e)?e:[0,i,n,0]},i.backgroundPosition=function(t,r){if(t in e||(e[t]=function(t,r,o,e,i){t.style[r]=x(o.x.v,e.x.v,"%",i)+" "+x(o.y.v,e.y.v,"%",i)}),r instanceof Array)return{x:u(r[0])||{v:50,u:"%"},y:u(r[1])||{v:50,u:"%"}};var o,i,n=r.replace(/top|left/g,0).replace(/right|bottom/g,100).replace(/center|middle/g,50);return n=/\,/g.test(n)?n.split(/\,/g):n.split(/\s/g),n=2===n.length?n:[n[0],50],o=u(n[0]),i=u(n[1]),{x:o,y:i}},n.backgroundPosition=function(t,r,o){return d(t,r)||B[r]},this});

View file

@ -1,2 +1,2 @@
// KUTE.js v1.5.94 | © dnp_theme | jQuery Plugin | MIT-License
// KUTE.js v1.5.95 | © dnp_theme | jQuery Plugin | MIT-License
!function(e,t){if("function"==typeof define&&define.amd)define(["./kute.js","jquery"],function(e,n){return t(n,e),e});else if("object"==typeof module&&"function"==typeof require){var n=require("./kute.js"),r=require("jquery");module.exports=t(r,n)}else{if("undefined"==typeof e.KUTE||"undefined"==typeof e.$&&"undefined"==typeof e.jQuery)throw new Error("jQuery Plugin for KUTE.js depend on KUTE.js and jQuery");var r=e.jQuery||e.$,n=e.KUTE;r.fn.KUTE=t(r,n)}}(this,function(e,t){"use strict";return e.fn.fromTo=function(e,n,r){var i=this.length>1?this:this[0],o=this.length>1?"allFromTo":"fromTo";return t[o](i,e,n,r)},e.fn.to=function(e,n){var r=this.length>1?this:this[0],i=this.length>1?"allTo":"to";return t[i](r,e,n)},this});

View file

@ -1,2 +1,2 @@
// KUTE.js v1.5.94 | © dnp_theme | Physics Plugin | MIT-License
// KUTE.js v1.5.95 | © dnp_theme | Physics Plugin | MIT-License
!function(t,n){if("function"==typeof define&&define.amd)define(["kute.js"],n);else if("object"==typeof module&&"function"==typeof require)module.exports=n(require("kute.js"));else{if("undefined"==typeof t.KUTE)throw new Error("Physics Easing functions for KUTE.js depend on KUTE.js");t.Physics=n(t.KUTE)}}(this,function(t){"use strict";var n="undefined"!=typeof global?global:window,r={};r.spring=n.spring=function(t){t=t||{};var n=Math.max(1,(t.frequency||300)/20),r=Math.pow(20,(t.friction||200)/100),e=t.anticipationStrength||0,o=(t.anticipationSize||0)/1e3;return function(t){var u,a,c,p,f,y,s,h;return y=t/(1-o)-o/(1-o),t<o?(h=o/(1-o)-o/(1-o),s=0/(1-o)-o/(1-o),f=Math.acos(1/i.A1(t,h)),c=(Math.acos(1/i.A1(t,s))-f)/(n*-o),u=i.A1):(u=i.A2,f=0,c=1),a=u(y,o,e,r),p=n*(t-o)*c+f,1-a*Math.cos(p)}};var i=r.spring.prototype=n.spring.prototype;i.A1=function(t,n,r){var i,e,o,u;return o=n/(1-n),u=0,e=(o-.8*u)/(o-u),i=(.8-e)/o,i*t*r/100+e},i.A2=function(t,n,r,i){return Math.pow(i/10,-t)*(1-t)},r.bounce=n.bounce=function(t){t=t||{};var n=Math.max(1,(t.frequency||300)/20),r=Math.pow(20,(t.friction||200)/100);return function(t){var i=Math.pow(r/10,-t)*(1-t),e=n*t*1+Math.PI/2;return i*Math.cos(e)}},r.gravity=n.gravity=function(t){var n,r,i,o,u,a;return t=t||{},n=(t.bounciness||400)/1250,i=(t.elasticity||200)/1e3,u=t.initialForce||!1,o=100,r=[],a=function(){var t,r;for(t=Math.sqrt(2/o),r={a:-t,b:t,H:1},u&&(r.a=0,r.b=2*r.b);r.H>.001;)a=r.b-r.a,r={a:r.b,b:r.b+a*n,H:r.H*n*n};return r.b}(),function(){var t,e,c,p;for(e=Math.sqrt(2/(o*a*a)),c={a:-e,b:e,H:1},u&&(c.a=0,c.b=2*c.b),r.push(c),t=a,p=[];c.b<1&&c.H>.001;)t=c.b-c.a,c={a:c.b,b:c.b+t*n,H:c.H*i},p.push(r.push(c));return p}(),function(n){var i,o,c;for(o=0,i=r[o];!(n>=i.a&&n<=i.b)&&(o+=1,i=r[o]););return c=i?e.getPointInCurve(i.a,i.b,i.H,n,t,a):u?0:1}};var e=r.gravity.prototype=n.gravity.prototype;e.getPointInCurve=function(t,n,r,i,e,o){var u,a;return o=n-t,a=2/o*i-1-2*t/o,u=a*a*r-r+1,e.initialForce&&(u=1-u),u},r.forceWithGravity=n.forceWithGravity=function(t){var n=t||{};return n.initialForce=!0,r.gravity(n)},r.bezier=n.BezierMultiPoint=function(t){t=t||{};var n=t.points,r=!1,i=[];return function(){var t,r;for(t in n){if(r=parseInt(t),r>=n.length-1)break;o.fn(n[r],n[r+1],i)}return i}(),function(t){return 0===t?0:1===t?1:o.yForX(t,i,r)}};var o=r.bezier.prototype=n.BezierMultiPoint.prototype;return o.fn=function(t,n,r){var i=function(r){return o.Bezier(r,t,t.cp[t.cp.length-1],n.cp[0],n)};return r.push(i)},o.Bezier=function(t,n,r,i,e){return{x:Math.pow(1-t,3)*n.x+3*Math.pow(1-t,2)*t*r.x+3*(1-t)*Math.pow(t,2)*i.x+Math.pow(t,3)*e.x,y:Math.pow(1-t,3)*n.y+3*Math.pow(1-t,2)*t*r.y+3*(1-t)*Math.pow(t,2)*i.y+Math.pow(t,3)*e.y}},o.yForX=function(t,n,r){var i,e,o,u,a,c,p,f,y=0,s=n.length;for(i=null,y;y<s&&(e=n[y],t>=e(0).x&&t<=e(1).x&&(i=e),null===i);y++);if(!i)return r?0:1;for(f=1e-4,u=0,c=1,a=(c+u)/2,p=i(a).x,o=0;Math.abs(t-p)>f&&o<100;)t>p?u=a:c=a,a=(c+u)/2,p=i(a).x,o++;return i(a).y},n.Physics={physicsInOut:function(t){var r;return t=t||{},r=t.friction||200,n.BezierMultiPoint({points:[{x:0,y:0,cp:[{x:.92-r/1e3,y:0}]},{x:1,y:1,cp:[{x:.08+r/1e3,y:1}]}]})},physicsIn:function(t){var r;return t=t||{},r=t.friction||200,n.BezierMultiPoint({points:[{x:0,y:0,cp:[{x:.92-r/1e3,y:0}]},{x:1,y:1,cp:[{x:1,y:1}]}]})},physicsOut:function(t){var r;return t=t||{},r=t.friction||200,n.BezierMultiPoint({points:[{x:0,y:0,cp:[{x:0,y:0}]},{x:1,y:1,cp:[{x:.08+r/1e3,y:1}]}]})},physicsBackOut:function(t){var r;return t=t||{},r=t.friction||200,n.BezierMultiPoint({points:[{x:0,y:0,cp:[{x:0,y:0}]},{x:1,y:1,cp:[{x:.735+r/1e3,y:1.3}]}]})},physicsBackIn:function(t){var r;return t=t||{},r=t.friction||200,n.BezierMultiPoint({points:[{x:0,y:0,cp:[{x:.28-r/1e3,y:-.6}]},{x:1,y:1,cp:[{x:1,y:1}]}]})},physicsBackInOut:function(t){var r;return t=t||{},r=t.friction||200,n.BezierMultiPoint({points:[{x:0,y:0,cp:[{x:.68-r/1e3,y:-.55}]},{x:1,y:1,cp:[{x:.265+r/1e3,y:1.45}]}]})}},r});

File diff suppressed because one or more lines are too long

View file

@ -1,2 +1,2 @@
// KUTE.js v1.5.94 | © dnp_theme | Text Plugin | MIT-License
// KUTE.js v1.5.95 | © dnp_theme | Text Plugin | MIT-License
!function(t,e){if("function"==typeof define&&define.amd)define(["kute.js"],e);else if("object"==typeof module&&"function"==typeof require)module.exports=e(require("kute.js"));else{if("undefined"==typeof t.KUTE)throw new Error("Text-Plugin require KUTE.js.");e(t.KUTE)}}(this,function(t){"use strict";var e="undefined"!=typeof global?global:window,n=t,r=e.dom,i=n.prS,u=n.pp,s=e.Interpolate.number,o=String("abcdefghijklmnopqrstuvwxyz").split(""),a=String("abcdefghijklmnopqrstuvwxyz".toUpperCase()).split(""),l=String("~!@#$%^&*()_+{}[];'<>,./?=-").split(""),f=String("0123456789").split(""),p=o.concat(a,f),h=(p.concat(l),Math.random),c=Math.floor,g=Math.min;return i.text=i.number=function(t,e,n){return t.innerHTML},u.text=function(t,e,n){return"text"in r||(r.text=function(t,e,n,r,i,u){var s=s||"alpha"===u.textChars?o:"upper"===u.textChars?a:"numeric"===u.textChars?f:"alphanumeric"===u.textChars?p:"symbols"===u.textChars?l:u.textChars?u.textChars.split(""):o,m=s.length,b=s[c(h()*m)],d="",x="",y=n.substring(0),C=r.substring(0);d=""!==n?y.substring(y.length,c(g(i*y.length,y.length))):"",x=C.substring(0,c(g(i*C.length,C.length))),t.innerHTML=i<1?x+b+d:r}),e},u.number=function(t,e,n){return"number"in r||(r.number=function(t,e,n,r,i){t.innerHTML=parseInt(s(n,r,i))}),parseInt(e)||0},this});

4
dist/kute.min.js vendored

File diff suppressed because one or more lines are too long

View file

@ -16,7 +16,7 @@
})(this, function(KUTE){
'use strict';
var g = typeof global !== 'undefined' ? global : window, K = KUTE, DOM = g.dom, parseProperty = K.pp, prepareStart = K.prS, getComputedStyle = K.gCS, trueDimension = K.truD,
var g = typeof global !== 'undefined' ? global : window, K = KUTE, DOM = g.dom, parseProperty = K.pp, prepareStart = K.prS, getCurrentStyle = K.gCS, trueDimension = K.truD,
_br = K.property('borderRadius'), _brtl = K.property('borderTopLeftRadius'), _brtr = K.property('borderTopRightRadius'), // all radius props prefixed
_brbl = K.property('borderBottomLeftRadius'), _brbr = K.property('borderBottomRightRadius'),
_cls = ['borderColor', 'borderTopColor', 'borderRightColor', 'borderBottomColor', 'borderLeftColor', 'outlineColor'], // colors 'hex', 'rgb', 'rgba' -- #fff / rgb(0,0,0) / rgba(0,0,0,0)
@ -53,7 +53,7 @@
return parseProperty.cls(p,v);
};
prepareStart[p] = function(el,p,v){
return getComputedStyle(el,p) || _d[p];
return getCurrentStyle(el,p) || _d[p];
};
}
@ -64,7 +64,7 @@
return parseProperty.box(p,v);
};
prepareStart[p] = function(el,p,v){
return getComputedStyle(el,p) || _d[p];
return getCurrentStyle(el,p) || _d[p];
};
}
@ -98,7 +98,7 @@
return trueDimension(v);
};
prepareStart[p] = function(el,p,v){
return getComputedStyle(el,p) || _d[p];
return getCurrentStyle(el,p) || _d[p];
};
}
@ -124,7 +124,7 @@
};
prepareStart['clip'] = function(el,p,v){
var c = getComputedStyle(el,p), w = getComputedStyle(el,'width'), h = getComputedStyle(el,'height');
var c = getCurrentStyle(el,p), w = getCurrentStyle(el,'width'), h = getCurrentStyle(el,'height');
return !/rect/.test(c) ? [0, w, h, 0] : c;
};
@ -145,7 +145,7 @@
}
}
prepareStart['backgroundPosition'] = function(el,p,v){
return getComputedStyle(el,p) || _d[p];
return getCurrentStyle(el,p) || _d[p];
}
return this;

View file

@ -19,7 +19,7 @@
'use strict';
// variables, reference global objects, prepare properties
var g = typeof global !== 'undefined' ? global : window, K = KUTE, p, DOM = g.dom, parseProperty = K.pp, prepareStart = K.prS, getComputedStyle = K.gCS,
var g = typeof global !== 'undefined' ? global : window, K = KUTE, p, DOM = g.dom, parseProperty = K.pp, prepareStart = K.prS, getCurrentStyle = K.gCS,
_isIE = navigator && (new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})").exec(navigator.userAgent) !== null) ? parseFloat( RegExp.$1 ) : false,
_nm = ['strokeWidth', 'strokeOpacity', 'fillOpacity', 'stopOpacity'], // numeric SVG CSS props
_cls = ['fill', 'stroke', 'stopColor'], // colors 'hex', 'rgb', 'rgba' -- #fff / rgb(0,0,0) / rgba(0,0,0,0)
@ -276,8 +276,8 @@
start = /%/.test(v[0]) ? percent(v[0].trim(),l) : parseFloat(v[0]);
end = /%/.test(v[1]) ? percent(v[1].trim(),l) : parseFloat(v[1]);
} else if (typeof v === 'undefined') {
o = parseFloat(getComputedStyle(e,'stroke-dashoffset'));
d = getComputedStyle(e,'stroke-dasharray').split(/\,/);
o = parseFloat(getCurrentStyle(e,'stroke-dashoffset'));
d = getCurrentStyle(e,'stroke-dasharray').split(/\,/);
start = 0-o;
end = parseFloat(d[0]) + start || l;
@ -308,7 +308,7 @@
return parseProperty.cls(p,v);
}
prepareStart[p] = function(el,p,v){
return getComputedStyle(el,p) || 'rgba(0,0,0,0)';
return getCurrentStyle(el,p) || 'rgb(0,0,0)';
}
}
@ -336,7 +336,7 @@
}
}
prepareStart[p] = function(el,p,v){
return getComputedStyle(el,p) || 0;
return getCurrentStyle(el,p) || 0;
}
}

217
kute.js
View file

@ -14,7 +14,7 @@
"use strict";
// set a custom scope for KUTE.js
var g = typeof global !== 'undefined' ? global : window, K = {}, _tws = g._tweens = [], tick = 0, time = g.performance,
var g = typeof global !== 'undefined' ? global : window, K = {}, _tws = g._tweens = [], tick = null, time = g.performance,
getPrefix = function() { //returns browser prefix
var div = document.createElement('div'), i = 0, pf = ['Moz', 'moz', 'Webkit', 'webkit', 'O', 'o', 'Ms', 'ms'],
s = ['MozTransform', 'mozTransform', 'WebkitTransform', 'webkitTransform', 'OTransform', 'oTransform', 'MsTransform', 'msTransform'];
@ -37,35 +37,26 @@
return nl;
},
trueDimension = function (d,p) { //true dimension returns { v = value, u = unit }
var x = parseInt(d) || 0, mu = ['px','%','deg','rad','em','rem','vh','vw'], l = mu.length,
y = getU();
function getU() {
var u;
for (var i=0;i<l;i++) { if ( typeof d === 'string' && d.indexOf(mu[i]) !== -1 ) u = mu[i]; }
u = u !== undefined ? u : (p ? 'deg' : 'px')
return u;
}
var x = parseInt(d) || 0, mu = ['px','%','deg','rad','em','rem','vh','vw'], y;
for (var i=0, l = mu.length; i<l; i++) { if ( typeof d === 'string' && d.indexOf(mu[i]) !== -1 ) { y = mu[i]; break; } }
y = y !== undefined ? y : (p ? 'deg' : 'px');
return { v: x, u: y };
},
trueColor = function (v) { // replace transparent and transform any color to rgba()/rgb()
var vrgb, y;
if (/rgb|rgba/.test(v)) { //rgb will be fastest initialized
vrgb = v.replace(/[^\d,]/g, '').split(','); y = vrgb[3] ? vrgb[3] : null;
var vrgb = v.replace(/[^\d,]/g, '').split(','), y = vrgb[3] ? vrgb[3] : null;
if (!y) {
return { r: parseInt(vrgb[0]), g: parseInt(vrgb[1]), b: parseInt(vrgb[2]) };
} else {
return { r: parseInt(vrgb[0]), g: parseInt(vrgb[1]), b: parseInt(vrgb[2]), a: y*1 };
}
}
if (/^#/.test(v)) {
vrgb = hexToRGB(v); return { r: vrgb.r, g: vrgb.g, b: vrgb.b };
}
if (/transparent|none|initial|inherit/.test(v)) {
} else if (/^#/.test(v)) {
var fromHex = hexToRGB(v); return { r: fromHex.r, g: fromHex.g, b: fromHex.b };
} else if (/transparent|none|initial|inherit/.test(v)) {
return { r: 0, g: 0, b: 0, a: 0 };
}
if (!/^#|^rgb/.test(v) ) { // maybe we can check for web safe colors
var h = document.getElementsByTagName('head')[0]; h.style.color = v; vrgb = g.getComputedStyle(h,null).color;
h.style.color = ''; return v !== vrgb ? trueColor(vrgb) : {r:0,g:0,b:0};
} else if (!/^#|^rgb/.test(v) ) { // maybe we can check for web safe colors
var h = document.getElementsByTagName('head')[0]; h.style.color = v; var webColor = g.getComputedStyle(h,null).color;
h.style.color = ''; return v !== webColor ? { r: parseInt(webColor[0]), g: parseInt(webColor[1]), b: parseInt(webColor[2]) } : {r:0,g:0,b:0};
}
},
preventScroll = function (e) { // prevent mousewheel or touch events while tweening scroll
@ -89,7 +80,7 @@
},
getInlineStyle = function(el,p) { // getInlineStyle = get transform style for element from cssText for .to() method, the sp is for transform property
if (!el) return; // if the scroll applies to `window` it returns as it has no styling
var css = el.style.cssText.replace(/\s/g,'').split(';'),//the cssText
var css = css || el.style.cssText.replace(/\s/g,'').split(';'),//the cssText
trsf = {}; //the transform object
// if we have any inline style in the cssText attribute, usually it has higher priority
for ( var i=0, csl = css.length; i<csl; i++ ){
@ -105,7 +96,7 @@
}
return trsf;
},
getComputedStyle = function (el,p) { // gCS = get style property for element from computedStyle for .to() method
getCurrentStyle = function (el,p) { // gCS = get style property for element from computedStyle for .to() method
var es = el.style, cs = g.getComputedStyle(el,null) || el.currentStyle, pp = property(p), //the computed style | prefixed property
s = es[p] && !/auto|initial|none|unset/.test(es[p]) ? es[p] : cs[pp]; // s the property style value
if ( p !== 'transform' && (pp in cs || pp in es) ) {
@ -125,19 +116,19 @@
//more internals
getAll = function () { return _tws; },
removeAll = function () { _tws = []; },
add = g._addTween = function (tw) { _tws.push(tw); },
add = function (tw) { _tws.push(tw); },
remove = function (tw) { var i = _tws.indexOf(tw); if (i !== -1) { _tws.splice(i, 1); }},
stop = function () { if (tick) { _caf(tick); tick = 0; } },
stop = function () { if (tick) { _caf(tick); tick = null; } },
_tch = ('ontouchstart' in g || navigator.msMaxTouchPoints) || false, // support Touch?
_ev = _tch ? 'touchstart' : 'mousewheel', _evh = 'mouseenter', //events to prevent on scroll
canTouch = ('ontouchstart' in g || navigator.msMaxTouchPoints) || false, // support Touch?
touchOrWheel = canTouch ? 'touchstart' : 'mousewheel', mouseEnter = 'mouseenter', //events to prevent on scroll
_tr = property('transform'),
_raf = g.requestAnimationFrame || g.webkitRequestAnimationFrame || function (c) { return setTimeout(c, 16) },
_caf = g.cancelAnimationFrame || g.webkitCancelRequestAnimationFrame || function (c) { return clearTimeout(c) },
//true scroll container
_bd = document.body, _htm = document.getElementsByTagName('HTML')[0],
_sct = /webkit/i.test(navigator.userAgent) || document.compatMode == 'BackCompat' ? _bd : _htm,
body = document.body, html = document.getElementsByTagName('HTML')[0],
scrollContainer = /webkit/i.test(navigator.userAgent) || document.compatMode == 'BackCompat' ? body : html,
_isIE = navigator && (new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})").exec(navigator.userAgent) !== null) ? parseFloat( RegExp.$1 ) : false,
_isIE8 = _isIE === 8, // check IE8/IE
@ -238,10 +229,9 @@
// element/node, method, (prefixed)property, startValue, endValue, progress
var elapsed = Math.min(( t - w._sT ) / w._dr, 1); // calculate progress
for (var p in w._vE){ DOM[p].call(w,w._el,p,w._vS[p],w._vE[p],w._e(elapsed),w._ops); } //render the CSS update
// for (var p in w._vE){ DOM[p].call(this,w._el,p,w._vS[p],w._vE[p],w._e(elapsed),w._ops); } //render the CSS update
for (var p in w._vE){ DOM[p](w._el,p,w._vS[p],w._vE[p],w._e(elapsed),w._ops); } //render the CSS update
if (w._uC) { w._uC.call(); } // fire the updateCallback
if (w._uC) { w._uC.call(); } // fire the updateCallback, try to minimize recursion
if (elapsed === 1) {
if (w._r > 0) {
@ -395,7 +385,7 @@
unl : function(p,v){ // scroll | opacity | unitless
if (/scroll/.test(p) && !(p in DOM) ){
DOM[p] = function(l,p,a,b,v) {
var el = el || (l === undefined || l === null) ? _sct : l;
var el = el || (l === undefined || l === null) ? scrollContainer : l;
el.scrollTop = number(a,b,v);
};
} else if (p === 'opacity') {
@ -441,58 +431,19 @@
this.playing = false;
},
scrollOut = function(){ //prevent scroll when tweening scroll
if ( 'scroll' in this._vE || 'scrollTop' in this._vE ) {
document.removeEventListener(_ev, preventScroll, false);
document.removeEventListener(_evh, preventScroll, false);
if (document.body.getAttribute('data-tweening') && ( 'scroll' in this._vE || 'scrollTop' in this._vE )) {
document.removeEventListener(touchOrWheel, preventScroll, false);
document.removeEventListener(mouseEnter, preventScroll, false);
document.body.removeAttribute('data-tweening');
}
},
scrollIn = function(){
if ( 'scroll' in this._vE || 'scrollTop' in this._vE ) {
if (!document.body.getAttribute('data-tweening') ) {
document.addEventListener(_ev, preventScroll, false);
document.addEventListener(_evh, preventScroll, false);
document.body.setAttribute('data-tweening', 'scroll');
}
if (!document.body.getAttribute('data-tweening') && ( 'scroll' in this._vE || 'scrollTop' in this._vE )) {
document.addEventListener(touchOrWheel, preventScroll, false);
document.addEventListener(mouseEnter, preventScroll, false);
document.body.setAttribute('data-tweening', 'scroll');
}
},
start = function (t) { // move functions that use the ticker outside the prototype to be in the same scope with it
scrollIn.call(this);
perspective(this._el,this._ops); // apply the perspective and transform origin
if ( this._rpr ) { this.stackTransform(); } // on start we reprocess the valuesStart for TO() method
K.svg && K.svq(this); // SVG Plugin | on start we process the SVG paths and SVG transforms
for ( var e in this._vE ) {
this._vSR[e] = this._vS[e];
}
// now it's a good time to start
add(this);
this.playing = true;
this.paused = false;
this._sCF = false;
this._sT = t || time.now();
this._sT += this._dl;
if (!this._sCF) {
if (this._sC) { this._sC.call(); }
this._sCF = true;
}
!tick && ticker();
return this;
},
play = function () {
if (this.paused && this.playing) {
this.paused = false;
if (this._rC !== null) { this._rC.call(); }
this._sT += time.now() - this._pST;
add(this);
!tick && ticker(); // restart ticking if stopped
}
return this;
},
processEasing = function (es) { //process easing
if ( typeof es === 'function') {
return es;
@ -566,8 +517,45 @@
};
easing.easingBounceInOut = function(t) { if ( t < 0.5 ) return easing.easingBounceIn( t * 2 ) * 0.5; return easing.easingBounceOut( t * 2 - 1 ) * 0.5 + 0.5;};
// single Tween object construct
var Tween = g._tween = function (_el, _vS, _vE, _o) {
// single Tween object construct
var start = function (t) { // move functions that use the ticker outside the prototype to be in the same scope with it
scrollIn.call(this);
perspective(this._el,this._ops); // apply the perspective and transform origin
if ( this._rpr ) { this.getStartValues(); } // on start we reprocess the valuesStart for TO() method
K.svg && K.svq(this); // SVG Plugin | on start we process the SVG paths and SVG transforms
for ( var e in this._vE ) {
this._vSR[e] = this._vS[e];
}
// now it's a good time to start
_tws.push(this);
this.playing = true;
this.paused = false;
this._sCF = false;
this._sT = t || time.now();
this._sT += this._dl;
if (!this._sCF) {
if (this._sC) { this._sC.call(); }
this._sCF = true;
}
!tick && ticker();
return this;
},
play = function () {
if (this.paused && this.playing) {
this.paused = false;
if (this._rC !== null) { this._rC.call(); }
this._sT += time.now() - this._pST;
_tws.push(this);
!tick && ticker(); // restart ticking if stopped
}
return this;
},
Tween = g._tween = function (_el, _vS, _vE, _o) {
this._el = _el; // element animation is applied to
this._vSR = {}; // internal valuesStartRepeat
this._vS = _vS; // valuesStart
@ -594,11 +582,10 @@
this._stC = _o.stop || null; // _on StopCallback
this.repeat = this._r; // we cache the number of repeats to be able to put it back after all cycles finish
this._ops = {};
this.start = start;
this.play = this.resume = play;
this.start = start; this.play = play; this.resume = play;
//also add plugins options or transform perspective TO DO : split this damn regex into an array and do an indexOf or a simple ||
for (var o in _o) { if (!(o in this) && !/delay|duration|repeat|start|stop|update|complete|pause|play|yoyo|easing/i.test(o) ) { this._ops[o] = _o[o]; } }
for (var o in _o) { if (!(o in this) && !/delay|rpr|duration|repeat|start|stop|update|complete|pause|play|yoyo|easing/i.test(o) ) { this._ops[o] = _o[o]; } }
this.pause = function() {
if (!this.paused && this.playing) {
@ -610,7 +597,7 @@
}
}
return this;
}
};
this.stop = function () {
if (!this.paused && this.playing) {
remove(this);
@ -625,19 +612,20 @@
close.call(this);
}
return this;
}
};
this.chain = function () { this._cT = arguments; return this; };
this.stopChainedTweens = function () {
for (var i = 0, ctl =this._cT.length; i < ctl; i++) {
this._cT[i].stop();
}
};
this.getStartValues = function () { // read current value to populate valuesStart for the .to() method
var startValues = {}, endValues = _vS;
this.getStartValues = function () { // stack transform props for .to() chains
var startValues = {}, cs = getInlineStyle(this._el,'transform'),
deg = ['rotate','skew'], ax = ['X','Y','Z'];
for (var p in endValues){
for (var p in _vS){
if ( _tf.indexOf(p) !== -1 ) {
var r2d = (/(rotate|translate|scale)$/.test(p)), cs = getInlineStyle(this._el,'transform'), deg = ['rotate','skew'], ax = ['X','Y','Z'];
var r2d = (/(rotate|translate|scale)$/.test(p));
if ( /translate/.test(p) && p !== 'translate' ) {
startValues['translate3d'] = cs['translate3d'] || _d[p];
} else if ( r2d ) { // 2d transforms
@ -646,57 +634,53 @@
for (var d=0; d<2; d++) {
for (var a = 0; a<3; a++) {
var s = deg[d]+ax[a];
if (_tf.indexOf(s) !== -1 && (s in endValues) ) { startValues[s] = cs[s] || _d[s]; }
if (_tf.indexOf(s) !== -1 && (s in _vS) ) { startValues[s] = cs[s] || _d[s]; }
}
}
}
} else {
if ( _sc.indexOf(p) === -1 ) {
if (p === 'opacity' && _isIE8 ) { // handle IE8 opacity
var co = getComputedStyle(this._el,'filter');
var co = getCurrentStyle(this._el,'filter');
startValues['opacity'] = typeof co === 'number' ? co : _d['opacity'];
} else {
if ( _all.indexOf(p) !== -1 ) {
startValues[p] = getComputedStyle(this._el,p) || d[p];
startValues[p] = getCurrentStyle(this._el,p) || d[p];
} else { // plugins register here
startValues[p] = p in prepareStart ? prepareStart[p](this._el,p,endValues[p]) : 0;
startValues[p] = p in prepareStart ? prepareStart[p](this._el,p,_vS[p]) : 0;
}
}
} else {
startValues[p] = (this._el === null || this._el === undefined) ? (g.pageYOffset || _sct.scrollTop) : this._el.scrollTop;
startValues[p] = (this._el === null || this._el === undefined) ? (g.pageYOffset || scrollContainer.scrollTop) : this._el.scrollTop;
}
}
}
for ( var p in cs ){ // also add to _vS values from previous tweens
if ( _tf.indexOf(p) !== -1 && (!( p in endValues )) ) {
if ( _tf.indexOf(p) !== -1 && (!( p in _vS )) ) {
startValues[p] = cs[p] || _d[p];
}
}
return startValues;
};
this.stackTransform = function () { // stack transform props for .to() chains
var startValues = this.getStartValues();
this._vS = {};
this._vS = preparePropertiesObject(startValues,{},this._el)[0];
for ( var p in this._vS ) {
if ( p === 'transform' && (p in this._vE) ){
for ( var sp in this._vS[p]) {
if (!(sp in this._vE[p])) { this._vE[p][sp] = {}; }
for ( var spp in this._vS[p][sp] ) { // 3rd level
if ( this._vS[p][sp][spp].value !== undefined ) {
if (!(spp in this._vE[p][sp])) { this._vE[p][sp][spp] = {}; }
for ( var sppp in this._vS[p][sp][spp]) { // spp = translateX | rotateX | skewX | rotate2d
if ( !(sppp in this._vE[p][sp][spp])) {
this._vE[p][sp][spp][sppp] = this._vS[p][sp][spp][sppp]; // sppp = unit | value
}
if ( 'transform' in this._vE ){ // stack transform
var transform = 'transform';
for ( var sp in this._vS['transform']) {
if (!(sp in this._vE[transform])) { this._vE[transform][sp] = {}; }
for ( var spp in this._vS[transform][sp] ) { // 3rd level
if ( this._vS[transform][sp][spp].value !== undefined ) {
if (!(spp in this._vE[transform][sp])) { this._vE[transform][sp][spp] = {}; }
for ( var sppp in this._vS[transform][sp][spp]) { // spp = translateX | rotateX | skewX | rotate2d
if ( !(sppp in this._vE[transform][sp][spp])) {
this._vE[transform][sp][spp][sppp] = this._vS[transform][sp][spp][sppp]; // sppp = unit | value
}
}
}
if ( 'value' in this._vS[p][sp] && (!('value' in this._vE[p][sp])) ) { // 2nd level
for ( var spp1 in this._vS[p][sp] ) { // scale
if (!(spp1 in this._vE[p][sp])) {
this._vE[p][sp][spp1] = this._vS[p][sp][spp1]; // spp = unit | value
}
}
if ( 'value' in this._vS[transform][sp] && (!('value' in this._vE[transform][sp])) ) { // 2nd level
for ( var spp1 in this._vS[transform][sp] ) { // scale
if (!(spp1 in this._vE[transform][sp])) {
this._vE[transform][sp][spp1] = this._vS[transform][sp][spp1]; // spp = unit | value
}
}
}
@ -736,6 +720,7 @@
play : function(){ for ( var i = 0, tl = this.tweens.length; i < tl; i++ ) { this.tweens[i].play(); } return this; },
resume : function() {return this.play()}
},
// main methods
to = function (el, to, o) {
var _el = selector(el),
@ -761,6 +746,6 @@
property: property, getPrefix: getPrefix, selector: selector, pe : processEasing, // utils
to: to, fromTo: fromTo, allTo: allTo, allFromTo: allFromTo, // main methods
pp: parseProperty, prS: prepareStart, Tween : Tween, // property parsing & preparation | Tween
truD: trueDimension, truC: trueColor, rth: rgbToHex, htr: hexToRGB, gCS: getComputedStyle, // property parsing
truD: trueDimension, truC: trueColor, rth: rgbToHex, htr: hexToRGB, gCS: getCurrentStyle, // property parsing
};
}));

View file

@ -1,6 +1,6 @@
{
"name": "kute.js",
"version": "1.5.94",
"version": "1.5.95",
"description": "A minimal Native Javascript animation engine.",
"main": "kute.js",
"scripts": {