Clock.html 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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 [link:https://developer.mozilla.org/en-US/docs/Web/API/Performance/now performance.now]
  13. if it is available, otherwise it reverts to the less accurate [link:https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Date/now Date.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 [page:.getDelta]() is called for the first time. Default is `true`.
  19. </p>
  20. <h2>Properties</h2>
  21. <h3>[property:Boolean autoStart]</h3>
  22. <p>
  23. If set, starts the clock automatically when [page:.getDelta]() is called for the first time. Default is `true`.
  24. </p>
  25. <h3>[property:Float startTime]</h3>
  26. <p>
  27. Holds the time at which the clock's [page:Clock.start start] method was last called. Default is `0`.
  28. </p>
  29. <h3>[property:Float oldTime]</h3>
  30. <p>
  31. Holds the time at which the clock's [page:Clock.start start], [page:.getElapsedTime]() or [page:.getDelta]()
  32. methods were last called. Default is `0`.
  33. </p>
  34. <h3>[property:Float elapsedTime]</h3>
  35. <p>
  36. Keeps track of the total time that the clock has been running. Default is `0`.
  37. </p>
  38. <h3>[property:Boolean running]</h3>
  39. <p>
  40. Whether the clock is running or not. Default is `false`.
  41. </p>
  42. <h2>Methods</h2>
  43. <h3>[method:undefined start]()</h3>
  44. <p>
  45. Starts clock. Also sets the [page:.startTime] and [page:.oldTime] to the current time, sets [page:.elapsedTime] to `0` and [page:.running] to `true`.
  46. </p>
  47. <h3>[method:undefined stop]()</h3>
  48. <p>
  49. Stops clock and sets [page:Clock.oldTime oldTime] to the current time.
  50. </p>
  51. <h3>[method:Float getElapsedTime]()</h3>
  52. <p>
  53. Get the seconds passed since the clock started and sets [page:.oldTime] to the current time.<br />
  54. If [page:.autoStart] is `true` and the clock is not running, also starts the clock.
  55. </p>
  56. <h3>[method:Float getDelta]()</h3>
  57. <p>
  58. Get the seconds passed since the time [page:.oldTime] was set and sets [page:.oldTime] to the current time.<br />
  59. If [page:.autoStart] is `true` and the clock is not running, also starts the clock.
  60. </p>
  61. <h2>Source</h2>
  62. <p>
  63. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  64. </p>
  65. </body>
  66. </html>