Erste Schritte in JS

This commit is contained in:
2026-01-27 05:33:41 +01:00
parent cb50a66fbb
commit 63af097097
3 changed files with 34 additions and 0 deletions

20
js/Canvas02.html Normal file
View File

@@ -0,0 +1,20 @@
<!DOCTYPE html>
<html>
<body>
<canvas id="meinBoard" width="400" height="400" style="border: 2px solid #333;"></canvas>
<script>
// 1. Den "Pinsel" (Kontext) holen
const canvas = document.getElementById('meinBoard');
const ctx = canvas.getContext('2d');
// Farbe wählen
ctx.fillStyle = "orange";
// Rechteck zeichnen: fillRect(x, y, breite, höhe)
ctx.fillRect(50, 50, 150, 100);// Hier kommt gleich dein Code hin...
</script>
</body>
</html>