index.html 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. <!doctype html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>three.js - documentation</title>
  6. <style>
  7. body {
  8. margin: 0;
  9. padding: 0;
  10. color: #555;
  11. font-family: Arial, sans-serif;
  12. overflow: hidden;
  13. }
  14. h1 {
  15. color: #999;
  16. font-size: 18px;
  17. margin-top: 20px;
  18. }
  19. #panel {
  20. position: fixed;
  21. left: 0px;
  22. top: 0px;
  23. width: 200px;
  24. height: 100%;
  25. padding-left: 20px;
  26. font-size: 15px;
  27. overflow: auto;
  28. }
  29. #panel ul {
  30. list-style-type: none;
  31. padding: 0px;
  32. margin: 0px;
  33. }
  34. #viewer {
  35. overflow: auto;
  36. }
  37. #viewer h1 {
  38. color: #444;
  39. font-size: 25px;
  40. }
  41. #viewer h2 {
  42. color: #999;
  43. font-size: 18px;
  44. margin-top: 40px;
  45. }
  46. #viewer h3 {
  47. font-size: 15px;
  48. margin-top: 30px;
  49. }
  50. #viewer div {
  51. padding-left: 30px;
  52. }
  53. #viewer code {
  54. display: block;
  55. margin: 0px;
  56. width: 90%;
  57. padding: 20px;
  58. white-space: pre;
  59. background-color: #f9f9f9;
  60. overflow: auto;
  61. }
  62. </style>
  63. </head>
  64. <body>
  65. <div id="panel"></div>
  66. <div id="viewer"></div>
  67. <script>
  68. var panel = document.getElementById( 'panel' );
  69. var viewer = document.getElementById( 'viewer' );
  70. var pages = {
  71. "Core": [
  72. { name: "Clock", path: "core/Clock" },
  73. { name: "Color", path: "core/Color" },
  74. { name: "Edge", path: "core/Edge" },
  75. { name: "Face3", path: "core/Face3" },
  76. { name: "Face4", path: "core/Face4" },
  77. { name: "Frustum", path: "core/Frustum" },
  78. { name: "Geometry", path: "core/Geometry" },
  79. { name: "Math", path: "core/Math" },
  80. { name: "Matrix3", path: "core/Matrix3" },
  81. { name: "Matrix4", path: "core/Matrix4" },
  82. { name: "Object3D", path: "core/Object3D" },
  83. { name: "Projector", path: "core/Projector" },
  84. { name: "Quaternion", path: "core/Quaternion" },
  85. { name: "Ray", path: "core/Ray" },
  86. { name: "Rectangle", path: "core/Rectangle" },
  87. { name: "Spline", path: "core/Spline" },
  88. { name: "UV", path: "core/UV" },
  89. { name: "Vector2", path: "core/Vector2" },
  90. { name: "Vector3", path: "core/Vector3" },
  91. { name: "Vector4", path: "core/Vector4" },
  92. { name: "Vertex", path: "core/Vertex" }
  93. ],
  94. "Cameras": [
  95. { name: "PerspectiveCamera", path: "cameras/PerspectiveCamera" },
  96. { name: "OrtographicCamera", path: "cameras/OrtographicCamera" }
  97. ],
  98. "Lights": [
  99. { name: "AmbientLight", path: "lights/AmbientLight" },
  100. { name: "DirectionalLight", path: "lights/DirectionalLight" },
  101. { name: "PointLight", path: "lights/PointLight" },
  102. { name: "SpotLight", path: "lights/SpotLight" },
  103. ]
  104. };
  105. var html = '';
  106. for ( var category in pages ) {
  107. html += '<h1>' + category + '</h1>';
  108. for ( var i = 0; i < pages[ category ].length; i ++ ) {
  109. var page = pages[ category ][ i ];
  110. html += '<li><a href="javascript:goTo(\'' + page.path + '\')">' + page.name + '</a></li>';
  111. }
  112. }
  113. panel.innerHTML += '<ul>' + html + '</ul>';
  114. // Page loading
  115. function goTo( path ) {
  116. viewer.innerHTML = '';
  117. window.location.hash = path
  118. var xhr = new XMLHttpRequest();
  119. xhr.open( 'GET', 'api/' + path + '.html', true );
  120. xhr.onreadystatechange = function () {
  121. if ( xhr.readyState == 4 && ( xhr.status == 200 || xhr.status == 0 ) ) {
  122. viewer.innerHTML = xhr.responseText + '<br>';
  123. }
  124. };
  125. xhr.send( null );
  126. }
  127. goTo( window.location.hash.substring(1) );
  128. // Layout
  129. var margin = 200;
  130. function updateLayout() {
  131. panel.style.height = window.innerHeight + 'px';
  132. viewer.style.marginLeft = margin + 'px';
  133. viewer.style.width = ( window.innerWidth - margin ) + 'px';
  134. viewer.style.height = window.innerHeight + 'px';
  135. }
  136. window.addEventListener( 'resize', updateLayout, false );
  137. updateLayout();
  138. </script>
  139. </body>
  140. </html>