test.html 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <title>倒转房屋线条</title>
  7. <style>
  8. .house {
  9. position: relative;
  10. width: 200px; /* 正方形的宽度 */
  11. height: 200px; /* 正方形的高度 */
  12. background-color: #f0f0f0; /* 正方形的颜色 */
  13. }
  14. .house::after {
  15. content: '';
  16. position: absolute;
  17. top: 100%; /* 从正方形底部开始 */
  18. left: 50%;
  19. transform: translateX(-50%);
  20. border-left: 100px solid transparent; /* 左边透明边 */
  21. border-right: 100px solid transparent; /* 右边透明边 */
  22. border-top: 100px solid #f0f0f0; /* 上边为倒立三角形的底边 */
  23. }
  24. </style>
  25. </head>
  26. <body>
  27. <div class="house">
  28. </div>
  29. </body>
  30. </html>
  31. <!--<!DOCTYPE html>-->
  32. <!--<html lang="en">-->
  33. <!--<head>-->
  34. <!-- <meta charset="UTF-8">-->
  35. <!-- <meta name="viewport" content="width=device-width, initial-scale=1.0">-->
  36. <!-- <title>Enhanced Button Selection</title>-->
  37. <!-- <style>-->
  38. <!-- canvas {-->
  39. <!-- border: 1px solid #000;-->
  40. <!-- display: block;-->
  41. <!-- margin: 0 auto;-->
  42. <!-- }-->
  43. <!-- </style>-->
  44. <!--</head>-->
  45. <!--<body>-->
  46. <!--<canvas id="buttonCanvas" width="480" height="360"></canvas>-->
  47. <!--<script>-->
  48. <!-- const canvas = document.getElementById('buttonCanvas');-->
  49. <!-- const ctx = canvas.getContext('2d');-->
  50. <!-- const buttonWidth = 100;-->
  51. <!-- const buttonHeight = 100;-->
  52. <!-- const padding = 10;-->
  53. <!-- const rows = 3;-->
  54. <!-- const cols = 4;-->
  55. <!-- const images = [-->
  56. <!-- 'https://via.placeholder.com/100/FF0000/FFFFFF?text=Red',-->
  57. <!-- 'https://via.placeholder.com/100/0000FF/FFFFFF?text=Blue',-->
  58. <!-- 'https://via.placeholder.com/100/00FF00/FFFFFF?text=Green',-->
  59. <!-- 'https://via.placeholder.com/100/FFFFFF/000000?text=White',-->
  60. <!-- 'https://via.placeholder.com/100/FFAA00/FFFFFF?text=Orange',-->
  61. <!-- 'https://via.placeholder.com/100/AAAAAA/FFFFFF?text=Gray',-->
  62. <!-- 'https://via.placeholder.com/100/FF00FF/FFFFFF?text=Magenta',-->
  63. <!-- 'https://via.placeholder.com/100/00FFFF/FFFFFF?text=Cyan',-->
  64. <!-- 'https://via.placeholder.com/100/FFFF00/FFFFFF?text=Yellow',-->
  65. <!-- 'https://via.placeholder.com/100/000000/FFFFFF?text=Black',-->
  66. <!-- 'https://via.placeholder.com/100/FF7777/FFFFFF?text=Pink',-->
  67. <!-- 'https://via.placeholder.com/100/7777FF/FFFFFF?text=Purple',-->
  68. <!-- ];-->
  69. <!-- let buttons = [];-->
  70. <!-- let selectedButtons = new Set();-->
  71. <!-- function loadImages(imageUrls, callback) {-->
  72. <!-- const loadedImages = [];-->
  73. <!-- let imagesToLoad = imageUrls.length;-->
  74. <!-- imageUrls.forEach((url, index) => {-->
  75. <!-- const img = new Image();-->
  76. <!-- img.src = url;-->
  77. <!-- img.onload = () => {-->
  78. <!-- loadedImages[index] = img;-->
  79. <!-- imagesToLoad&#45;&#45;;-->
  80. <!-- if (imagesToLoad === 0) callback(loadedImages);-->
  81. <!-- };-->
  82. <!-- });-->
  83. <!-- }-->
  84. <!-- function createButtons(images) {-->
  85. <!-- let x, y;-->
  86. <!-- for (let row = 0; row < rows; row++) {-->
  87. <!-- for (let col = 0; col < cols; col++) {-->
  88. <!-- const index = row * cols + col;-->
  89. <!-- x = col * (buttonWidth + padding);-->
  90. <!-- y = row * (buttonHeight + padding);-->
  91. <!-- buttons.push({ x, y, width: buttonWidth, height: buttonHeight, image: images[index], id: index });-->
  92. <!-- }-->
  93. <!-- }-->
  94. <!-- }-->
  95. <!-- function drawButtons() {-->
  96. <!-- ctx.clearRect(0, 0, canvas.width, canvas.height);-->
  97. <!-- buttons.forEach(button => {-->
  98. <!-- // 绘制按钮图片-->
  99. <!-- ctx.drawImage(button.image, button.x, button.y, button.width, button.height);-->
  100. <!-- if (selectedButtons.has(button.id)) {-->
  101. <!-- // 绘制半透明灰色遮罩-->
  102. <!-- ctx.fillStyle = 'rgba(50, 50, 50, 0.5)';-->
  103. <!-- ctx.fillRect(button.x, button.y, button.width, button.height);-->
  104. <!-- // 绘制白色对勾图标-->
  105. <!-- ctx.fillStyle = 'white';-->
  106. <!-- ctx.font = '20px Arial';-->
  107. <!-- ctx.textAlign = 'center';-->
  108. <!-- ctx.textBaseline = 'middle';-->
  109. <!-- ctx.fillText('✔', button.x + button.width / 2, button.y + button.height / 2);-->
  110. <!-- // 添加边框-->
  111. <!-- ctx.strokeStyle = 'black';-->
  112. <!-- ctx.lineWidth = 5;-->
  113. <!-- ctx.strokeRect(button.x, button.y, button.width, button.height);-->
  114. <!-- }-->
  115. <!-- });-->
  116. <!-- }-->
  117. <!-- function handleCanvasClick(event) {-->
  118. <!-- const rect = canvas.getBoundingClientRect();-->
  119. <!-- const mouseX = event.clientX - rect.left;-->
  120. <!-- const mouseY = event.clientY - rect.top;-->
  121. <!-- buttons.forEach(button => {-->
  122. <!-- if (-->
  123. <!-- mouseX >= button.x &&-->
  124. <!-- mouseX <= button.x + button.width &&-->
  125. <!-- mouseY >= button.y &&-->
  126. <!-- mouseY <= button.y + button.height-->
  127. <!-- ) {-->
  128. <!-- if (selectedButtons.has(button.id)) {-->
  129. <!-- selectedButtons.delete(button.id); // 取消选中-->
  130. <!-- } else {-->
  131. <!-- selectedButtons.add(button.id); // 选中按钮-->
  132. <!-- }-->
  133. <!-- drawButtons();-->
  134. <!-- }-->
  135. <!-- });-->
  136. <!-- }-->
  137. <!-- canvas.addEventListener('click', handleCanvasClick);-->
  138. <!-- loadImages(images, loadedImages => {-->
  139. <!-- createButtons(loadedImages);-->
  140. <!-- drawButtons();-->
  141. <!-- });-->
  142. <!--</script>-->
  143. <!--</body>-->
  144. <!--</html>-->