网站首页 手机版
 注册 登录
您现在的位置: 畅无忧设计 >> 网页特效 >> 网站常用 >> 正文
最新文章
· JavaScript实现文本段落折叠展开和收
· 拖动滑块选择范围的网页插件代码
· JS版元素周期表
· jQuery数字统计并生成进度条动画的代
· 一个不错的CSS分页样式
· 实用的Flash全屏和退出全屏切换效果
· 纯CSS实现三列DIV等高布局
· jquery四色网页换肤代码
· 可展开和收起的在线客服代码
· 功能强大的漂亮计算器
热门文章
 登录时用Cookie保存用户名和密码
 获取16进制颜色值的取色器
 一个小型的JS在线文本编辑器
 JavaScript实现文本段落折叠展开和
 利用js给li标签添加序号
 通过QQ查询QQ用户的头像、昵称、地
 可展开和收起的在线客服代码
 js取色器
 基于jQuery的对象切换插件soChange
 javascript让状态栏不显示链接地址
相关文章
调用Windows自带的配色控件
用Javascript svg等技术实现了个自动配色器
来源:蓝色理想 更新时间:2010/8/13 20:51:43 阅读次数: 我要投稿
☉预览 ↓下载 #复制 +收藏
特效代码:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
  <head> 
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8"/> 
    <title>ColorWheel</title> 
    <script src="http://media.hellohtml5.com/blogger/pages/jsHarmonyColorPack/raphael.min.js" type="text/javascript" charset="utf-8""></script>
    <script src="http://media.hellohtml5.com/blogger/pages/jsHarmonyColorPack/raphael.colorwheel.js" type="text/javascript" charset="utf-8""></script>
    <script src="http://media.hellohtml5.com/blogger/pages/jsHarmonyColorPack/raphael.sunflower.js" type="text/javascript" charset="utf-8""></script>
    <script src="http://media.hellohtml5.com/blogger/pages/jsHarmonyColorPack/raphael.listcolor.js" type="text/javascript" charset="utf-8""></script>
    <script>
         window.onload=function(){var c=20,marginLeft=80,innerMarginTop=25,cwWidth=300,cwTitleHeight=40,RGBModelFlowerWidth=200,textBackgroundColor="#d0d0d0",textColor="#2e2e2e",textSizeTitle=22;var d=[],harmonyColorFlowerTitle=["Monochromatic","Complementary","Split-complementary","Analogous","Accented Analogic","Triad","Tetrad","Square"];var e=[];var f=Raphael(marginLeft,c,cwWidth,cwTitleHeight);f.rect(0,0,cwWidth,cwTitleHeight,cwTitleHeight/2,cwTitleHeight/2).attr({fill:textBackgroundColor,stroke:"none"});f.text().attr({text:"ColorWheel",x:cwWidth/2,y:cwTitleHeight/2,"font-size":textSizeTitle,"font-color":textColor});var g=Raphael(cwWidth+marginLeft*2,c,RGBModelFlowerWidth*3+marginLeft*2,cwTitleHeight);g.rect(0,0,RGBModelFlowerWidth*3+marginLeft*2,cwTitleHeight,cwTitleHeight/2,cwTitleHeight/2).attr({fill:textBackgroundColor,stroke:"none"});g.text().attr({text:"RGB Color Model",x:(RGBModelFlowerWidth*3+marginLeft*2)/2,y:cwTitleHeight/2,"font-size":textSizeTitle,"font-color":textColor});c+=cwTitleHeight;var k,cw=Raphael.colorwheel(marginLeft,c,cwWidth);cw.onchange=function(a){if(a!=k){for(var i=0;i<d.length;i++){d[i].harmoneyColor(a,harmonyColorFlowerTitle[i].replace(/\W+/ig,"").toLowerCase())}for(var b=0;b<e.length;b++){e[b].colors(d[b].harmoneyColor())}k=a}};var l={"0":"rgb(255,0,0)","4":"rgb(0,255,0)","8":"rgb(0,0,255)",text:"Primary"},RGBColorModelSecondary={"2":"rgb(255,255,0)","6":"rgb(0,255,255)","10":"rgb(255,0,255)",text:"Secondary"},RGBColorModelTertiary={"1":"rgb(255,128,0)","3":"rgb(128,255,0)","5":"rgb(0,255,128)","7":"rgb(0,128,255)","9":"rgb(128,0,255)","11":"rgb(255,0,128)",text:"Tertiary"};var m=[l,RGBColorModelSecondary,RGBColorModelTertiary];for(var i=0;i<m.length;i++){var n=RGBModelFlowerWidth;var o=Raphael.sunflower(cwWidth+marginLeft*2+(n+marginLeft)*i,c,n,m[i]);var h=cwWidth-RGBModelFlowerWidth;var r=Raphael(cwWidth+marginLeft*2+(n+marginLeft)*i,n+c,n,h);r.rect(0,innerMarginTop,n,h-innerMarginTop*2,(h-innerMarginTop*2)/2,(h-innerMarginTop*2)/2).attr({fill:textBackgroundColor,stroke:"none"});var p=r.text();p.attr({text:m[i].text,"font-size":textSizeTitle,fill:textColor});p.attr({x:n/2,y:h/2});o.onclick=function(a){cw.color(a)}}c+=cwTitleHeight;c+=cwWidth;var q=cwWidth+marginLeft+RGBModelFlowerWidth*3+marginLeft*2;var s=Raphael(marginLeft,c,cwWidth+marginLeft*2+RGBModelFlowerWidth*3+marginLeft*2,cwTitleHeight);s.rect(0,0,q,cwTitleHeight,cwTitleHeight/2,cwTitleHeight/2).attr({fill:textBackgroundColor,stroke:"none"});s.text().attr({text:"Color Harmonies",x:q/2,y:cwTitleHeight/2,"font-size":textSizeTitle,"font-color":textColor});c+=cwTitleHeight;var t=marginLeft/8;var u=8;var v=(q-(u-1)*t)/u;var w=20;var x=w/2;for(var j=0;j<u;j++){var y=Raphael.sunflower(marginLeft+(t+v)*j,c,v);var z=Raphael(marginLeft+(t+v)*j,c+v,v,w+x);z.rect(0,x,v,w,w/2,w/2).attr({fill:textBackgroundColor,stroke:"none"});var A=z.text();A.attr({text:harmonyColorFlowerTitle[j],x:v/2,y:w/2+x,"font-size":12,"font-color":textColor});y.harmoneyColor(cw.color(),harmonyColorFlowerTitle[j].replace(/\W+/ig,"").toLowerCase());d.push(y)}c+=v;c+=x;c+=w;c+=10;for(var B=0;B<d.length;B++){var C=Raphael.listcolor(marginLeft+(t+v)*B,c,v,d[B].harmoneyColor());e.push(C)}};
    </script>
    <style>
        html,body{background:#efefef;color:#666;margin:0;padding:0;text-align:center;font-family:Arial;}
    </style>
  </head>
  <body>
  </body>
</html>
☉预览 ↓下载 #复制 +收藏
特效说明:

用Javascript svg等技术实现了个自动配色器

  • 上一篇文章:
  • 下一篇文章:
  • 关于我们 - 联系我们 - 广告服务 - 在线投稿 - 友情链接 - 网站地图 - 版权声明
    CopyRight 2008-2010, CWYDESIGN.COM - 畅无忧设计, Inc. All Rights Reserved
    滇ICP备09005765号