transform.html 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  6. <title>Editor</title>
  7. <style type="text/css" media="screen">
  8. .ace_editor {
  9. border: 1px solid lightgray;
  10. margin: auto;
  11. height: 800px;
  12. width: 400px;
  13. font-size: 26px!important;
  14. max-width: 30%;
  15. }
  16. .scrollmargin {
  17. height: 80px;
  18. text-align: center;
  19. }
  20. #editor1, #editor2, #editor3 {
  21. display:inline-block
  22. }
  23. .wrapper {
  24. text-align: center;
  25. perspective: 500px;
  26. margin-top: 50px;
  27. }
  28. #editor1 {
  29. transform: rotateY(10deg) rotateX(-1deg);
  30. }
  31. #editor2 {
  32. transform: translateZ(-36px) rotateX(-1deg);
  33. }
  34. #editor3 {
  35. transform: rotateY(-10deg) rotateX(-1deg);
  36. }
  37. #editor4 {
  38. transform: scale(-1,1) rotateX(-1deg);
  39. }
  40. .transformed {
  41. transform: scale(0.5);
  42. transform-origin: center 12%
  43. }
  44. #editor {
  45. width: 100%;
  46. min-width: 100%
  47. }
  48. body {
  49. background: #a9bfc7;
  50. }
  51. .scrollmargin input > {margin: 10px}
  52. </style>
  53. </head>
  54. <body>
  55. <div class="transformed">
  56. <div class="wrapper">
  57. <pre id="editor1">editor1</pre>
  58. <pre id="editor2">editor2</pre>
  59. <pre id="editor3">editor3</pre>
  60. </div>
  61. <div class="scrollmargin"></div>
  62. <pre id="editor4">editor4</pre>
  63. <div class="scrollmargin">
  64. <textarea></textarea>
  65. </div>
  66. <pre id="editor">editor</pre>
  67. <div class="scrollmargin" style="transform: scale(2) translateY(3em);">
  68. <input type="checkbox" id="option">Auto scroll into view</input>
  69. <input type="range" onchange="document.body.style.zoom = 1 + value/250">css Zoom</input>
  70. <input type="range" onchange="document.body.style.transform = 'rotateZ(' + (this.value * 18) +'deg)'">css Transform</input>
  71. </div>
  72. </div>
  73. <div class="scrollmargin">
  74. </div>
  75. <!-- load ace -->
  76. <script src="../src/ace.js"></script>
  77. <!-- load ace language_tools extension -->
  78. <script src="../src/ext-language_tools.js"></script>
  79. <script>
  80. var editor1 = ace.edit("editor1");
  81. editor1.setOptions({
  82. hasCssTransforms: true,
  83. theme: "ace/theme/tomorrow_night_blue",
  84. mode: "ace/mode/html"
  85. });
  86. var editor2 = ace.edit("editor2", {
  87. hasCssTransforms: true,
  88. theme: "ace/theme/kuroir",
  89. mode: "ace/mode/html",
  90. enableBasicAutocompletion: true,
  91. });
  92. var editor3 = ace.edit("editor3", {
  93. hasCssTransforms: true,
  94. theme: "ace/theme/tomorrow_night_eighties",
  95. mode: "ace/mode/html",
  96. enableBasicAutocompletion: true,
  97. });
  98. var editor4 = ace.edit("editor4", {
  99. hasCssTransforms: true,
  100. theme: "ace/theme/solarized_light",
  101. mode: "ace/mode/html",
  102. enableBasicAutocompletion: true,
  103. });
  104. var editor = ace.edit("editor", {
  105. hasCssTransforms: true,
  106. mode: "ace/mode/html",
  107. value: "editor 4\n from a mirror",
  108. enableBasicAutocompletion: true,
  109. });
  110. editor.renderer.setScrollMargin(10, 10, 10, 10);
  111. var checkbox = document.getElementById("option");
  112. checkbox.onchange = function() {
  113. editor1.setOption("autoScrollEditorIntoView", checkbox.checked);
  114. editor2.setOption("autoScrollEditorIntoView", checkbox.checked);
  115. editor3.setOption("autoScrollEditorIntoView", checkbox.checked);
  116. editor4.setOption("autoScrollEditorIntoView", checkbox.checked);
  117. editor.setOption("autoScrollEditorIntoView", checkbox.checked);
  118. };
  119. checkbox.onchange();
  120. window.editor = editor;
  121. window.editor4 = editor4;
  122. </script>
  123. <script src="./show_own_source.js"></script>
  124. </body>
  125. </html>