This commit is contained in:
thednp 2016-09-22 14:42:06 +03:00
parent 728af0a801
commit b67960952e
6 changed files with 32 additions and 30 deletions

View file

@ -35,7 +35,7 @@
if ( !( 'text' in DOM ) ) {
DOM['text'] = function(l,p,a,b,v,o) {
var tp = tp || o.textChars === 'alpha' ? _s // textChars is alpha
: o.textChars === 'uparsePropertyer' ? _S // textChars is numeric
: o.textChars === 'upper' ? _S // textChars is numeric
: o.textChars === 'numeric' ? _n // textChars is numeric
: o.textChars === 'alphanumeric' ? _a // textChars is alphanumeric
: o.textChars === 'symbols' ? _sb // textChars is symbols

View file

@ -36,7 +36,7 @@
if (nl === null && el !== 'window') throw new TypeError('Element not found or incorrect selector: '+el);
return nl;
},
trueDimendion = function (d,p) { //true dimension returns { v = value, u = unit }
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() {
@ -340,7 +340,7 @@
l.style[p] = unit(a.value,b.value,b.unit,v);
}
}
return { value: trueDimendion(v).v, unit: trueDimendion(v).u };
return { value: trueDimension(v).v, unit: trueDimension(v).u };
},
tf : function(p,v){ // transform prop / value
if (!('transform' in DOM)) {
@ -398,27 +398,27 @@
if (p === 'translate3d') {
var t3d = v.split(',');
return {
translateX : { value: trueDimendion(t3d[0]).v, unit: trueDimendion(t3d[0]).u },
translateY : { value: trueDimendion(t3d[1]).v, unit: trueDimendion(t3d[1]).u },
translateZ : { value: trueDimendion(t3d[2]).v, unit: trueDimendion(t3d[2]).u }
translateX : { value: trueDimension(t3d[0]).v, unit: trueDimension(t3d[0]).u },
translateY : { value: trueDimension(t3d[1]).v, unit: trueDimension(t3d[1]).u },
translateZ : { value: trueDimension(t3d[2]).v, unit: trueDimension(t3d[2]).u }
};
} else if (/^translate(?:[XYZ])$/.test(p)) {
return { value: trueDimendion(v).v, unit: (trueDimendion(v).u||'px') };
return { value: trueDimension(v).v, unit: (trueDimension(v).u||'px') };
} else if (/^rotate(?:[XYZ])$|skew(?:[XY])$/.test(p)) {
return { value: trueDimendion(v,true).v, unit: (trueDimendion(v,true).u||'deg') };
return { value: trueDimension(v,true).v, unit: (trueDimension(v,true).u||'deg') };
} else if (p === 'translate') {
var tv = typeof v === 'string' ? v.split(',') : v, t2d = {};
if (tv instanceof Array) {
t2d.x = { value: trueDimendion(tv[0]).v, unit: trueDimendion(tv[0]).u },
t2d.y = { value: trueDimendion(tv[1]).v, unit: trueDimendion(tv[1]).u }
t2d.x = { value: trueDimension(tv[0]).v, unit: trueDimension(tv[0]).u },
t2d.y = { value: trueDimension(tv[1]).v, unit: trueDimension(tv[1]).u }
} else {
t2d.x = { value: trueDimendion(tv).v, unit: trueDimendion(tv).u },
t2d.x = { value: trueDimension(tv).v, unit: trueDimension(tv).u },
t2d.y = { value: 0, unit: 'px' }
}
return t2d;
} else if (p === 'rotate') {
var r2d = {};
r2d.z = { value: trueDimendion(v,true).v, unit: (trueDimendion(v,true).u||'deg') };
r2d.z = { value: trueDimension(v,true).v, unit: (trueDimension(v,true).u||'deg') };
return r2d;
} else if (p === 'scale') {
return { value: parseFloat(v) }; // this must be parseFloat(v)
@ -777,8 +777,9 @@
Interpolate: {number: number, unit: unit, color: color }, // interpolators ?? move array & coords to svg and leave color
dom: DOM, // DOM manipulation
pp: parseProperty, prS: prepareStart, // init
truD: trueDimendion, truC: trueColor, rth: rgbToHex, htr: hexToRGB, gCS: getComputedStyle, // property parsing
truD: trueDimension, truC: trueColor, rth: rgbToHex, htr: hexToRGB, gCS: getComputedStyle, // property parsing
Easing: easing,
Tween: Tween, TweensTO: TweensTO, TweensFT: TweensFT // constructors
// Tween: Tween, TweensTO: TweensTO, TweensFT: TweensFT // constructors
tick : _t, tweens : _tws // experiment
};
}));

