Start in this adventure by clicking on the icon with the upper left lines and you have access to Santa's surprises.

2D, 3D, game, games, online game, game development, game engine, programming, OpenGL, Open AI, math, graphics, design, graphic, graphics, game development, game engine, programming, web development, web art, web graphic, arts, tutorial, tutorials,
float angle;
int dist_ball = 100;
void setup() {
size(800, 600);
background(0);
}
void draw() {
fill(20,20);
noStroke();
rect(0,0,width, height);
fill(255);
translate(width/2, height/2);
rotate(angle);
pushMatrix();
rotate(angle);
translate(dist_ball,0);
ellipse(0, 0, 10, 10);
popMatrix();
angle += 0.1;
}
The result is this effect:
void setup() {
size(200, 200);
stroke(10);
smooth();
}
void draw() {
background(255);
fill(0);
noStroke();
// Angles for sin() and cos() start at 3 o'clock;
// subtract HALF_PI to make them start at the top
ellipse(100, 100, 160, 160);
float s = map(second(), 0, 60, 0, TWO_PI) - HALF_PI;
float m = map(minute(), 0, 60, 0, TWO_PI) - HALF_PI;
float h = map(hour() % 12, 0, 12, 0, TWO_PI) - HALF_PI;
stroke(255);
strokeWeight(1);
line(100, 100, cos(s) * 72 + 100, sin(s) * 72 + 100);
strokeWeight(2);
line(100, 100, cos(m) * 60 + 100, sin(m) * 60 + 100);
strokeWeight(4);
line(100, 100, cos(h) * 50 + 100, sin(h) * 50 + 100);
}
The source code is simple: