1 Star 3 Fork 2

GreenPack/billiards2d

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
index.js 735 Bytes
一键复制 编辑 原始数据 按行查看 历史
GreenPack 提交于 2022-05-17 18:10 . init
// index.js
var canvas = null;
function main() {
canvas = document.getElementById('album');
// 这里的宽高按实际情况设置
canvas.width = 375;
canvas.height = 667;
stage = new Stage(canvas);
this.stage.start();
for (let i = 0; i < 16; i++) {
let ball = new Billiards(i);
this.stage.addChild(ball);
ball.x = (i % 4) * 70 + 50;
ball.y = Math.floor(i / 4) * 100 + 100;
ball.scrollSpeed = (i + 1);
let ax = i % 4;
let ay = Math.floor(i / 4);
let az = Math.sqrt(18 - ax * ax - ay * ay);
let len = Math.sqrt(18);
ball.scrollAxis = { x: ax / len, y: ay / len, z: az / len };
console.log(ball.scrollAxis);
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/ruanwujing/billiards2d.git
[email protected]:ruanwujing/billiards2d.git
ruanwujing
billiards2d
billiards2d
master

搜索帮助