Clock.html 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <!DOCTYPE html>
  2. <html lang="zh">
  3. <head>
  4. <meta charset="utf-8" />
  5. <base href="../../../" />
  6. <script src="page.js"></script>
  7. <link type="text/css" rel="stylesheet" href="page.css" />
  8. </head>
  9. <body>
  10. <h1>[name]</h1>
  11. <p class="desc">
  12. 该对象用于跟踪时间。如果[link:https://developer.mozilla.org/en-US/docs/Web/API/Performance/now performance.now]。
  13. </p>
  14. <h2>构造函数</h2>
  15. <h3>[name]( [param:Boolean autoStart] )</h3>
  16. <p>
  17. autoStart — (可选) 是否要在第一次调用 [page:.getDelta]() 时自动开启时钟。默认值是 *true*。
  18. </p>
  19. <h2>属性</h2>
  20. <h3>[property:Boolean autoStart]</h3>
  21. <p>
  22. 如果设置为 true,则在第一次调用 [page:.getDelta]() 时开启时钟。默认值是 *true*。
  23. </p>
  24. <h3>[property:Float startTime]</h3>
  25. <p>
  26. 存储时钟最后一次调用 [page:Clock.start start] 方法的时间。默认值是 *0*。
  27. </p>
  28. <h3>[property:Float oldTime]</h3>
  29. <p>
  30. 存储时钟最后一次调用 [page:Clock.start start], [page:.getElapsedTime]() 或 [page:.getDelta]() 方法的时间。默认值是 *0*。
  31. </p>
  32. <h3>[property:Float elapsedTime]</h3>
  33. <p>
  34. 保存时钟运行的总时长。默认值是 *0*。
  35. </p>
  36. <h3>[property:Boolean running]</h3>
  37. <p>
  38. 判断时钟是否在运行。默认值是 *false*。
  39. </p>
  40. <h2>方法</h2>
  41. <h3>[method:undefined start]()</h3>
  42. <p>
  43. 启动时钟。同时将 [page:Clock.startTime startTime] 和 [page:Clock.oldTime oldTime] 设置为当前时间。
  44. 设置 [page:Clock.elapsedTime elapsedTime] 为 *0*,并且设置 [page:Clock.running running] 为 *true*.
  45. </p>
  46. <h3>[method:undefined stop]()</h3>
  47. <p>
  48. 停止时钟。同时将 [page:Clock.oldTime oldTime] 设置为当前时间。
  49. </p>
  50. <h3>[method:Float getElapsedTime]()</h3>
  51. <p>
  52. 获取自时钟启动后的秒数,同时将 [page:.oldTime] 设置为当前时间。<br />
  53. 如果 [page:.autoStart] 设置为 *true* 且时钟并未运行,则该方法同时启动时钟。
  54. </p>
  55. <h3>[method:Float getDelta]()</h3>
  56. <p>
  57. 获取自 [page:.oldTime] 设置后到当前的秒数。 同时将 [page:.oldTime] 设置为当前时间。<br/>
  58. 如果 [page:.autoStart] 设置为 *true* 且时钟并未运行,则该方法同时启动时钟。
  59. </p>
  60. <h2>源代码</h2>
  61. <p>
  62. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  63. </p>
  64. </body>
  65. </html>
粤ICP备19079148号