p5.easycam实现三维多个地球绕月球转动画效果代码
代码语言:html
所属分类:三维
代码描述:p5.easycam实现三维多个地球绕月球转动画效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<style>
body {
margin: 0;
padding: 0;
}
canvas {
display: block;
height:100%;
width:100%;
}
</style>
×
</head>
<body >
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/p5.1.4.0.js"></script>
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/p5.easycam.min.js"></script>
<script >
class Planet {
constructor(r, d, o, texxture=planetImg) {
this.v = p5.Vector.random3D();
this.radius = r;
this.distance = d;
this.v.mult(this.distance);
this.angle = random(TWO_PI);
this.orbitspeed = o;
this.texture = texxture;
this.texturePl = planetImg2;
this.textureMoon = moon;
this.planets = null;
}
orbit() {
this.angle = this.angle + this.orbitspeed;
if (this.planets != null) {
for (let i = 0; i < t.........完整代码请登录后点击上方下载按钮下载查看
















网友评论0