页面载入中...

当前位置:首页 > 教程福利 > HTML5 > HTML5

html5使用canvas绘制文字特效

温馨提示:本信息由会员搜集整理发布,您如有异议可以 举报 或者 版权申诉
<canvas id="canvas" width="500" height="400" style="background-color: yellow;"></canvas> 复制代码代码如下: var canvas=document.getElementById("canvas"); var cxt=canvas.getContext("2d&q

<canvas id="canvas" width="500" height="400" style="background-color: yellow;"></canvas>
 

复制代码
代码如下:

var canvas=document.getElementById("canvas");
var cxt=canvas.getContext("2d");
cxt.font="40px 黑体";
//绘制实心字
cxt.fillStyle="red";//填充红色
cxt.fillText("hello,思思博士",10,50);
//绘制空心字
cxt.strokeStyle="red";//红色边
cxt.strokeText("hello,思思博士",10,100);

  

延伸阅读:

    无相关信息
  
 

html5使用canvas绘制文字特效