Browse files

Fix undefined locals in nextColor()

  • Loading branch information...
1 parent 15bb0c0 commit 486b0287b81ba5f1c0c7d8e36b1aa3def1d60dc8 @danro committed Mar 6, 2012
Showing with 3 additions and 3 deletions.
  1. +1 −1 morpheus.js
  2. +1 −1 morpheus.min.js
  3. +1 −1 src/morpheus.js
View
2 morpheus.js
@@ -195,7 +195,7 @@
// this gets you the next hex in line according to a 'position'
function nextColor(pos, start, finish) {
- var r = [], i, e
+ var r = [], i, e, from, to
for (i = 0; i < 6; i++) {
from = Math.min(15, parseInt(start.charAt(i), 16))
to = Math.min(15, parseInt(finish.charAt(i), 16))
View
2 morpheus.min.js
@@ -3,4 +3,4 @@
* https://github.com/ded/morpheus - (c) Dustin Diaz 2011
* License MIT
*/
-!function(a,b){typeof define=="function"?define(b):typeof module!="undefined"?module.exports=b():this[a]=b()}("morpheus",function(){function q(a,b){var c={},d;if(d=a.match(h))c.rotate=A(d[1],b?b.rotate:null);if(d=a.match(i))c.scale=A(d[1],b?b.scale:null);if(d=a.match(j))c.skewx=A(d[1],b?b.skewx:null),c.skewy=A(d[3],b?b.skewy:null);if(d=a.match(k))c.translatex=A(d[1],b?b.translatex:null),c.translatey=A(d[3],b?b.translatey:null);return c}function r(a){var b="";return"rotate"in a&&(b+="rotate("+a.rotate+"deg) "),"scale"in a&&(b+="scale("+a.scale+") "),"translatex"in a&&(b+="translate("+a.translatex+"px,"+a.translatey+"px) "),"skewx"in a&&(b+="skew("+a.skewx+"deg,"+a.skewy+"deg)"),b}function s(a,b,c){return"#"+(1<<24|a<<16|b<<8|c).toString(16).slice(1)}function t(a){var b=/rgba?\((\d+),\s*(\d+),\s*(\d+)/.exec(a);return(b?s(b[1],b[2],b[3]):a).replace(/#(\w)(\w)(\w)$/,"#$1$1$2$2$3$3")}function u(a){return a.replace(/-(.)/g,function(a,b){return b.toUpperCase()})}function v(a){return typeof a=="function"}function w(a,b,c,d,e,f){function m(a){var n=a-j;if(n>g||k)return f=isFinite(f)?f:1,k?l&&b(f):b(f),c&&c.apply(h);isFinite(f)?b(i*d(n/g)+e):b(d(n/g)),p(m)}d=v(d)?d:B.easings[d]||function(a){return Math.sin(a*Math.PI/2)};var g=a||1e3,h=this,i=f-e,j=+(new Date),k=0,l=0;return p(m),{stop:function(a){k=1,l=a,a||(c=null)}}}function x(a,b){var c=a.length,d=[],e,f;for(e=0;e<c;++e)d[e]=[a[e][0],a[e][1]];for(f=1;f<c;++f)for(e=0;e<c-f;++e)d[e][0]=(1-b)*d[e][0]+b*d[parseInt(e+1,10)][0],d[e][1]=(1-b)*d[e][1]+b*d[parseInt(e+1,10)][1];return[d[0][0],d[0][1]]}function y(a,b,c){var d=[],e,f;for(e=0;e<6;e++)from=Math.min(15,parseInt(b.charAt(e),16)),to=Math.min(15,parseInt(c.charAt(e),16)),f=Math.floor((to-from)*a+from),f=f>15?15:f<0?0:f,d[e]=f.toString(16);return"#"+d.join("")}function z(a,b,c,d,e,f,g){if(e=="transform"){g={};for(var h in c[f][e])g[h]=h in d[f][e]?Math.round(((d[f][e][h]-c[f][e][h])*a+c[f][e][h])*1e3)/1e3:c[f][e][h];return g}return typeof c[f][e]=="string"?y(a,c[f][e],d[f][e]):(g=Math.round(((d[f][e]-c[f][e])*a+c[f][e])*1e3)/1e3,e in l||(g+=b[f][e]||"px"),g)}function A(a,b,c,d,e){return(c=f.exec(a))?(e=parseFloat(c[2]))&&b+(c[1]=="+"?1:-1)*e:parseFloat(a)}function B(a,b){var c=a?c=isFinite(a.length)?a:[a]:[],d,f=b.complete,h=b.duration,i=b.easing,j=b.bezier,k=[],l=[],p=[],s=[],y,B;delete b.complete,delete b.duration,delete b.easing,delete b.bezier,j&&(y=b.left,B=b.top,delete b.right,delete b.bottom,delete b.left,delete b.top);for(d=c.length;d--;){k[d]={},l[d]={},p[d]={};if(j){var C=o(c[d],"left"),D=o(c[d],"top"),E=[A(v(y)?y(c[d]):y||0,parseFloat(C)),A(v(B)?B(c[d]):B||0,parseFloat(D))];s[d]=v(j)?j(c[d],E):j,s[d].push(E),s[d].unshift([parseInt(C,10),parseInt(D,10)])}for(var F in b){var G=o(c[d],F),H,I=v(b[F])?b[F](c[d]):b[F];if(typeof I=="string"&&e.test(I)&&!e.test(G)){delete b[F];continue}k[d][F]=F=="transform"?q(G):typeof I=="string"&&e.test(I)?t(G).slice(1):parseFloat(G),l[d][F]=F=="transform"?q(I,k[d][F]):typeof I=="string"&&I.charAt(0)=="#"?t(I).slice(1):A(I,parseFloat(G)),typeof I=="string"&&(H=I.match(g))&&(p[d][F]=H[1])}}return w.apply(c,[h,function(a,e,f){for(d=c.length;d--;){j&&(f=x(s[d],a),c[d].style.left=f[0]+"px",c[d].style.top=f[1]+"px");for(var g in b)e=z(a,p,k,l,g,d),g=="transform"?c[d].style[m]=r(e):g=="opacity"&&!n?c[d].style.filter="alpha(opacity="+e*100+")":c[d].style[u(g)]=e}},f,i])}var a=this,b=document,c=window,d=b.documentElement,e=/^rgb\(|#/,f=/^([+\-])=([\d\.]+)/,g=/^(?:[\+\-]=)?\d+(?:\.\d+)?(%|in|cm|mm|em|ex|pt|pc|px)$/,h=/rotate\(((?:[+\-]=)?([\-\d\.]+))deg\)/,i=/scale\(((?:[+\-]=)?([\d\.]+))\)/,j=/skew\(((?:[+\-]=)?([\-\d\.]+))deg, ?((?:[+\-]=)?([\-\d\.]+))deg\)/,k=/translate\(((?:[+\-]=)?([\-\d\.]+))px, ?((?:[+\-]=)?([\-\d\.]+))px\)/,l={lineHeight:1,zoom:1,zIndex:1,opacity:1,transform:1},m=function(){var a=b.createElement("a").style,c=["webkitTransform","MozTransform","OTransform","msTransform","Transform"],d;for(d=0;d<c.length;d++)if(c[d]in a)return c[d]}(),n=function(){return typeof b.createElement("a").style.opacity!="undefined"}(),o=b.defaultView&&b.defaultView.getComputedStyle?function(a,c){c=c=="transform"?m:c;var d=null,e=b.defaultView.getComputedStyle(a,"");return e&&(d=e[u(c)]),a.style[c]||d}:d.currentStyle?function(a,b){b=u(b);if(b=="opacity"){var c=100;try{c=a.filters["DXImageTransform.Microsoft.Alpha"].opacity}catch(d){try{c=a.filters("alpha").opacity}catch(e){}}return c/100}var f=a.currentStyle?a.currentStyle[b]:null;return a.style[b]||f}:function(a,b){return a.style[u(b)]},p=function(){return c.requestAnimationFrame||c.webkitRequestAnimationFrame||c.mozRequestAnimationFrame||c.oRequestAnimationFrame||c.msRequestAnimationFrame||function(a){c.setTimeout(function(){a(+(new Date))},10)}}();return B.tween=w,B.getStyle=o,B.bezier=x,B.transform=m,B.parseTransform=q,B.formatTransform=r,B.easings={},B})
+!function(a,b){typeof define=="function"?define(b):typeof module!="undefined"?module.exports=b():this[a]=b()}("morpheus",function(){function q(a,b){var c={},d;if(d=a.match(h))c.rotate=A(d[1],b?b.rotate:null);if(d=a.match(i))c.scale=A(d[1],b?b.scale:null);if(d=a.match(j))c.skewx=A(d[1],b?b.skewx:null),c.skewy=A(d[3],b?b.skewy:null);if(d=a.match(k))c.translatex=A(d[1],b?b.translatex:null),c.translatey=A(d[3],b?b.translatey:null);return c}function r(a){var b="";return"rotate"in a&&(b+="rotate("+a.rotate+"deg) "),"scale"in a&&(b+="scale("+a.scale+") "),"translatex"in a&&(b+="translate("+a.translatex+"px,"+a.translatey+"px) "),"skewx"in a&&(b+="skew("+a.skewx+"deg,"+a.skewy+"deg)"),b}function s(a,b,c){return"#"+(1<<24|a<<16|b<<8|c).toString(16).slice(1)}function t(a){var b=/rgba?\((\d+),\s*(\d+),\s*(\d+)/.exec(a);return(b?s(b[1],b[2],b[3]):a).replace(/#(\w)(\w)(\w)$/,"#$1$1$2$2$3$3")}function u(a){return a.replace(/-(.)/g,function(a,b){return b.toUpperCase()})}function v(a){return typeof a=="function"}function w(a,b,c,d,e,f){function m(a){var n=a-j;if(n>g||k)return f=isFinite(f)?f:1,k?l&&b(f):b(f),c&&c.apply(h);isFinite(f)?b(i*d(n/g)+e):b(d(n/g)),p(m)}d=v(d)?d:B.easings[d]||function(a){return Math.sin(a*Math.PI/2)};var g=a||1e3,h=this,i=f-e,j=+(new Date),k=0,l=0;return p(m),{stop:function(a){k=1,l=a,a||(c=null)}}}function x(a,b){var c=a.length,d=[],e,f;for(e=0;e<c;++e)d[e]=[a[e][0],a[e][1]];for(f=1;f<c;++f)for(e=0;e<c-f;++e)d[e][0]=(1-b)*d[e][0]+b*d[parseInt(e+1,10)][0],d[e][1]=(1-b)*d[e][1]+b*d[parseInt(e+1,10)][1];return[d[0][0],d[0][1]]}function y(a,b,c){var d=[],e,f,g,h;for(e=0;e<6;e++)g=Math.min(15,parseInt(b.charAt(e),16)),h=Math.min(15,parseInt(c.charAt(e),16)),f=Math.floor((h-g)*a+g),f=f>15?15:f<0?0:f,d[e]=f.toString(16);return"#"+d.join("")}function z(a,b,c,d,e,f,g){if(e=="transform"){g={};for(var h in c[f][e])g[h]=h in d[f][e]?Math.round(((d[f][e][h]-c[f][e][h])*a+c[f][e][h])*1e3)/1e3:c[f][e][h];return g}return typeof c[f][e]=="string"?y(a,c[f][e],d[f][e]):(g=Math.round(((d[f][e]-c[f][e])*a+c[f][e])*1e3)/1e3,e in l||(g+=b[f][e]||"px"),g)}function A(a,b,c,d,e){return(c=f.exec(a))?(e=parseFloat(c[2]))&&b+(c[1]=="+"?1:-1)*e:parseFloat(a)}function B(a,b){var c=a?c=isFinite(a.length)?a:[a]:[],d,f=b.complete,h=b.duration,i=b.easing,j=b.bezier,k=[],l=[],p=[],s=[],y,B;delete b.complete,delete b.duration,delete b.easing,delete b.bezier,j&&(y=b.left,B=b.top,delete b.right,delete b.bottom,delete b.left,delete b.top);for(d=c.length;d--;){k[d]={},l[d]={},p[d]={};if(j){var C=o(c[d],"left"),D=o(c[d],"top"),E=[A(v(y)?y(c[d]):y||0,parseFloat(C)),A(v(B)?B(c[d]):B||0,parseFloat(D))];s[d]=v(j)?j(c[d],E):j,s[d].push(E),s[d].unshift([parseInt(C,10),parseInt(D,10)])}for(var F in b){var G=o(c[d],F),H,I=v(b[F])?b[F](c[d]):b[F];if(typeof I=="string"&&e.test(I)&&!e.test(G)){delete b[F];continue}k[d][F]=F=="transform"?q(G):typeof I=="string"&&e.test(I)?t(G).slice(1):parseFloat(G),l[d][F]=F=="transform"?q(I,k[d][F]):typeof I=="string"&&I.charAt(0)=="#"?t(I).slice(1):A(I,parseFloat(G)),typeof I=="string"&&(H=I.match(g))&&(p[d][F]=H[1])}}return w.apply(c,[h,function(a,e,f){for(d=c.length;d--;){j&&(f=x(s[d],a),c[d].style.left=f[0]+"px",c[d].style.top=f[1]+"px");for(var g in b)e=z(a,p,k,l,g,d),g=="transform"?c[d].style[m]=r(e):g=="opacity"&&!n?c[d].style.filter="alpha(opacity="+e*100+")":c[d].style[u(g)]=e}},f,i])}var a=this,b=document,c=window,d=b.documentElement,e=/^rgb\(|#/,f=/^([+\-])=([\d\.]+)/,g=/^(?:[\+\-]=)?\d+(?:\.\d+)?(%|in|cm|mm|em|ex|pt|pc|px)$/,h=/rotate\(((?:[+\-]=)?([\-\d\.]+))deg\)/,i=/scale\(((?:[+\-]=)?([\d\.]+))\)/,j=/skew\(((?:[+\-]=)?([\-\d\.]+))deg, ?((?:[+\-]=)?([\-\d\.]+))deg\)/,k=/translate\(((?:[+\-]=)?([\-\d\.]+))px, ?((?:[+\-]=)?([\-\d\.]+))px\)/,l={lineHeight:1,zoom:1,zIndex:1,opacity:1,transform:1},m=function(){var a=b.createElement("a").style,c=["webkitTransform","MozTransform","OTransform","msTransform","Transform"],d;for(d=0;d<c.length;d++)if(c[d]in a)return c[d]}(),n=function(){return typeof b.createElement("a").style.opacity!="undefined"}(),o=b.defaultView&&b.defaultView.getComputedStyle?function(a,c){c=c=="transform"?m:c;var d=null,e=b.defaultView.getComputedStyle(a,"");return e&&(d=e[u(c)]),a.style[c]||d}:d.currentStyle?function(a,b){b=u(b);if(b=="opacity"){var c=100;try{c=a.filters["DXImageTransform.Microsoft.Alpha"].opacity}catch(d){try{c=a.filters("alpha").opacity}catch(e){}}return c/100}var f=a.currentStyle?a.currentStyle[b]:null;return a.style[b]||f}:function(a,b){return a.style[u(b)]},p=function(){return c.requestAnimationFrame||c.webkitRequestAnimationFrame||c.mozRequestAnimationFrame||c.oRequestAnimationFrame||c.msRequestAnimationFrame||function(a){c.setTimeout(function(){a(+(new Date))},10)}}();return B.tween=w,B.getStyle=o,B.bezier=x,B.transform=m,B.parseTransform=q,B.formatTransform=r,B.easings={},B})
View
2 src/morpheus.js
@@ -190,7 +190,7 @@
// this gets you the next hex in line according to a 'position'
function nextColor(pos, start, finish) {
- var r = [], i, e
+ var r = [], i, e, from, to
for (i = 0; i < 6; i++) {
from = Math.min(15, parseInt(start.charAt(i), 16))
to = Math.min(15, parseInt(finish.charAt(i), 16))

0 comments on commit 486b028

Please sign in to comment.