Clock.html 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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. 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 the first update is called. 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.
  28. </p>
  29. <h3>[property:Float oldTime]</h3>
  30. <p>
  31. Holds the time at which the clock's [page:Clock.start start], [page:Clock.getElapsedTime getElapsedTime] or [page:Clock.getDelta getDelta]
  32. methods were last called.
  33. </p>
  34. <h3>[property:Float elapsedTime]</h3>
  35. <p>
  36. Keeps track of the total time that the clock has been running.
  37. </p>
  38. <h3>[property:Boolean running]</h3>
  39. <p>
  40. Whether the clock is running or not.
  41. </p>
  42. <h2>Methods</h2>
  43. <h3>[method:null start]()</h3>
  44. <p>
  45. Starts clock. Also sets the [page:Clock.startTime startTime] and [page:Clock.oldTime oldTime]
  46. to the current time, sets [page:Clock.elapsedTime elapsedTime] to *0* and [page:Clock.running running] to *true*.
  47. </p>
  48. <h3>[method:null stop]()</h3>
  49. <p>
  50. Stops clock and sets [page:Clock.oldTime oldTime] to the current time.
  51. </p>
  52. <h3>[method:Float getElapsedTime]()</h3>
  53. <p>
  54. Get the seconds passed since the clock started and sets [page:Clock.oldTime oldTime] to the current time.<br />
  55. If [page:Clock.autoStart autoStart] is *true* and the clock is not running, also starts the clock.
  56. </p>
  57. <h3>[method:Float getDelta]()</h3>
  58. <p>
  59. Get the seconds passed since the time [page:Clock.oldTime oldTime] was set and sets [page:Clock.oldTime oldTime] to the current time.<br />
  60. If [page:Clock.autoStart autoStart] is *true* and the clock is not running, also starts the clock.
  61. </p>
  62. <h2>Source</h2>
  63. <p>
  64. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  65. </p>
  66. </body>
  67. </html>