騰訊的 2D 游戲引擎:AlloyGameEngine
AlloyGameEngine 讓游戲制作變得超級容易,超快的 2d 渲染引擎,支持 webgl 和 canvas 渲染。
一分鐘快速入門
要實現下面的效果:
可以使用下面的代碼:
var bmp, stage = new Stage("#ourCanvas"); bmp = new Bitmap("img/atLogo.png"); //(0.5,0.5)==〉The center is the point of rotation bmp.originX = 0.5; bmp.originY = 0.5; //bind click event, the event monitor can be accurate to pixel bmp.onClick(function () { //apply a random filter to the bmp bmp.filter=[Math.random(), Math.random(), Math.random(), 1]; }); //add object to stage stage.add(bmp); var step = 0.01; //loop stage.onTick(function () { bmp.rotation += 0.5; if (bmp.scaleX > 1.5 || bmp.scaleX < 0.5) { step *= -1; } bmp.scaleX += step; bmp.scaleY += step; });
本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!