大飞_dafei

导航

Canvas:绘制文字

Canvas:绘制文字

<canvas id="myCanvas" width="200" height="100" style="border:2px solid #ff6b81;"></canvas>

<script>
    var canvas = document.getElementById("myCanvas");
    var context = canvas.getContext("2d");
    context.font = "20px bold 黑体";
    context.fillText("daFei", 50, 80);
</script>

 

posted on 2021-06-21 15:10  大飞_dafei  阅读(86)  评论(0编辑  收藏  举报