アットウィキロゴ

p999nhnnh

function sample(){
 
    mode = 1;
 
    bx = 250;
    by = 500;
    dx = 1;
    dy = -10;
 
var timer;
var delay = 100;
 
var loop = function () {
 
    if (mode == 1) aa();
 
    if (mode == 2) bb();
 
 
    clearTimeout(timer);
    timer = setTimeout(loop, delay);
}
 
loop();           
 
 
 
}
 
function bb(){
 
    if (Math.random() > 0.9) {
 
 
        mode = 1;
 
        bx = 200;
        by = 500;
        dx = 2;
        dy = -10;
 
    }
 
 
    paintx();
 
 
 
}
 
 
 
function aa(){
 
    bx = bx + dx;
    by = by +dy;
 
 
    if (by < 0) mode = 2;
     if (bx < 0) dx = 2;
  if (bx > 500) dx = -2;
 
  paint();
 
}
 
function paint(){
 
var sub=new svgpaint();
 
str="<svg width=\"500\" height=\"500\">";
str=str+sub.rect(bx,500-by,50,59,"blue");      
str=str+"</svg>";
 
$("#memo").html(str);   
 
}
 
function paintx(){
 
var sub=new svgpaint();
 
str="<svg width=\"500\" height=\"500\">";
str=str+sub.rect(100,100,50,50,"red");      
str=str+"</svg>";
 
$("#memo").html(str);   
 
}
最終更新:2016年04月11日 13:07