Below you will find pages that utilize the taxonomy term “Html”
Articles
Html Test
html01 <!DOCTYPE html> <html lang="zh"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>俄罗斯方块</title> <style> canvas { border: 1px solid black; display: block; margin: auto; } </style> </head> <body> <canvas id="tetris" width="300" height="600"></canvas> <script> const canvas = document.getElementById("tetris"); const context = canvas.getContext("2d"); const ROWS = 20; const COLS = 10; const BLOCK_SIZE = 30; // 创建一个空的游戏区域 let board = Array.from({ length: ROWS }, () => Array(COLS).fill(0)); const shapes = [ [[1, 1, 1, 1]], // I [ [1, 1, 1], [0, 1, 0], ], // T [ [1, 1, 0], [0, 1, 1], ], // S [ [0, 1, 1], [1, 1, 0], ], // Z [ [1, 1], [1, 1], ], // O [ [1, 0, 0], [1, 1, 1], ], // L [ [0, 0, 1], [1, 1, 1], ], // J ]; let currentShape; let currentPosition; function randomShape() { const index = Math.
read more