2D HTML5 渲染引擎:CutJS
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 } ] });
本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!