ぐるぐるボタン

・ボタンがぐるぐる回ってます(笑)
・押すと・・・???

-----------------------------------------------------------------------------------------

var b = 300;
var g = 20;
var loc_x = new Array(
                        b+g,   b+g*2, b+g*3, b+g*4, b+g*5,
                        b+g*6, b+g*7, b+g*8, b+g*9, b+g*10,
                        b+g*9, b+g*8, b+g*7, b+g*6, b+g*5,
                        b+g*4, b+g*3, b+g*2, b+g*1
                     );
var loc_y = new Array(
                        b+g*5,  b+g*6, b+g*7, b+g*8, b+g*9,
                        b+g*10, b+g*9, b+g*8, b+g*7, b+g*6,
                        b+g*5,  b+g*4, b+g*3, b+g*2, b+g*1,
                        b+g,    b+g*2, b+g*3, b+g*4
                     );

var button1 = document.getElementById("btn1");
var button2 = document.getElementById("btn2");
var button3 = document.getElementById("btn3");
var button4 = document.getElementById("btn4");

var cnt1 = 0;
var cnt2 = 5;
var cnt3 = 10;
var cnt4 = 15;

function func() {
    button1.style.left = loc_x[cnt1];
    button1.style.top  = loc_y[cnt1];
    cnt1++;
    if (cnt1>=19) {
        cnt1 = 0;
    }
    
    button2.style.left = loc_x[cnt2];
    button2.style.top  = loc_y[cnt2];
    cnt2++;
    if (cnt2>=19) {
        cnt2 = 0;
    }
    
    button3.style.left = loc_x[cnt3];
    button3.style.top  = loc_y[cnt3];
    cnt3++;
    if (cnt3>=19) {
        cnt3 = 0;
    }
    
    button4.style.left = loc_x[cnt4];
    button4.style.top  = loc_y[cnt4];
    cnt4++;
    if (cnt4>=19) {
        cnt4 = 0;
    }
    
    setTimeout("func()",200);
}

-----------------------------------------------------------------------------------------

・なんのことはなくて、座標を変えてるだけです(笑)


Copyright © 2008-2017 Nekorald All rights reserved.