Canvas

12
Sep

Canvas 插入 fontAwesome

事先准备: 引入fontawesome官网文件
或单独引入fontawesome.otf并在全局css中指定@font
每个图标的unicode码在Cheetsheat获取

draw事件中:

//canvas = ...
//ctx = ...
ctx.save();
ctx.font = "12px FontAwesome"; //字体大小
ctx.fillStyle = "rgba(255,255,255,1)"; //颜色
var txt = "\uf036";  //Unicode码
ctx.fillText(txt,x,y);
ctx.restore();

23
Aug

Canvas 镜头(Camera/viewport)效果的实现

1、DrawImage实现法

http://jsfiddle.net/gfcarv/QKgHs/#embed

2、RPGmaker型,图块型

http://stackoverflow.com/questions/11464550/html5-creating-a-viewport-for-canvas