threejs-responsive-editor.html 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <!-- Licensed under a BSD license. See license.html for license -->
  2. <!DOCTYPE html>
  3. <html>
  4. <head>
  5. <meta charset="utf-8">
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
  7. <title>Three.js - Responsive Editor</title>
  8. <style>
  9. body {
  10. margin: 0;
  11. font-size: 16pt;
  12. }
  13. #editor {
  14. display: flex;
  15. width: 100vw;
  16. height: 100vh;
  17. }
  18. #controls {
  19. background: #AAA;
  20. padding: 5px;
  21. }
  22. #c {
  23. width: 100%;
  24. height: 100%;
  25. }
  26. .gutter {
  27. background-color: #eee;
  28. background-repeat: no-repeat;
  29. background-position: 50%;
  30. }
  31. .gutter.gutter-horizontal {
  32. cursor: ew-resize;
  33. background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAeCAYAAADkftS9AAAAIklEQVQoU2M4c+bMfxAGAgYYmwGrIIiDjrELjpo5aiZeMwF+yNnOs5KSvgAAAABJRU5ErkJggg==')
  34. }
  35. </style>
  36. </head>
  37. <body>
  38. <div id="editor">
  39. <div id="view"><canvas id="c"></canvas></div>
  40. <div id="controls">
  41. <div>
  42. <p>various controls
  43. would appear here</p>
  44. <div>Drag this bar</div>
  45. <div>⇐</div>
  46. </div>
  47. </div>
  48. </div>
  49. </body>
  50. <script src="resources/threejs/r93/three.min.js"></script>
  51. <script src="resources/threejs-lessons-helper.js"></script> <!-- you can and should delete this script. it is only used on the site to help with errors -->
  52. <script src="threejs-responsive.js"></script>
  53. <script src="../3rdparty/split.min.js"></script>
  54. <script>
  55. 'use strict';
  56. // This code is only related to handling the split.
  57. // Our three.js code has not changed
  58. Split(['#view', '#controls'], {
  59. sizes: [75, 25],
  60. minSize: 100,
  61. elementStyle: (dimension, size, gutterSize) => {
  62. return {
  63. 'flex-basis': `calc(${size}% - ${gutterSize}px)`,
  64. };
  65. },
  66. gutterStyle: (dimension, gutterSize) => {
  67. return {
  68. 'flex-basis': `${gutterSize}px`,
  69. };
  70. },
  71. });
  72. </script>
  73. </html>