fork download
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8" />
  5. <title>I LOVE YOU</title>
  6. <style>
  7. body {
  8. background-color: white;
  9. display: flex;
  10. justify-content: center;
  11. align-items: center;
  12. height: 100vh;
  13. margin: 0;
  14. font-family: sans-serif;
  15. }
  16. .grid {
  17. display: grid;
  18. grid-template-columns: repeat(65, 15px);
  19. grid-template-rows: repeat(10, 15px);
  20. gap: 2px;
  21. }
  22. .cell {
  23. width: 15px;
  24. height: 15px;
  25. border: 1px solid #ccc;
  26. background-color: white;
  27. transition: background-color 0.3s;
  28. }
  29. .on {
  30. background-color: deeppink;
  31. }
  32. </style>
  33. </head>
  34. <body>
  35. <div class="grid" id="grid"></div>
  36.  
  37. <script>
  38. const grid = document.getElementById('grid');
  39. const rows = 10;
  40. const cols = 65;
  41.  
  42. const pixelsOn = [
  43. [1, 0],[2, 0],[3, 0],[4, 0],[5, 0],[6, 0],
  44. [1, 4],[2, 4],[3, 4],[4, 4],[5, 4],[6, 4],[6, 5],[6, 6],
  45. [1, 9],[1, 10],[1, 11],[2, 9],[2, 11],[3, 9],[3, 11],
  46. [4, 9],[4, 11],[5, 9],[5, 11],[6, 9],[6, 10],[6, 11],
  47. [1, 14],[2, 14],[3, 14],[4, 14],[5, 15],[6, 16],
  48. [5, 17],[1, 18],[2, 18],[3, 18],[4, 18],
  49. [1, 21],[2, 21],[3, 21],[4, 21],[5, 21],[6, 21],
  50. [1, 22],[3, 22],[6, 22],
  51. [1, 25],[2, 25],[3, 25],[3, 26],[4, 26],[5, 26],[6, 26],
  52. [1, 29],[1, 30],[1, 31],[2, 29],[2, 31],[3, 29],[3, 31],
  53. [4, 29],[4, 31],[5, 29],[5, 31],[6, 29],[6, 30],[6, 31],
  54. [1, 34],[2, 34],[3, 34],[4, 34],[5, 34],[6, 34],
  55. [1, 36],[2, 36],[3, 36],[4, 36],[5, 36],[6, 36],[6, 35]
  56. ];
  57.  
  58. const cells = [];
  59.  
  60. // สร้าง grid
  61. for (let r = 0; r < rows; r++) {
  62. for (let c = 0; c < cols; c++) {
  63. const cell = document.createElement('div');
  64. cell.classList.add('cell');
  65. grid.appendChild(cell);
  66. cells.push(cell);
  67. }
  68. }
  69.  
  70. // ฟังก์ชันเปิด cell ทีละจุด
  71. function animatePixels(pixels, delay = 30) {
  72. pixels.forEach(([r, c], index) => {
  73. setTimeout(() => {
  74. const cellIndex = r * cols + c;
  75. cells[cellIndex].classList.add('on');
  76. }, index * delay);
  77. });
  78. }
  79.  
  80. // เริ่ม animation
  81. animatePixels(pixelsOn);
  82. </script>
  83. </body>
  84. </html>
Success #stdin #stdout 0.02s 25628KB
stdin
Standard input is empty
stdout
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8" />
  <title>I LOVE YOU</title>
  <style>
    body {
      background-color: white;
      display: flex;
      justify-content: center;
      align-items: center;
      height: 100vh;
      margin: 0;
      font-family: sans-serif;
    }
    .grid {
      display: grid;
      grid-template-columns: repeat(65, 15px);
      grid-template-rows: repeat(10, 15px);
      gap: 2px;
    }
    .cell {
      width: 15px;
      height: 15px;
      border: 1px solid #ccc;
      background-color: white;
      transition: background-color 0.3s;
    }
    .on {
      background-color: deeppink;
    }
  </style>
</head>
<body>
  <div class="grid" id="grid"></div>

  <script>
    const grid = document.getElementById('grid');
    const rows = 10;
    const cols = 65;

    const pixelsOn = [
      [1, 0],[2, 0],[3, 0],[4, 0],[5, 0],[6, 0],
      [1, 4],[2, 4],[3, 4],[4, 4],[5, 4],[6, 4],[6, 5],[6, 6],
      [1, 9],[1, 10],[1, 11],[2, 9],[2, 11],[3, 9],[3, 11],
      [4, 9],[4, 11],[5, 9],[5, 11],[6, 9],[6, 10],[6, 11],
      [1, 14],[2, 14],[3, 14],[4, 14],[5, 15],[6, 16],
      [5, 17],[1, 18],[2, 18],[3, 18],[4, 18],
      [1, 21],[2, 21],[3, 21],[4, 21],[5, 21],[6, 21],
      [1, 22],[3, 22],[6, 22],
      [1, 25],[2, 25],[3, 25],[3, 26],[4, 26],[5, 26],[6, 26],
      [1, 29],[1, 30],[1, 31],[2, 29],[2, 31],[3, 29],[3, 31],
      [4, 29],[4, 31],[5, 29],[5, 31],[6, 29],[6, 30],[6, 31],
      [1, 34],[2, 34],[3, 34],[4, 34],[5, 34],[6, 34],
      [1, 36],[2, 36],[3, 36],[4, 36],[5, 36],[6, 36],[6, 35]
    ];

    const cells = [];

    // สร้าง grid
    for (let r = 0; r < rows; r++) {
      for (let c = 0; c < cols; c++) {
        const cell = document.createElement('div');
        cell.classList.add('cell');
        grid.appendChild(cell);
        cells.push(cell);
      }
    }

    // ฟังก์ชันเปิด cell ทีละจุด
    function animatePixels(pixels, delay = 30) {
      pixels.forEach(([r, c], index) => {
        setTimeout(() => {
          const cellIndex = r * cols + c;
          cells[cellIndex].classList.add('on');
        }, index * delay);
      });
    }

    // เริ่ม animation
    animatePixels(pixelsOn);
  </script>
</body>
</html>