View file

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

2
dist/kute.min.js vendored

File diff suppressed because one or more lines are too long

View file

@ -35,7 +35,7 @@
if ( !( 'text' in DOM ) ) {
DOM['text'] = function(l,p,a,b,v,o) {
var tp = tp || o.textChars === 'alpha' ? _s // textChars is alpha
: o.textChars === 'uparsePropertyer' ? _S // textChars is numeric
: o.textChars === 'upper' ? _S // textChars is numeric
: o.textChars === 'numeric' ? _n // textChars is numeric
: o.textChars === 'alphanumeric' ? _a // textChars is alphanumeric
: o.textChars === 'symbols' ? _sb // textChars is symbols

27
kute.js
View file

@ -36,7 +36,7 @@
if (nl === null && el !== 'window') throw new TypeError('Element not found or incorrect selector: '+el);
return nl;
},
trueDimendion = function (d,p) { //true dimension returns { v = value, u = unit }
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() {
@ -340,7 +340,7 @@
l.style[p] = unit(a.value,b.value,b.unit,v);
}
}
return { value: trueDimendion(v).v, unit: trueDimendion(v).u };
return { value: trueDimension(v).v, unit: trueDimension(v).u };
},
tf : function(p,v){ // transform prop / value
if (!('transform' in DOM)) {
@ -398,27 +398,27 @@
if (p === 'translate3d') {
var t3d = v.split(',');
return {
translateX : { value: trueDimendion(t3d[0]).v, unit: trueDimendion(t3d[0]).u },
translateY : { value: trueDimendion(t3d[1]).v, unit: trueDimendion(t3d[1]).u },
translateZ : { value: trueDimendion(t3d[2]).v, unit: trueDimendion(t3d[2]).u }
translateX : { value: trueDimension(t3d[0]).v, unit: trueDimension(t3d[0]).u },
translateY : { value: trueDimension(t3d[1]).v, unit: trueDimension(t3d[1]).u },
translateZ : { value: trueDimension(t3d[2]).v, unit: trueDimension(t3d[2]).u }
};
} else if (/^translate(?:[XYZ])$/.test(p)) {
return { value: trueDimendion(v).v, unit: (trueDimendion(v).u||'px') };
return { value: trueDimension(v).v, unit: (trueDimension(v).u||'px') };
} else if (/^rotate(?:[XYZ])$|skew(?:[XY])$/.test(p)) {
return { value: trueDimendion(v,true).v, unit: (trueDimendion(v,true).u||'deg') };
return { value: trueDimension(v,true).v, unit: (trueDimension(v,true).u||'deg') };
} else if (p === 'translate') {
var tv = typeof v === 'string' ? v.split(',') : v, t2d = {};
if (tv instanceof Array) {
t2d.x = { value: trueDimendion(tv[0]).v, unit: trueDimendion(tv[0]).u },
t2d.y = { value: trueDimendion(tv[1]).v, unit: trueDimendion(tv[1]).u }
t2d.x = { value: trueDimension(tv[0]).v, unit: trueDimension(tv[0]).u },
t2d.y = { value: trueDimension(tv[1]).v, unit: trueDimension(tv[1]).u }
} else {
t2d.x = { value: trueDimendion(tv).v, unit: trueDimendion(tv).u },
t2d.x = { value: trueDimension(tv).v, unit: trueDimension(tv).u },
t2d.y = { value: 0, unit: 'px' }
}
return t2d;
} else if (p === 'rotate') {
var r2d = {};
r2d.z = { value: trueDimendion(v,true).v, unit: (trueDimendion(v,true).u||'deg') };
r2d.z = { value: trueDimension(v,true).v, unit: (trueDimension(v,true).u||'deg') };
return r2d;
} else if (p === 'scale') {
return { value: parseFloat(v) }; // this must be parseFloat(v)
@ -777,8 +777,9 @@
Interpolate: {number: number, unit: unit, color: color }, // interpolators ?? move array & coords to svg and leave color
dom: DOM, // DOM manipulation
pp: parseProperty, prS: prepareStart, // init
truD: trueDimendion, truC: trueColor, rth: rgbToHex, htr: hexToRGB, gCS: getComputedStyle, // property parsing
truD: trueDimension, truC: trueColor, rth: rgbToHex, htr: hexToRGB, gCS: getComputedStyle, // property parsing
Easing: easing,
Tween: Tween, TweensTO: TweensTO, TweensFT: TweensFT // constructors
// Tween: Tween, TweensTO: TweensTO, TweensFT: TweensFT // constructors
tick : _t, tweens : _tws
};
}));