创建 "Text":
var helloWorldText = Crafty.e(‘2D, DOM, Text‘)
.attr({
x: 10,
y: 10
});
显示文本:
helloWorldText.text(‘Hello World‘);
使用 .textColor() 方法修改文本颜色:
helloWorldText.textColor(‘red‘);
使用.textFont() 方法调整字体样式:
helloWorldText.textFont({
size: ‘20px‘,
weight: ‘bold‘});
支持的类型包括:
type
weight
size
family
lineHeight
variant
注意:
原文:http://my.oschina.net/tonglei0429/blog/476217