JSFiddle - React, Tailwind, and code Playground
by frogggeee McFrogggeee
HTML
<!DOCTYPE html>
<html>
<head>
<body>
<h1>game</h1>
<p>by frogggeee</p>
<canvas id = "canvas" width = "480" height = "360"></canvas>
<script>
let vel = 0;
let y = 180;
let canvas = document.getElementById("canvas");
let ctx = canvas.getContext("2d");
function render() {
ctx.clearRect(0, 0, 2000, 2000);
/*//////////////////////////////////////////////////////////*/
ctx.beginPath();
ctx.rect(0, 0, 2000, 2000);
ctx.fillStyle = "#4d4d4d";
ctx.fill();
ctx.closePath();
ctx.beginPath();
ctx.rect(240, y, 20, 20);
ctx.fillStyle = "#000000";
ctx.fill();
ctx.closePath();
}
setInterval(render, 10);
</script>
</body>
</head>
</html>