Update of /cvsroot/dynapi/dynapi3x/src/ext
In directory sc8-pr-cvs1:/tmp/cvs-serv12044/src/ext

Modified Files:
        functions.color.js 
Log Message:
uploaded by raymond

Index: functions.color.js
===================================================================
RCS file: /cvsroot/dynapi/dynapi3x/src/ext/functions.color.js,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** functions.color.js  10 Feb 2003 22:35:56 -0000      1.1.1.1
--- functions.color.js  9 Mar 2003 22:21:47 -0000       1.2
***************
*** 64,65 ****
--- 64,95 ----
        }
  };
+ f.fadeColor = function(from, to, percent){
+       if(!from || !to) return;
+       if(percent<0) return from;
+       else if(percent>100) to;
+       
+       if(from.substring(0,1)!='#') from='#'+from;
+       if(to.substring(0,1)!='#') to='#'+to;
+ 
+       from = {
+               red:parseInt(from.substring(1,3),16),
+               green:parseInt(from.substring(3,5),16),
+               blue:parseInt(from.substring(5,7),16)
+       }
+ 
+       to = {
+               red:parseInt(to.substring(1,3),16),
+               green:parseInt(to.substring(3,5),16),
+               blue:parseInt(to.substring(5,7),16)
+       }
+ 
+       var r=from.red+Math.round((percent/100)*(to.red-from.red));
+       var g=from.green+Math.round((percent/100)*(to.green-from.green));
+       var b=from.blue+Math.round((percent/100)*(to.blue-from.blue));
+ 
+       r = (r < 16 ? '0' : '') + r.toString(16);
+       g = (g < 16 ? '0' : '') + g.toString(16);
+       b = (b < 16 ? '0' : '') + b.toString(16);
+ 
+       return '#' + r + g + b;
+ };



-------------------------------------------------------
This SF.net email is sponsored by: ValueWeb: 
Dedicated Hosting for just $79/mo with 500 GB of bandwidth! 
No other company gives more support or power for your dedicated server
http://click.atdmt.com/AFF/go/sdnxxaff00300020aff/direct/01/
_______________________________________________
Dynapi-CVS mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dynapi-cvs

Reply via email to