アットウィキロゴ

じh

var x_pol=new Array();
var y_pol=new Array();
var number_pol;
var col;
var th_leg,len_leg,wide_leg;
 
 
function sample(){
 
col="blue";
 
th_leg = 0;
len_leg = 150;
wide_leg = 20;
 
number_pol = 6;
 
x_pol[1] =250;
y_pol[1] =250;
 
x_pol[4] =x_pol[1]+tranx(len_leg,th_leg);
y_pol[4] =y_pol[1]+trany(len_leg,th_leg);
 
x_pol[2] =x_pol[1]+tranx(wide_leg, th_leg + 270);
y_pol[2] =y_pol[1]+trany(wide_leg, th_leg + 270);
x_pol[6] =x_pol[1]+tranx(wide_leg, th_leg + 90);
y_pol[6] =y_pol[1]+trany(wide_leg, th_leg + 90);
 
 
x_pol[3] =x_pol[4]+tranx(wide_leg, th_leg + 270);
y_pol[3] =y_pol[4]+trany(wide_leg, th_leg + 270);
x_pol[5] =x_pol[4]+tranx(wide_leg, th_leg + 90);
y_pol[5] =y_pol[4]+trany(wide_leg, th_leg + 90);
 
 
 
 
    paint(); 
 
 
}
 
function paint(){
 
    var sub = new svgpaint();
 
 
str="<svg width=\"700\" height=\"700\">";
str=str+poly(col);
str=str+"</svg>";
 
$("#memo").html(str);
 
 
}
 
function tranx(le1,th1){
 
x1 = le1*Math.cos(th1 * Math.PI / 180);
return x1;   
}
 
function trany(le1,th1){
 
    y1 =  le1*Math.sin(th1 * Math.PI / 180);
 
 return y1;   
} 
 
 
function poly(col){
 
var str,data;
var s;
data="";
for(s=1;s<number_pol;s++){
data=data+x_pol[s]+","+y_pol[s]+",";
}
s=number_pol;
data=data+x_pol[s]+","+y_pol[s];
 
str="<polygon fill="+chopx(col)+" points="+chopx(data)+"/>";
 
return str; 
}
 
function chopx(str){
 
var strx;
 
strx="\""+str+"\"";
 
return strx;
 
}
最終更新:2015年06月09日 08:03