2 Star 1 Fork 0

大春哥/threejs练习

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
00-test.html 915 Bytes
一键复制 编辑 原始数据 按行查看 历史
dcg001 提交于 2019-10-19 20:15 +08:00 . 第二天练习-相机-画线
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<style>
div {
position: absolute;
left: 600px;
top: 300px;
width: 50px;
height: 50px;
;
background-color: green;
}
</style>
</head>
<body>
<div class="box"></div>
<script>
var r = 250;
var x = r;
var y = 0;
var jiao = 0;
setInterval(function () {
jiao += 1;
x = r * Math.cos(getHu(jiao));
y = r * Math.sin(getHu(jiao));
console.log(x, y);
document.querySelector('.box').style.transform = 'translate(' + x + 'px, ' + y + 'px)';
}, 10);
function getHu(jiao) {
// hu/pi = 焦/180
hu = jiao / 180 * Math.PI;
return hu;
}
</script>
</body>
</html>
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/dttx123/threejs_exercise.git
git@gitee.com:dttx123/threejs_exercise.git
dttx123
threejs_exercise
threejs练习
master

搜索帮助