Home >Web Front-end >H5 Tutorial >HTML5 uses canvas to draw text effects_html5 tutorial skills

HTML5 uses canvas to draw text effects_html5 tutorial skills

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-05-16 15:47:081554browse




Copy code
The code is as follows:

var canvas=document.getElementById("canvas");
var cxt= canvas.getContext("2d");
cxt.font="40px bold";
//Draw solid words
cxt.fillStyle="red";//Fill with red
cxt.fillText ("hello, Dr. Sisi",10,50);
//Draw hollow words
cxt.strokeStyle="red";//Red border
cxt.strokeText("hello, Dr. Sisi ",10,100);

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn