fengchuanyu há 9 horas atrás
pai
commit
567b3706a0
1 ficheiros alterados com 27 adições e 0 exclusões
  1. 27 0
      6_HTML5/4_canvas.html

+ 27 - 0
6_HTML5/4_canvas.html

@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <meta charset="UTF-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1.0">
+    <title>Document</title>
+    <style>
+        .can{
+            background-color: black;
+            /* width: 900px;
+            height: 200px; */
+        }
+    </style>
+</head>
+<body>
+    <canvas class="can" width="400" height="400"></canvas>
+    <script>
+        var oCan = document.getElementsByClassName("can")[0];
+        var aCan = oCan.getContext("2d");
+        aCan.strokeStyle = "white";
+        aCan.lineWidth = 5;
+        aCan.moveTo(0,0);
+        aCan.lineTo(100,100);
+        aCan.stroke();
+    </script>
+</body>
+</html>