CutJS2D HTML5 渲染引擎

联合创作 · 2023-09-30 11:22

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 }
  ]
});
浏览 5
点赞
评论
收藏
分享

手机扫一扫分享

编辑
举报
评论
图片
表情
推荐
点赞
评论
收藏
分享

手机扫一扫分享

编辑
举报