Clock.html 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <!DOCTYPE html>
  2. <html lang="en">
  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. Object for keeping track of time. This uses
  13. [link:https://developer.mozilla.org/en-US/docs/Web/API/Performance/now performance.now].
  14. </p>
  15. <h2>Constructor</h2>
  16. <h3>[name]( [param:Boolean autoStart] )</h3>
  17. <p>
  18. autoStart — (optional) whether to automatically start the clock when
  19. [page:.getDelta]() is called for the first time. Default is `true`.
  20. </p>
  21. <h2>Properties</h2>
  22. <h3>[property:Boolean autoStart]</h3>
  23. <p>
  24. If set, starts the clock automatically when [page:.getDelta]() is called
  25. for the first time. Default is `true`.
  26. </p>
  27. <h3>[property:Float startTime]</h3>
  28. <p>
  29. Holds the time at which the clock's [page:Clock.start start] method was
  30. last called. Default is `0`.
  31. </p>
  32. <h3>[property:Float oldTime]</h3>
  33. <p>
  34. Holds the time at which the clock's [page:Clock.start start],
  35. [page:.getElapsedTime]() or [page:.getDelta]() methods were last called.
  36. Default is `0`.
  37. </p>
  38. <h3>[property:Float elapsedTime]</h3>
  39. <p>
  40. Keeps track of the total time that the clock has been running. Default is
  41. `0`.
  42. </p>
  43. <h3>[property:Boolean running]</h3>
  44. <p>Whether the clock is running or not. Default is `false`.</p>
  45. <h2>Methods</h2>
  46. <h3>[method:undefined start]()</h3>
  47. <p>
  48. Starts clock. Also sets the [page:.startTime] and [page:.oldTime] to the
  49. current time, sets [page:.elapsedTime] to `0` and [page:.running] to
  50. `true`.
  51. </p>
  52. <h3>[method:undefined stop]()</h3>
  53. <p>
  54. Stops clock and sets [page:Clock.oldTime oldTime] to the current time.
  55. </p>
  56. <h3>[method:Float getElapsedTime]()</h3>
  57. <p>
  58. Get the seconds passed since the clock started and sets [page:.oldTime] to
  59. the current time.<br />
  60. If [page:.autoStart] is `true` and the clock is not running, also starts
  61. the clock.
  62. </p>
  63. <h3>[method:Float getDelta]()</h3>
  64. <p>
  65. Get the seconds passed since the time [page:.oldTime] was set and sets
  66. [page:.oldTime] to the current time.<br />
  67. If [page:.autoStart] is `true` and the clock is not running, also starts
  68. the clock.
  69. </p>
  70. <h2>Source</h2>
  71. <p>
  72. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  73. </p>
  74. </body>
  75. </html>
粤ICP备19079148号