document.write("<div id='hyunclip0' style='border-width:1px; border-style:none; width:11px; height:18px; position:absolute; left:50px; top:50px; z-index:1; visibility:hidden;'>")
document.write("<img src='http://oxtag.com.ne.kr/img/sunflower.gif'>")
document.write("</div>")
document.write("<div id='hyunclip1' style='border-width:1px; border-style:none; width:15px; height:22px; position:absolute; left:50px; top:50px; z-index:1;'>")
document.write("<img src='http://oxtag.com.ne.kr/img/sunflower.gif'>")
document.write("</div>")
document.write("<div id='hyunclip2' style='border-width:1px; border-style:none; width:15px; height:22px; position:absolute; left:50px; top:50px; z-index:1;'>")
document.write("<img src='http://oxtag.com.ne.kr/img/sunflower.gif'>")
document.write("</div>")
document.write("<div id='hyunclip3' style='border-width:1px; border-style:none; width:15px; height:22px; position:absolute; left:50px; top:50px; z-index:1;'>")
document.write("<img src='http://oxtag.com.ne.kr/img/sunflower.gif'>")
document.write("</div>")
document.write("<div id='hyunclip4' style='border-width:1px; border-style:none; width:15px; height:22px; position:absolute; left:50px; top:50px; z-index:1;'>")
document.write("<img src='http://oxtag.com.ne.kr/img/sunflower.gif'>")
document.write("</div>")
document.write("<div id='hyunclip5' style='border-width:1px; border-style:none; width:15px; height:22px; position:absolute; left:50px; top:50px; z-index:1;'>")
document.write("<img src='http://oxtag.com.ne.kr/img/sunflower.gif'>")
document.write("</div>")


var nhyunclips = 6;
if (document.all&&window.print)
document.body.style.cssText="overflow-x:hidden;overflow-y:scroll"
var Xpos = 0;
var Ypos = 0;
var DELTAT = .01;
var SEGLEN = 10;
var SPRINGK = 10;
var MASS = 1;
var GRAVITY = 50;
var RESISTANCE = 10;
var STOPVEL = 0.1;
var STOPACC = 0.1;
var hyunclipSIZE = 11;
var BOUNCE = 0.75;
var isNetscape = navigator.appName=="Netscape";
var followmouse = true;

var hyunclips = new Array();

init();

function init()
{
   var i = 0;
   for (i = 0; i < nhyunclips; i++) {
       hyunclips[i] = new hyunclip(i);
   }

   if (!isNetscape) {
   }
   for (i = 0; i < nhyunclips; i++) {
       hyunclips[i].obj.left = hyunclips[i].X;
       hyunclips[i].obj.top = hyunclips[i].Y;
   }
  
   if (isNetscape) {
       startanimate();
   } else {
       setTimeout("startanimate()", 2000);
   }
}


function hyunclip(i)
{
   this.X = Xpos;
   this.Y = Ypos;
   this.dx = 0;
   this.dy = 0;

   if (isNetscape) {  
        this.obj = eval("document.hyunclip" + i);
   } else {
       this.obj = eval("hyunclip" + i + ".style");
   }
}


function startanimate() {      
   setInterval("animate()", 20);
}
 
function setInitPositions(hyunclips)
{
   var startloc = document.all.tags("LI");
   var i = 0;

   for (i = 0; i < startloc.length && i < (nhyunclips - 1); i++) {
       hyunclips[i+1].X = startloc[i].offsetLeft
           startloc[i].offsetParent.offsetLeft - hyunclipSIZE;
       hyunclips[i+1].Y = startloc[i].offsetTop +
           startloc[i].offsetParent.offsetTop + 2*hyunclipSIZE;
   }

   // put 0th hyunclip above 1st (it is hidden)
   hyunclips[0].X = hyunclips[1].X;
   hyunclips[0].Y = hyunclips[1].Y - SEGLEN;
}

// just save mouse position for animate() to use
function MoveHandler(e)
{
   Xpos = e.pageX;
   Ypos = e.pageY;      
   return true;
}


// just save mouse position for animate() to use
function MoveHandlerIE() {
   Xpos = window.event.x + document.body.scrollLeft;
   Ypos = window.event.y + document.body.scrollTop;     
}

if (isNetscape) {
   document.captureEvents(Event.MOUSEMOVE);
   document.onMouseMove = MoveHandler;
} else {
   document.onmousemove = MoveHandlerIE;
}


function vec(X, Y)
{
   this.X = X;
   this.Y = Y;
}


// adds force in X and Y to spring for hyunclip[i] on hyunclip[j]
function springForce(i, j, spring)
{
   var dx = (hyunclips[i].X - hyunclips[j].X);
   var dy = (hyunclips[i].Y - hyunclips[j].Y);
   var len = Math.sqrt(dx*dx + dy*dy);

   if (len > SEGLEN) {
       var springF = SPRINGK * (len - SEGLEN);
       spring.X += (dx / len) * springF;
       spring.Y += (dy / len) * springF;
   }
}


function animate() {   
   // hyunclips[0] follows the mouse,
   // though no hyunclip is drawn there
   var start = 0;

   if (followmouse) {
       hyunclips[0].X = Xpos;
       hyunclips[0].Y = Ypos;      
       start = 1;
   }
  
   for (i = start ; i < nhyunclips; i++ ) {
       var spring = new vec(0, 0);
       if (i > 0) {
           springForce(i-1, i, spring);
       }
       if (i < (nhyunclips - 1)) {
           springForce(i+1, i, spring);
       }

       // air resisitance/friction
       var resist = new vec(-hyunclips[i].dx * RESISTANCE,
           -hyunclips[i].dy * RESISTANCE);

       // compute new accel, including gravity
       var accel = new vec((spring.X + resist.X)/ MASS,
           (spring.Y + resist.Y)/ MASS + GRAVITY);

       // compute new velocity
       hyunclips[i].dx += (DELTAT * accel.X);
       hyunclips[i].dy += (DELTAT * accel.Y);

       // stop dead so it doesn't jitter when nearly still
       if (Math.abs(hyunclips[i].dx) < STOPVEL &&
           Math.abs(hyunclips[i].dy) < STOPVEL &&
           Math.abs(accel.X) < STOPACC &&
           Math.abs(accel.Y) < STOPACC) {
           hyunclips[i].dx = 0;
           hyunclips[i].dy = 0;
       }

       // move to new position
       hyunclips[i].X += hyunclips[i].dx;
       hyunclips[i].Y += hyunclips[i].dy;

       // get size of window
       var height, width;

       if (isNetscape) {
           height = window.innerHeight + document.scrollTop;
           width = window.innerWidth + document.scrollLeft;
       } else {       
           height = document.body.clientHeight + document.body.scrollTop;
           width = document.body.clientWidth + document.body.scrollLeft;
       }

       // bounce of 3 walls (leave ceiling open)
       if (hyunclips[i].Y >=  height - hyunclipSIZE - 1) {
           if (hyunclips[i].dy > 0) {
               hyunclips[i].dy = BOUNCE * -hyunclips[i].dy;
           }
           hyunclips[i].Y = height - hyunclipSIZE - 1;
       }
       if (hyunclips[i].X >= width - hyunclipSIZE) {
           if (hyunclips[i].dx > 0) {
               hyunclips[i].dx = BOUNCE * -hyunclips[i].dx;
           }
           hyunclips[i].X = width - hyunclipSIZE - 1;
       }
       if (hyunclips[i].X < 0) {
           if (hyunclips[i].dx < 0) {
               hyunclips[i].dx = BOUNCE * -hyunclips[i].dx;
           }
           hyunclips[i].X = 0;
       }
       
       // move img to new position
       hyunclips[i].obj.left = hyunclips[i].X;                  
       hyunclips[i].obj.top =  hyunclips[i].Y;          
   }
}

Posted by 알 수 없는 사용자
,