경치와 사진/Tag 공부

배경유영 script tag

hongil81 2012. 4. 25. 14:43

<STYLE type=text/css>
.img {position:absolute;left:-10000;border:#000000 solid 1px;cursor:pointer;}
</STYLE>

<SCRIPT type=text/javascript><!--
window.onerror = new Function("return true");
screen.bufferDepth = 10;
object = new Array();
////////////////////
am = 40;
TEMPO = 5000;
///////////////////
W0 = 0;
H0 = 0;
nx = 0;
ny = 0;
K  = 0;
Kb = -1;

function zoomIn(N){
    object[N].img.cursor="crosshair";
    object[N].zoomIn();
    object[N].img.zIndex=0;
}

function zoomOut(N){
    object[N].img.cursor="pointer";
    object[N].zoomOut();
}

function zyva(N){
    if(N!=Kb){
        clearTimeout(object[Kb].TO);
        zoomIn(N);
        object[Kb].BR=true;
        zoomOut(Kb);
        Kb=N;
    }
}

function nextImg(){
    if(Kb>=0)zoomOut(Kb);
    Kb=K%nbI;
    zoomIn(Kb);
    K++;
}

function CObj(N,img){
    this.A   = Math.round(Math.random()*10)+1;
    this.B   = Math.round(Math.random()*10)+3;
    this.k   = 0.1 * N;
    this.L   = 0;
    this.T   = 0;
    this.W   = W0;
    this.H   = H0;
    this.xb  = 0;
    this.img = img.style;
    this.img.zIndex = 1;
    this.obj = "object["+N+"].";
    this.BR  = false;
    this.TO  = 0;

    this.mainloop = function () {
        with (this) {
            k += 0.001;
            L  = ((nx-W) * .5) + (Math.cos(k * A) * .5) * (nx - W);
            T  = ((ny-H) * .5) + (Math.cos(k * B) * .5) * (ny - H);
            with(img){
                width  = Math.floor(W);
                height = Math.floor(H);
                top    = Math.floor(T);
                left   = Math.floor(L);
            }
            setTimeout(obj+"mainloop();", 32);
        }
    }

    this.zoomIn  = function() {
        with (this) {
            W += (nx - W) * (.1 * am/(.01+(nx - W)));
            H += (ny - H) * (.1 * am/(.01+(nx - W)));
            if(!BR){
                if(W >= nx) TO=setTimeout("nextImg();", TEMPO);
                else setTimeout(obj+"zoomIn();", 32);
            }
        }
    }

    this.zoomOut  = function() {
        with (this) {
            W -= W / (am * .5);
            H -= H / (am * .5);
            if(W >= 2) setTimeout(obj+"zoomOut();", 32);
            else {
                BR=false;
                img.zIndex=1;
                zoomStart();
            }
        }
    }
    this.zoomStart = function() {
        with (this) {
            W++;
            H += H0 / W0;
            if(W<W0 || H<H0)setTimeout(obj+"zoomStart();", 32);
        }
    }

    this.mainloop();
}

function resize() {
    nx = document.body.clientWidth;
    ny = document.body.clientHeight;
    W0  = nx / nbI;
    H0  = ny / nbI;
    if(H0<W0*.56)H0=W0*.56;
}
onresize = resize;

onload = function() {
    img = document.getElementById("IMG").getElementsByTagName("img");
    nbI = img.length;
    resize();
    for(i=0;i<nbI;i++) object[i] = new CObj(i,img[i]);
    nextImg();
}
//-->
</SCRIPT>
 
<DIV style="Z-INDEX: 1" id=IMG><img src="https://t1.daumcdn.net/cfile/blog/2067B1404F978D123C" class="txc-image" onclick="zyva(0)" /> <img src="https://t1.daumcdn.net/cfile/blog/1564D4404F978D133E" class="txc-image" onclick="zyva(1)" /><img src="https://t1.daumcdn.net/cfile/blog/1672E3404F978D1423" class="txc-image" onclick="zyva(2)" /> <img src="https://t1.daumcdn.net/cfile/blog/187287404F978D1424" class="txc-image" onclick="zyva(3)" /><img src="https://t1.daumcdn.net/cfile/blog/166F50404F978D152F" class="txc-image" onclick="zyva(4)" /> <img src="https://t1.daumcdn.net/cfile/blog/137115404F978D162A" class="txc-image" onclick="zyva(5)" /> <img src="https://t1.daumcdn.net/cfile/blog/18740C404F978D1626" class="txc-image" onclick="zyva(6)" /> </DIV>