html5使用canvas绘制文字特效
html5使用canvas绘制文字特效
发布时间:2015-05-12 来源:查字典编辑
摘要:代码如下:varcanvas=document.getElementById("canvas");varcxt=canvas.getCont...

 <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教程学习
热门HTML5教程学习
网页设计子分类