넥

CSS로 만든 - 3D 입체 갤러리

· 2007-07-24 (화) 20:01:43 · 6352 · 2


CSS 3D 갤러리 소스
하단의 태그 중 이미지만 변경하시면 됩니다.
이미지를 클릭하시면 '클로즈업'되면서 지나갑니다.


< 예제 >

test.png




-----------------   소스   -------------------

<html>
<head>
<title>NestStep's Song' pics</title>

<style type="text/css">

    #canvas {
        position:absolute;
        left: 0%;
        top: 0%;
        width: 100%;
        height: 100%;
        background: #000;
        overflow: hidden;
    }
    #canvas img {
        position: absolute;
        background: #666;
        overflow: hidden;
        cursor: pointer;
        left: 100%;
        border-color: #000;
        border-style: solid;
        border-width: 1px;
    }
    #canvas span {
        position: absolute;
        color: #9C9;
        font-family: 'courier new', typewriter, matrix, monospace;
        font-size: 0px;
        white-space: nowrap;
        left: -1000px;
        background:#010;
        filter: alpha(opacity=90);
        opacity:0.9;
    }
</style>
<script type="text/javascript">
var O    = [];
var cont = 0;
var N    = 0;
var S    = 0;
var img, spa;
var s = {xm:0, ym:0, nx:0, ny:0, nw:0, nh:0, cx:0, cy:0, zoom:1};
var c = {x:0, y:0, z:-40000, xt:0, yt:0, zt:0};

//////////////////////////////////////////////////////////////////////////////

function resize() {
   
    with(document.getElementById("canvas")){
        s.nx = offsetLeft;
        s.ny = offsetTop;
        s.nw = offsetWidth;
        s.nh = offsetHeight;
        s.zoom = s.nh / 700;
    }
}
onresize = resize;

document.onmousemove = function(e){
    if(window.event) e=window.event;
    s.xm = (e.x || e.clientX) - s.nx - s.nw * .5;
    s.ym = (e.y || e.clientY) - s.ny - s.nh * .5;
}

function CObj(n){
    this.n = n;
    this.x = s.zoom * Math.random() * s.nw * 2 - s.nw;
    this.y = s.zoom * Math.random() * s.nh * 2 - s.nh;
    this.z = Math.round(n * (10000 / N));
    this.w = img[n].width;
    this.h = img[n].height;
    this.oxt = spa[n];
    this.txt = spa[n].innerHTML;
    this.oxt.innerHTML = "";
    this.obj = img[n];
    this.obj.parent = this;
    this.obj.onclick = new Function("this.parent.click();");
    this.obj.ondrag = new Function("return false;");
    this.oxt.style.zIndex = this.obj.style.zIndex = Math.round(1000000 - this.z);
    this.F = false;
    this.CF = 100;
    this.anim = function(){
        with(this){
            var f = 700 + z - c.z;
            if (f > 0) {
                var d = 1000 / f;
                var X = s.nw * .5 + ((x - c.x - s.cx) * d);
                var Y = s.nh * .5 + ((y - c.y - s.cy) * d);
                var W = d * w * s.zoom;
                var H = d * h * s.zoom;
                with(obj.style){
                    left   = Math.round(X - W * .5)+"px";
                    top    = Math.round(Y - H * .5)+"px";
                    width  = Math.round(W)+"px";
                    height = Math.round(H)+"px";
                }
                with(oxt.style){
                    visibility = (CF-- > 0 && Math.random() > .9)?"hidden":"visible";
                    left   = Math.round(X - W * .5)+"px";
                    top    = Math.round(Y + H * .5)+"px";
                    if((c.zt - c.z) < 20){
                        if(!F){
                            F = true;
                            CF = Math.random() * 200;
                            fontSize = 1 + Math.round(d * 20 * s.zoom)+"px";
                            var T = "";
                            var tn = txt.length;
                            for(var i=0; i<tn; i++){
                                T+=txt.charAt(i);
                                setTimeout('O['+n+'].oxt.innerHTML = "'+(T+"_")+'";', Math.round(f/5)+16*i);
                            }
                        }
                    } else F=false, oxt.innerHTML="";
                }
            } else {
                x = s.zoom * Math.random() * s.nw * 2 - s.nw;
                y = s.zoom * Math.random() * s.nh * 2 - s.nh;
                z += 10000;
                oxt.style.zIndex = obj.style.zIndex = Math.round(1000000 - z);
            }
        }
    }
   
    this.click = function(){
        with(this){
            if(S!=this){
                c.xt = x;
                c.yt = y;
                c.zt = z;
                S = this;
            } else {
                S = 0;
                c.zt += 1600;
            }
        }
    }
}

