»
EnglishFrenchVietnamese

Print - Color Circling Picker - JavaScriptBank.com

Full version: jsB@nk » » Color Circling Picker
URL: https://www.javascriptbank.com/color-circling-picker.html

Color Circling Picker © JavaScriptBank.comThis JavaScript displays colorful circle on the web page, visitors move mouse on it to get color code.

Full version: jsB@nk » » Color Circling Picker
URL: https://www.javascriptbank.com/color-circling-picker.html



JavaScript
<script language="javascript">/*     This script downloaded from www.JavaScriptBank.com     Come to view and download over 2000+ free javascript at www.JavaScriptBank.com*/addary=new Array(); //redaddary[0]=new Array(0,1,0);  //red greenaddary[1]=new Array(-1,0,0); //greenaddary[2]=new Array(0,0,1);  //green blueaddary[3]=new Array(0,-1,0); //blueaddary[4]=new Array(1,0,0);  //red blueaddary[5]=new Array(0,0,-1); //redaddary[6]=new Array(255,1,1);clrary=new Array(360);for(i=0;i<6;i++) for(j=0;j<60;j++)  { clrary[60*i+j]=new Array(3);    for(k=0;k<3;k++)     { clrary[60*i+j][k]=addary[6][k];       addary[6][k]+=(addary[i][k]*4);     };  };function capture() { if(document.layers)    { layobj=document.layers['wheel'];      layobj.document.captureEvents(Event.MOUSEMOVE);      layobj.document.onmousemove=moved;    }   else    { layobj=document.all["wheel"];      layobj.onmousemove=moved;    }; };function moved(e) { y=(document.layers)?e.layerX:event.offsetX;   x=(document.layers)?e.layerY:event.offsetY;   sx=x-128; sy=y-128;   qx=(sx<0)?0:1; qy=(sy<0)?0:1;   q=2*qy+qx; quad=new Array(-180,360,180,0);   xa=Math.abs(sx); ya=Math.abs(sy);   d=ya*45/xa;   if(ya>xa) d=90-(xa*45/ya);   deg=Math.floor(Math.abs(quad[q]-d));   n=0;   sx=Math.abs(x-128); sy=Math.abs(y-128);   r=Math.sqrt((sx*sx)+(sy*sy));   if(x==128 & y==128)    { c="000000"; }   else    { for(i=0;i<3;i++)       { r2=clrary[deg][i]*r/64;         if(r>64) r2+=Math.floor(r-64)*4;          if(r2>255) r2=255;         n=256*n+Math.floor(r2);       };      c=n.toString(16);      while(c.length<6) c="0"+c;    };   if(document.layers)    { document.layers["wheel"].document.f.t.value="#"+c;      document.layers["wheel"].bgColor="#"+c;    }   else    { document.all["wheel"].document.f.t.value="#"+c;      document.all["wheel"].style.backgroundColor="#"+c;    };   return false; };</SCRIPT><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


HTML
<BODY onload=capture();><DIV id=wheel style="POSITION: relative; width: 256px; VISIBILITY: visible"><TABLE border=0 cellPadding=0 cellSpacing=0>  <TBODY>  <TR>    <TD><IMG border=0 height=256 src="colors8.jpg" width=256></TD></TR>  <TR>    <TD align=middle><BR>      <FORM name=f><INPUT name=t size=27></FORM></TD></TR></TBODY></TABLE></DIV></body><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


Files
http://javascriptbank.com/javascript/background/colors8.jpg