标题:子午流注
只看楼主
leeqihero
Rank: 3Rank: 3
等 级:论坛游侠
威 望:7
帖 子:122
专家分:135
注 册:2016-3-24
结帖率:20%
 问题点数:0 回复次数:0 
子午流注
程序代码:
<html>
<head>
<meta charset=utf-8>
</head>
<body>
<canvas id=0></canvas>
</body>
<script>
$=function(b){return document.getElementById(b)};
R=800;
cnv=$(0);
cnv.width=2*R;
cnv.height=2*R;
circle={
    n:0,
    diff:0,
    data:[',,,神门,,,,,,太溪,,,,,冲阳,,,,,,,,,,,太白,,,,,丘墟,,,,,,合谷,,,,,太冲,阳池,,,,,太渊,,,,,腕骨,大陵,,,,,京骨,'.split(','),'经,荥,合,俞,经,井,经,荥,合,俞,井,经,荥,合,俞,经,井,经,荥,合,荥,井,经,荥,合,俞,合,井,经,荥,俞,荥,井,经,荥,合,俞,合,井,经,合,俞,俞,井,经,荥,合,俞,井,井,荥,合,俞,俞,井,经,荥,合,俞,井'.split(','),'火,火,土,土,火,木,火,火,土,土,金,金,水,水,木,金,金,金,水,水,水,木,火,火,土,土,土,木,火,火,木,火,金,金,水,水,木,水,金,金,土,土,木,木,火,火,土,土,金,木,水,水,木,土,金,金,水,水,木,木'.split(','),'胆,肝,小肠,心,三焦,脾,大肠,肺,膀胱,肾,胆,肝,小肠,心,胃,心包,大肠,肺,膀胱,肾,三焦,肝,小肠,心,胃,脾,三焦,肺,膀胱,肾,胆,心包,小肠,心,胃,脾,大肠,心包,膀胱,肾,胆,肝,三焦,心,胃,脾,大肠,肺,三焦,肾,胆,肝,小肠,心包,胃,脾,大肠,肺,膀胱,心包'.split(','),'阳辅,行间,小海,神门,支沟,隐白,阳溪,鱼际,委中,太溪,足窍阴,中封,前谷,少海,陷谷,间使,商阳,经渠,足通谷,阴谷,液门,大敦,阳谷,少府,足三里,太白,天井,少商,昆仑,然谷,足临泣,劳宫,少泽,灵道,内庭,阴陵泉,三间,曲泽,至阴,复溜,阳陵泉,太冲,中渚,少冲,解溪,大都,曲池,太渊,关冲,涌泉,侠溪,曲泉,后溪,大陵,历兑,商丘,二间,尺泽,束骨,中冲'.split(','),'子,丑,寅,卯,辰,巳,午,未,申,酉,戌,亥,子,丑,寅,卯,辰,巳,午,未,申,酉,戌,亥,子,丑,寅,卯,辰,巳,午,未,申,酉,戌,亥,子,丑,寅,卯,辰,巳,午,未,申,酉,戌,亥,子,丑,寅,卯,辰,巳,午,未,申,酉,戌,亥'.split(','),'甲,乙,丙,丁,戊,己,庚,辛,壬,癸,甲,乙,丙,丁,戊,己,庚,辛,壬,癸,甲,乙,丙,丁,戊,己,庚,辛,壬,癸,甲,乙,丙,丁,戊,己,庚,辛,壬,癸,甲,乙,丙,丁,戊,己,庚,辛,壬,癸,甲,乙,丙,丁,戊,己,庚,辛,壬,癸'.split(',')],
    size:[20,20,20,20,14,40,40],
    color:['red','black','black','red','red','black','black'],
    R:[770,740,715,680,655,620,570],
    ringColor:[0,'black',0,0,0,0,'black'],
    run:function(){
        cnv.height=2*R;
        var cxt=cnv.getContext('2d');
        cxt.textAlign='center';    
        for(var step=0;step<this.data.length;step++){
            var data=this.data[step];
            cxt.translate(R,R);
            cxt.fillStyle=this.color[step];
            var r=this.R[step];
            var f=this.size[step];
            if(this.ringColor[step]){
                cxt.strokeStyle=this.ringColor[step];
                cxt.beginPath();
                cxt.arc(0,0,r-f,0,360,false);
                cxt.stroke();
            }
            cxt.font=f+'px Arial';
            var len=data.length;
            cxt.rotate(this.diff);
            for(var i=0;i<len;i++){
                cxt.fillText(data[i],0,r);
                cxt.rotate(2*Math.PI/len);
            };
            cxt.rotate(-this.diff);
            cxt.translate(-R,-R);
        };
    }
};
circle.run();
cnv.addEventListener('click',function(e){
    var cRect=cnv.getBoundingClientRect();              
    var X=Math.round(e.clientX-cRect.left);
    circle.diff+=(-1)**(X>R)*Math.PI/30;
    circle.run();
});
</script>
</html>
搜索更多相关主题的帖子: this data var split step 
2019-12-23 17:00



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-498588-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.113305 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved