function calculateValue(start, end, pos){ if (typeof end === "function"){ end = end.call(node); } if ((typeof start === "number") && (typeof end === "number")){ return start + (end - start) * att.tween(pos); } if ((start.indexOf(" ") !== -1) && start.replace(/[^ ]/g, "").length === end.replace(/[^ ]/g, "").length){ start = start.split(" "); end = end.split(" "); var ret = []; for (var i = 0; i < start.length; i++){ ret.push(calculateValue(start[i], end[i], pos)); } return ret.join(" "); } if (start.charAt(0) === "#" && end.charAt(0) === "#"){ return color.mix(start, end, pos, att.rgb? "rgb": "hsl"); } var units = ["px", "pt", "%", "em", "deg"]; for (var i = 0; i < units.length; i++){ var re = (new RegExp(units[i] + "$")); if (re.test(start) && ((typeof end === "number") || re.test(end))){ return calculateValue(parseFloat(start), parseFloat(end), pos) + units[i]; } } return end; }
var value = directions.map(function(value){ var ret = style[pre + value + post]; if (post === "Color" && color.rgbStringRE.test(ret)){ ret = color.rgbStringToHex(ret); } return ret; });
get: function getStyle(node, name, pseudo){ if (Array.isArray(name)){ var ret = {}; for (var i = 0; i < name.length; i++){ ret[name[i]] = css.get(node, name[i], pseudo); } return ret; } if (!pseudo){ pseudo = ""; } var win = DOM.getWindow(node); var style; var realCalc = false; if (win.getComputedStyle){ style = win.getComputedStyle(node, pseudo); // no correct style properties in opera/safari/chrome if the node is not in den DOM-tree // Firefox will be captured here as well although there it would work if (!win.document.getElementsByTagName("html")[0].contains(node)){ style = node.style; } else { realCalc = true; } } else if (node.currentStyle){ // same in IE if (win.document.body && win.document.body.contains(node)){ style = node.currentStyle; realCalc = true; } else { style = node.style; } } else { return null; } if (!name){ return style; } name = name.replace(/-([a-z])/g, function(match, hit){ return hit.toUpperCase();}); var value; if (name in style){ value = style[name]; if (color.rgbStringRE.test(value)){ return color.rgbStringToHex(value); } if (typeof value !== "undefined" && value !== null && value.toString() !== ""){ return value; } } if (name in css.get.combined){ var temp = css.get.combined[name]; if (name){ temp = temp.replace(/\+/g, name); } return temp.replace(/\{([^\{\}]*)\}/g, function(m, name){ return css.get(node, name, pseudo); }); } if (css.get.hasOwnProperty(name)){ value = css.get[name](node, style, pseudo); if (value !== false){ return value; } } for (var i = css.get.regExp.length - 1; i >= 0; i--){ var match = css.get.regExp[i].regExp.exec(name); if (match){ value = css.get.regExp[i].get(node, style, pseudo, match); if (value !== false || css.get.regExp[i].canBeFalse){ return value; } } } for (var i = browserPre.length - 1; i >= 0; i--){ var newName = browserPre + name.firstToUpperCase(); if (newName in style){ return node.style[newName]; } } //return false; if ((name in style) && !realCalc){ return style[name]; } return null; },