足球游戏_中国足彩网¥体育资讯$

html5实现canvas阴影效果示例
来源:易贤网 阅读:650 次 日期:2016-06-16 09:03:26
温馨提示:易贤网小编为您整理了“html5实现canvas阴影效果示例”,方便广大网友查阅!

在html5中实现canvas阴影效果

代码如下:

<!doctype html>

<html>

<head>

<meta http-equiv=x-ua-compatible content=chrome=ie8>

<meta http-equiv=content-type content="text/html; charset=gbk"'2d');

// section one - shadow and blur

context.fillstyle=black;

context.fillrect(0, 0, canvas.width, canvas.height/4);

context.font = '60pt calibri';

context.shadowcolor = white;

context.shadowoffsetx = 0;

context.shadowoffsety = 0;

context.shadowblur = 20;

context.filltext(blur canvas, 40, 80);

context.strokestyle = rgba(0, 255, 0, 1);

context.linewidth = 2;

context.stroketext(blur canvas, 40, 80);

// section two - shadow font

var hh = canvas.height/4;

context.fillstyle=white;

context.fillrect(0, hh, canvas.width, canvas.height/4);

context.font = '60pt calibri';

context.shadowcolor = rgba(127,127,127,1);

context.shadowoffsetx = 3;

context.shadowoffsety = 3;

context.shadowblur = 0;

context.fillstyle = rgba(0, 0, 0, 0.8);

context.filltext(blur canvas, 40, 80+hh);

// section three - down shadow effect

var hh = canvas.height/4 + hh;

context.fillstyle=black;

context.fillrect(0, hh, canvas.width, canvas.height/4);

for(var i = 0; i < 10; i++)

{

context.shadowcolor = rgba(255, 255, 255, + ((10-i)/10) + );

context.shadowoffsetx = i*2;

context.shadowoffsety = i*2;

context.shadowblur = i*2;

context.fillstyle = rgba(127, 127, 127, 1);

context.filltext(blur canvas, 40, 80+hh);

}

// section four - fade effect

var hh = canvas.height/4 + hh;

context.fillstyle=green;

context.fillrect(0, hh, canvas.width, canvas.height/4);

for(var i = 0; i < 10; i++)

{

context.shadowcolor = rgba(255, 255, 255, + ((10-i)/10) + );

context.shadowoffsetx = 0;

context.shadowoffsety = -i*2;

context.shadowblur = i*2;

context.fillstyle = rgba(127, 127, 127, 1);

context.filltext(blur canvas, 40, 80+hh);

}

for(var i = 0; i < 10; i++)

{

context.shadowcolor = rgba(255, 255, 255, + ((10-i)/10) + );

context.shadowoffsetx = 0;

context.shadowoffsety = i*2;

context.shadowblur = i*2;

context.fillstyle = rgba(127, 127, 127, 1);

context.filltext(blur canvas, 40, 80+hh);

}

for(var i = 0; i < 10; i++)

{

context.shadowcolor = rgba(255, 255, 255, + ((10-i)/10) + );

context.shadowoffsetx = i*2;

context.shadowoffsety = 0;

context.shadowblur = i*2;

context.fillstyle = rgba(127, 127, 127, 1);

context.filltext(blur canvas, 40, 80+hh);

}

for(var i = 0; i < 10; i++)

{

context.shadowcolor = rgba(255, 255, 255, + ((10-i)/10) + );

context.shadowoffsetx = -i*2;

context.shadowoffsety = 0;

context.shadowblur = i*2;

context.fillstyle = rgba(127, 127, 127, 1);

context.filltext(blur canvas, 40, 80+hh);

}

}

</script>

</head>

<body>

<h1>html5 canvas</h1>

<pre>fill and stroke clip</pre>

<div id=my_painter>

<canvas id=text_canvas></canvas>

</div>

</body>

</html>

中国足彩网信息请查看网页制作
易贤网手机网站地址:html5实现canvas阴影效果示例
由于各方面情况的不断调整与变化,易贤网提供的所有考试信息和咨询回复仅供参考,敬请考生以权威部门公布的正式信息和咨询为准!
关于我们 | 联系我们 | 人才招聘 | 网站声明 | 网站帮助 | 非正式的简要咨询 | 简要咨询须知 | 加入群交流 | 手机站点 | 投诉建议
工业和信息化部备案号:滇ICP备2023014141号-1 足球游戏_中国足彩网¥体育资讯$ 滇公网安备53010202001879号 人力资源服务许可证:(云)人服证字(2023)第0102001523号
云南网警备案专用图标
联系电话:0871-65317125(9:00—18:00) 获取招聘考试信息及咨询关注公众号:hfpxwx
咨询QQ:526150442(9:00—18:00)版权所有:易贤网
云南网警报警专用图标