home *** CD-ROM | disk | FTP | other *** search
/ Hentai 69 / HENTAI69.iso / Extra / MPSetup.exe / 1033 / RCDATA / CABINET / wmploc.DLL / HTML / SLIDE.HTC < prev    next >
Text File  |  2002-12-14  |  3KB  |  152 lines

  1. <PUBLIC:COMPONENT lightWeight=true>
  2.  
  3. <PUBLIC:EVENT name="onslidedone" ID=done>
  4.  
  5. <PUBLIC:PROPERTY NAME="direction" />
  6. <PUBLIC:PROPERTY NAME="steps" />
  7. <PUBLIC:PROPERTY NAME="maxtime" />
  8. <PUBLIC:PROPERTY NAME="source" />
  9. <PUBLIC:PROPERTY NAME="sourceBG" />
  10. <PUBLIC:PROPERTY NAME="destination" />
  11. <PUBLIC:PROPERTY NAME="destinationBG" />
  12. <PUBLIC:PROPERTY NAME="endPoint" />
  13. <PUBLIC:PROPERTY NAME="sliding" />
  14.  
  15. <PUBLIC:METHOD NAME="slide" />
  16. <PUBLIC:METHOD NAME="Stop" />
  17.  
  18. <SCRIPT LANGUAGE="JScript">
  19. var iEnd, iTimer;
  20. sliding = false;
  21.  
  22. var iStartTime, iEndTime, iStepsToDo, iStepsSoFar, iStepTime, iStepDistance, iStepsDone;
  23.  
  24. function slide()
  25. {
  26.     var dStart = new Date();
  27.     iStartTime = dStart.getTime();
  28.     iEndTime = iStartTime + parseInt(maxtime);
  29.     iStepsToDo = parseInt(steps);
  30.     iStepsDone = 0;
  31.     iStepTime = parseInt(maxtime) / iStepsToDo;
  32.     iEnd = parseInt(endPoint);
  33.     
  34.     sliding = true;
  35.     iSpeed = 0;
  36.     if (parseInt(direction) < 2)
  37.         shimmyLeft();
  38.     else
  39.         shimmyUp();
  40. }
  41.  
  42.  
  43. function fireDone()
  44. {
  45.     sliding = false;
  46.     var e = createEventObject();
  47.     done.fire(e); 
  48. }
  49.  
  50. function CalcSpeed(iSpeed, iRange, iSteps)
  51. {
  52.     if (iSpeed == 0)
  53.         return iRange / iSteps;
  54.     else
  55.     {
  56.         var dNow = new Date();
  57.         var iNow = dNow.getTime(), iElapsed, iRet;
  58.         iElapsed = (iNow - iStartTime) / iStepTime;
  59.         
  60.         iRet = (iRange / iSteps) * ((iElapsed - iStepsDone) + 1);
  61.         return iRet;
  62.     }
  63. }
  64.  
  65. function shimmyLeft()
  66. {
  67.     var iAdjust, ssty = source.style;
  68.     if (ssty.posLeft != iEnd)
  69.     {
  70.         iSpeed = CalcSpeed(iSpeed, element.document.body.clientWidth, iStepsToDo);
  71.         iStepsDone++;
  72.         
  73.         if (direction == 1)
  74.         {
  75.             if (ssty.posLeft - iSpeed < iEnd)
  76.                 iSpeed = ssty.posLeft - iEnd;
  77.  
  78.             iSpeed = -iSpeed;
  79.         }
  80.         else
  81.         {
  82.             if (ssty.posLeft + iSpeed > iEnd)
  83.                 iSpeed = iEnd - ssty.posLeft;
  84.         }
  85.  
  86.         ssty.posLeft += iSpeed;
  87.         sourceBG.style.posLeft += iSpeed;
  88.         destination.style.posLeft += iSpeed;
  89.   
  90.         iTimer = window.setTimeout(shimmyLeft, iStepTime);
  91.     }
  92.     else
  93.         fireDone();
  94. }
  95.  
  96. function shimmyUp()
  97. {
  98.     var iAdjust, ssty = source.style;
  99.     if (ssty.posTop != iEnd)
  100.     {
  101.         iSpeed = CalcSpeed(iSpeed, element.document.body.clientHeight, iStepsToDo);
  102.         iStepsDone++;
  103.         
  104.         if (direction == 3)
  105.         {
  106.             if (ssty.posTop - iSpeed < iEnd)
  107.                 iSpeed = ssty.posTop - iEnd;
  108.  
  109.             iSpeed = -iSpeed;
  110.         }
  111.         else
  112.         {
  113.             if (ssty.posTop + iSpeed > iEnd)
  114.                 iSpeed = iEnd - ssty.posTop;
  115.         }
  116.  
  117.         ssty.posTop += iSpeed;
  118.         sourceBG.style.posTop += iSpeed;
  119.         destination.style.posTop += iSpeed;
  120.         destinationBG.style.posTop += iSpeed;
  121.  
  122.         iTimer = window.setTimeout(shimmyUp, iStepTime);
  123.     }
  124.     else
  125.         fireDone();
  126. }
  127.  
  128. function Stop()
  129. {
  130.     if (sliding)
  131.     {
  132.         var sty = source.style, iAdjust;
  133.         window.clearTimeout(iTimer);
  134.         
  135.         if (parseInt(direction) < 2)
  136.         {
  137.             iAdjust = sty.posLeft - iEnd;
  138.             sty.posLeft = iEnd;
  139.             sourceBG.style.posLeft += iAdjust;
  140.         }
  141.         else
  142.         {
  143.             iAdjust = sty.posTop - iEnd;
  144.             sty.posTop = iEnd;
  145.             sourceBG.style.posTop += iAdjust;
  146.         }
  147.         fireDone();        
  148.     }
  149. }
  150. </SCRIPT>
  151. </PUBLIC:COMPONENT>
  152.