Skip to content

Commit

Permalink
Animation présentée à Catherine et Alexey ce soir
Browse files Browse the repository at this point in the history
  • Loading branch information
olange committed May 20, 2014
1 parent 1e59da9 commit f4b09f3
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 23 deletions.
51 changes: 32 additions & 19 deletions roue_tserouf/CircleWithAlphabet.pde
Original file line number Diff line number Diff line change
@@ -1,32 +1,45 @@
class CircleWithAlphabet {
final float OUTER_RADIUS = width / 1.7;
final float INNER_RADIUS = OUTER_RADIUS * 0.7;
final float HALF_OUTER_RADIUS = OUTER_RADIUS / 2.0;
final float HALF_INNER_RADIUS = INNER_RADIUS / 2.0;
final float STROKE = 3.0;
final color COLOR_GOLD = #FFDDCC;
final int OPACITY = 192;
final color LUMIERE_FOSSILE = #FFDDCC;
final int OPACITY = 128;
final int ALPHABET_LEN = 22;

PVector center;
final float ANGLE = TWO_PI / ALPHABET_LEN;
final float half_ANGLE = ANGLE / 2.0;

CircleWithAlphabet() {
center = new PVector( width/2, height/2);
float outer_radius, inner_radius, middle_radius, circle_width;
float half_outer_radius, half_inner_radius, half_middle_radius;

CircleWithAlphabet( float radius) {
setOuterRadius( radius);
}

void setOuterRadius( float radius) {
outer_radius = radius;
inner_radius = outer_radius * 0.7;
circle_width = outer_radius - inner_radius;
middle_radius = inner_radius + circle_width / 2.0;
half_outer_radius = outer_radius / 2.0;
half_inner_radius = inner_radius / 2.0;
half_middle_radius = middle_radius / 2.0;
}

void draw() {
pushMatrix();
noFill();
stroke( COLOR_GOLD, OPACITY);
stroke( LUMIERE_FOSSILE, OPACITY);
strokeWeight( STROKE);
translate( center.x, center.y, 0);
ellipse( 0, 0, OUTER_RADIUS, OUTER_RADIUS);
ellipse( 0, 0, INNER_RADIUS, INNER_RADIUS);
textAlign( LEFT, CENTER);
for( int i = 0; i < ALPHABET_LEN; i++) {
rotateZ( TWO_PI / ALPHABET_LEN * millis() / 1000 * i);
line( HALF_INNER_RADIUS, 0, 0, HALF_OUTER_RADIUS, 0, 0);
text( i, HALF_INNER_RADIUS + 10, 0, 0);
// translate( center.x, center.y, 0);
ellipse( 0, 0, outer_radius, outer_radius);
ellipse( 0, 0, inner_radius, inner_radius);
textAlign( CENTER, CENTER);
for( int i = 0; i < 22; i++) {
rotateZ( half_ANGLE * millis() / 2500);
stroke( LUMIERE_FOSSILE, OPACITY);
line( half_inner_radius, 0, 0, half_outer_radius, 0, 0);
rotateZ( half_ANGLE);
noStroke();
fill( RAYONNEMENT_FOSSILE, OPACITY);
text( char( i + 65), half_middle_radius, 0, 0);
}
popMatrix();
}
Expand Down
15 changes: 11 additions & 4 deletions roue_tserouf/roue_tserouf.pde
Original file line number Diff line number Diff line change
@@ -1,20 +1,27 @@

CircleWithAlphabet c1;
CircleWithAlphabet c1, c2;
PFont baseFont;

void setup() {
size( int( displayWidth*0.6), int( displayHeight*0.6), P3D);
// size( int( displayWidth*0.6), int( displayHeight*0.6), P3D);
size( 1280, 800, P3D);
sphereDetail( 15);
smooth();
lights();

c1 = new CircleWithAlphabet();

baseFont = loadFont( "SansSerif-48.vlw");
textFont( baseFont, 48);

c1 = new CircleWithAlphabet( width / 1.7);
c2 = new CircleWithAlphabet( width / 2.5);
}

void draw() {
background( 0);
translate( width/2, height/2, 0);
rotateX( QUARTER_PI / 9 * millis() / 1000);
rotateY( QUARTER_PI);
c1.draw();
c2.draw();
}

0 comments on commit f4b09f3

Please sign in to comment.