/* built with Studio Sketchpad:
* https://sketchpad.cc
*
* observe the evolution of this sketch:
* https://studio.sketchpad.cc/sp/pad/view/ro.-JEwV1qYbIA/rev.9
*
* authors:
* GoToLoop
* license (unless otherwise specified):
* creative commons attribution-share alike 3.0 license.
* https://creativecommons.org/licenses/by-sa/3.0/
*/
/**
* Orbital System (v2.10)
* by Sephm (2014/Feb)
* mod GoToLoop
*
* forum.processing.org/two/discussion/3206/
* rotate-around-objects-local-coordinate-system
*
* studio.processingtogether.com/sp/pad/export/ro.9c4pxAevkAbwG/latest
*/
static final int DIM1 = 50, DIM2 = 20;
float ang, step = .05;
void setup() {
size(600, 600, P3D);
smooth(8);
noStroke();
}
void draw() {
background(-1);
lights();
translate(width>>1, height>>1);
fill(#FFC000);
sphere(DIM1);
pushMatrix();
rotateX(ang += step);
translate(0, height/3);
fill(#FF0000);
box(DIM2);
popMatrix();
rotateY(ang);
translate(width/3, 0);
fill(#00FF00);
box(DIM2);
}
void mousePressed() {
step = -step;
}
void keyPressed() {
step *= -1.;
}