Orbiting a sphere
in
Programming Questions
•
1 year ago
Hello!
Thanks
- float x, y;
- float frequency = 2;
- float angle;
- float radius = 100;
- void setup() {
- size(400, 400, P3D);
- background(255);
- smooth();
- fill(200);
- }
- void draw() {
- lights();
- background(255);
- pushMatrix();
- translate(200, 200, -50);
- x = sin(radians(angle))*radius;
- y = cos(radians(angle))*radius;
- noStroke();
- sphere(50);
- stroke(255, 0, 0);
- strokeWeight(3);
- translate(x, 0, -100);
- sphere(10);
- angle += frequency;
- popMatrix();
- }
1