1、方块下落:
<style>canvas{width: 500px;height: 300px;border: 1px solid;}</style></head><body><canvas id="can" width="500px" height="300px"></canvas><script>var canvas = document.getElementById('can');var ctx = canvas.getContext("2d");// 方块下落:var height = 100;var timer = setInterval (function (){ctx.clearRect(0,0,500,300);ctx.strokeRect(100,height,50,50);height += 5;},1000/30);</script></body>
