CSS2DRenderer.html 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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">[name] is a simplified version of [page:CSS3DRenderer]. The only transformation that is supported is translation.<br /><br />
  12. The renderer is very useful if you want to combine HTML based labels with 3D objects. Here too, the respective DOM elements are wrapped into an instance of `CSS2DObject` and added to the scene graph.<br /><br />
  13. `[name]` only supports 100% browser and display zoom.
  14. </p>
  15. <h2>Import</h2>
  16. <p>
  17. [name] is an add-on, and must be imported explicitly.
  18. See [link:#manual/introduction/Installation Installation / Addons].
  19. </p>
  20. <code>
  21. import { CSS2DRenderer } from 'three/addons/renderers/CSS2DRenderer.js';
  22. </code>
  23. <h2>Examples</h2>
  24. <p>
  25. [example:css2d_label]<br>
  26. [example:webgl_loader_pdb molecules]
  27. </p>
  28. <h2>Constructor</h2>
  29. <h3>[name]( [param:Object parameters] )</h3>
  30. <p>
  31. [page:DOMElement element] - A [link:https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement HTMLElement]
  32. where the renderer appends its child-elements.
  33. This corresponds to the [page:CSS2DRenderer.domElement domElement] property below.
  34. If not passed in here, a new div element will be created.
  35. </p>
  36. <h2>Properties</h2>
  37. <h3>[property:DOMElement domElement]</h3>
  38. <p>
  39. A [link:https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement HTMLElement] where the renderer appends its child-elements.<br />
  40. This is automatically created by the renderer in the constructor (if not provided already).
  41. </p>
  42. <h2>Methods</h2>
  43. <h3>[method:Object getSize]()</h3>
  44. <p>
  45. Returns an object containing the width and height of the renderer.
  46. </p>
  47. <h3>[method:undefined render]( [param:Scene scene], [param:Camera camera] )</h3>
  48. <p>
  49. Renders a [page:Scene scene] using a [page:Camera camera].<br />
  50. </p>
  51. <h3>[method:undefined setSize]([param:Number width], [param:Number height])</h3>
  52. <p>
  53. Resizes the renderer to (width, height).
  54. </p>
  55. <h2>Source</h2>
  56. <p>
  57. [link:https://github.com/mrdoob/three.js/blob/master/examples/jsm/renderers/CSS2DRenderer.js examples/jsm/renderers/CSS2DRenderer.js]
  58. </p>
  59. </body>
  60. </html>