function run(){
    s.cx += (s.xm - s.cx) / 10;
    s.cy += (s.ym - s.cy) / 10;
    c.x  += (c.xt - c.x)  / 20;
    c.y  += (c.yt - c.y)  / 20;
    c.z  += (c.zt - c.z)  / 20;
    for(var i=0; i<N; i++) O[i].anim();
    setTimeout("run();", 16);
}

onload = function() {
    resize();
    s.cx = s.nw / 2;
    s.cy = s.nh / 2;
    cont = document.getElementById("canvas");
    img = document.getElementById("canvas").getElementsByTagName("img");
    spa = document.getElementById("canvas").getElementsByTagName("span");
    N = img.length;
    for(var i=0; i<N; i++) O[i] = new CObj(i);
    run();
    O[0].click();

}

</script>
</head>

<body>

<div id="canvas">
<img src="http://cbingoimage.naver.com/data2/bingo_12/imgbingo_26/kmy0nagayo/24493/kmy0nagayo_10.jpg"><span>hi~~~~~~</span>
<img src="http://cafe.naver.com/ViewImage.nhn?img=http://cafefiles.naver.net/data21/2007/3/18/141/desting7_17.jpg"><span>Welcome to www.uplusweb.co.kr</span>
<img src="http://cbingoimage.naver.com/data3/bingo_82/imgbingo_29/mony87/29907/mony87_87.jpg"><span>Oh~~~~</span>
<img src="http://cbingoimage.naver.com/data3/bingo_5/imgbingo_45/tok888/24617/tok888_118.jpg"><span>Welcome</span>
<img src="http://cbingoimage.naver.com/data/bingo_92/imgbingo_92/kinisky/29847/kinisky_37.jpg"><span>llll</span>
<img src="http://cbingoimage.naver.com/data3/bingo_98/imgbingo_84/windyemail/30864/windyemail_13.jpg"><span>ttt</span>
<img src="http://cbingoimage.naver.com/data3/bingo_5/imgbingo_99/hanb5/29359/hanb5_12.jpg"><span>ttt</span>
<img src="http://cbingoimage.naver.com/data3/bingo_56/imgbingo_91/seulkee0926/37699/seulkee0926_27.jpg"><span>jjj</span>
<img src="http://cbingoimage.naver.com/data3/bingo_40/imgbingo_79/sashin60/37578/sashin60_4.jpg"><span>qqqqq</span>
<img src="http://cafe.naver.com/ViewImage.nhn?img=http://cafefiles.naver.net/data24/2006/5/30/192/%BC%DB%C7%FD%B1%B36.jpg"><span>aaaa</span>
<img src="http://cbingoimage.naver.com/data2/bingo_73/imgbingo_23/jomatt87/16032/jomatt87_4.jpg"><span>sss</span>
<img src="http://cafe.naver.com/ViewImage.nhn?img=http://cafefiles.naver.net/data8/2005/2/28/25/song.jpg"><span>ssssssssssss</span>
<img src="http://cafe.naver.com/ViewImage.nhn?img=http://cafefiles.naver.net/data7/2005/2/28/61/n2o_1412_59770_1.jpg"><span>ssssssssssss</span>
<img src="http://cafe.naver.com/ViewImage.nhn?img=http://cafefiles.naver.net/data8/2005/2/28/296/haegyo.jpg"><span>ssssssssssss</span>
<img src="http://cafe.naver.com/ViewImage.nhn?img=http://cafefiles.naver.net/data8/2005/2/28/28/17.jpg"><span>ssssssssssss</span>
<img src="http://cafe.naver.com/ViewImage.nhn?img=http://cafefiles.naver.net/data7/2005/2/28/297/41808-jinistars.jpg"><span>ssssssssssss</span>
</div>


