Erste Schritte in JS
This commit is contained in:
14
js/Canvas01.html
Normal file
14
js/Canvas01.html
Normal file
@@ -0,0 +1,14 @@
|
||||
<!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');
|
||||
|
||||
// Hier kommt gleich dein Code hin...
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
20
js/Canvas02.html
Normal file
20
js/Canvas02.html
Normal 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>
|
||||
Reference in New Issue
Block a user