CutJS2D HTML5 渲染引擎
CutJS 是一个轻量级的、快速的、可交互的 2D HTML5 渲染引擎,用于跨平台的游戏开发。可用来开发 Web 游戏、iOS 和 Android 等游戏。CutJS 是一个开源的 Canvas 库。
示例代码:
// Create new app
Cut(function(root, container) {
// Subscribe to Cut.Mouse
Cut.Mouse(root, container);
// Set view box
root.viewbox(500, 300);
// Create an image node
Cut.image("base:box").appendTo(root)
// on mouse click on this node
.on(Cut.Mouse.CLICK, function(ev, point) {
// Tween scale values of this node
this.tween().clear().pin({
scaleX : Math.random() + 0.5,
scaleY : Math.random() + 0.5
});
return true;
});
});
// Register an image texture
Cut.addTexture({
name : "base",
imagePath : "base.png",
cutouts : [
{ name : "box", x : 0, y : 0, width : 30, height : 30 }
]
});评论