</body>
</html>

------------   소스 끝  -----------------------


[이 게시물은 관리자님에 의해 2011-10-31 17:16:08 PHP & HTML에서 이동 됨]

첨부파일

|

댓글 2개

잘봤습니다.
2008-02-21 (목) 18:34:00
멋집니다.
댓글을 작성하시려면 로그인이 필요합니다.

프로그램

8,188건
+
제목 글쓴이 날짜 조회
07-10-13 조회 5,106
07-10-03 조회 4,084
07-10-03 조회 3,285
07-10-03 조회 2,504
07-10-03 조회 4,609
07-10-02 조회 2,938
07-10-01 조회 3,571
07-09-28 조회 3,488
07-09-27 조회 4,549
07-08-16 조회 6,403
07-08-04 조회 2,852
07-07-25 조회 6,104
07-07-05 조회 4,000
07-07-02 조회 4,547
07-06-30 조회 4,445
07-06-20 조회 7,335
07-06-20 조회 3,944
07-06-05 조회 4,116
07-05-26 조회 3,136
07-05-17 조회 9,149
07-05-17 조회 5,193
07-05-04 조회 6,111
07-04-15 조회 6,201
07-04-13 조회 3,961
07-04-11 조회 3,382
07-03-20 조회 3,550
07-03-02 조회 6,782
07-02-27 조회 6,046
07-02-22 조회 4,441
07-01-30 조회 6,251
07-01-30 조회 1만
06-12-20 조회 3,718
06-12-18 조회 4,602
06-12-15 조회 4,581
06-12-15 조회 3,808
06-12-15 조회 3,194
06-11-30 조회 3,632
06-11-27 조회 4,526
06-10-24 조회 6,438
06-10-17 조회 4,746
06-09-22 조회 4,483
06-09-21 조회 5,987
06-09-21 조회 3,911
06-09-15 조회 6,531
06-08-20 조회 3,672
06-07-19 조회 3,311
06-07-14 조회 4,220
06-07-14 조회 4,086
06-07-11 조회 5,698
06-06-08 조회 4,275
06-06-08 조회 4,187
06-05-24 조회 3,497
06-05-24 조회 4,884
06-05-17 조회 3,592
06-05-16 조회 4,344
06-05-14 조회 6,038
06-05-12 조회 3,594
06-05-06 조회 4,245
06-05-06 조회 4,330
06-05-06 조회 3,629
06-05-06 조회 3,700
06-05-06 조회 4,148
06-04-25 조회 4,016
06-03-23 조회 5,474
06-01-20 조회 4,043
06-01-04 조회 4,250
05-12-30 조회 4,119
05-12-21 조회 4,796
05-11-09 조회 4,005
05-11-09 조회 3,785
05-10-09 조회 3,450
05-09-21 조회 6,838
05-08-14 조회 4,317
05-08-04 조회 5,502
05-07-14 조회 4,557
05-06-15 조회 4,942
05-04-23 조회 4,549
05-04-20 조회 5,006
05-04-19 조회 1.1만
05-04-19 조회 5,968
05-03-15 조회 3,784
05-03-15 조회 4,228
05-03-13 조회 2,905
05-03-13 조회 3,429
05-03-13 조회 3,418
05-03-13 조회 2,718
05-03-13 조회 5,765
05-03-13 조회 5,402
05-03-13 조회 4,334
05-03-13 조회 4,628
05-03-13 조회 7,890
05-03-13 조회 4,388
05-03-13 조회 3,470
05-03-13 조회 3,464
05-03-13 조회 8,012
05-03-13 조회 5,467
05-03-13 조회 4,117
05-03-12 조회 3,755
05-03-12 조회 4,469
05-02-24 조회 4,618