4

Planet Orbit with Moons

 2 years ago
source link: https://codepen.io/leimapapa/pen/wvPLbBd
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Planet Orbit with Moons

0 unsaved changes
xxxxxxxxxx
xxxxxxxxxx
body {
  margin: 0;
  padding: 0;
}
canvas {
  display: block;
  height:100%;
  width:100%;
}
xxxxxxxxxx
// Solar System in Processing - Part 2 (3D)
// The Coding Train / Daniel Shiffman
// https://thecodingtrain.com/CodingChallenges/008-solarsystemgenerator3d.html
// https://youtu.be/dncudkelNxw
// https://editor.p5js.org/codingtrain/sketches/QIB-sT10
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;

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK