<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>canvas
</title>
<script type="text/javascript"></script>
<script>
window.onload=function(){
var canvas=document.getElementById("canvas");
var cx=canvas.getContext("2d");
cx.fillStyle='red';
cx.strokeStyle='blue';
cx.font="20px blod";
cx.fillText("hello",200,200);
cx.strokeText("world",200,100);
}
</script>
</head>
<body>
<canvas width="400px" height="400px" id="canvas" style="background-color:#ccc"></canvas>
</body>
</html>
转载请注明原文地址:https://tech.qufami.com/read-17693.html