Small improvement, attribute tweening can also take into account current measurement unit if no unit is specified in end values.

This commit is contained in:
thednp 2016-09-20 06:45:11 +03:00
parent 44816ad61e
commit 695f77c9c4

View file

@ -52,9 +52,9 @@
var ats = {}, p;
for ( p in o ) {
var prop = replaceUppercase(p);
if ( /%|px/.test(o[p]) || /%|px/.test(getCurrentValue(l,prop.replace(/_+[a-z]+/,''))) ) {
var u = K.truD(o[p]).u, s = /%/.test(u) ? '_percent' : '_'+u; prop = prop.replace(s,'');
var prop = replaceUppercase(p), cv = getCurrentValue(l,prop.replace(/_+[a-z]+/,''));
if ( /%|[a-z]/.test(o[p]) || /%|[a-z]/.test(cv) ) {
var u = K.truD(cv).u || K.truD(o[p]).u, s = /%/.test(u) ? '_percent' : '_'+u; prop = prop.replace(s,'');
if (!(p+s in atts)) {
atts[p+s] = function(l,p,a,b,v) {
l.setAttribute(prop, unit(a.v,b.v,b.u,v) );