var x = new Array();
var y = new Array();
var th, len;
function sample(){
for(s=1;s<251;s++){
x[s]=new Array();
y[s]=new Array();
}
for (s = 1; s < 251; s++) {
for (sx = 0; sx < 360; sx++) {
x[s][sx] = 250 + s * Math.cos(sx * Math.PI / 180);
y[s][sx] = 250 + s * Math.sin(sx * Math.PI / 180);
}
}
th = 90;
dy = -1;
len = 200;
var timer;
var delay = 100;
var loop = function () {
th = th + 1;
if (th > 359) th = th - 360;
if (th < 0) th = th + 360;
len = len + dy;
if (len < 100) dy = 1;
if (len > 249) dy = -1;
h = 0;
if (th < 280) h = h + 1;
if (th > 260) h = h + 1;
if (len > 240) h = h + 1;
if (h == 3) th = 90;
if (h == 3) len = 250;
paint();
clearTimeout(timer);
timer = setTimeout(loop, delay);
}
loop();
}
function paint(){
var sub=new svgpaint();
str="<svg width=\"500\" height=\"500\">";
str = str + sub.rect(x[len][th], 500 - y[len][th], 10, 10, "red");
str=str+"</svg>";
$("#memo").html(str);
}
最終更新:2016年04月13日 14:22