done with the basic effect
[censuslogo] / src / main.c
index 0807e5d..ad6c66e 100644 (file)
@@ -103,8 +103,8 @@ static void draw_line(float x0, float y0, float x1, float y1, float rad)
        rx = rad * dy / len;
        ry = -rad * dx / len;
 
-       draw_disc(x0, y0, rad, 8);
-       draw_disc(x1, y1, rad, 8);
+       draw_disc(x0, y0, rad, 12);
+       draw_disc(x1, y1, rad, 12);
 
        glBegin(GL_QUADS);
        glVertex2f(x0 + rx, y0 + ry);
@@ -114,7 +114,7 @@ static void draw_line(float x0, float y0, float x1, float y1, float rad)
        glEnd();
 }
 
-#define LOOPTIME       1.3f
+#define LOOPTIME       1.45f
 
 void display(void)
 {
@@ -122,17 +122,20 @@ void display(void)
        long msec = glutGet(GLUT_ELAPSED_TIME) - start_time;
        float t = (float)msec / 1000.0f;
        float a[2], b[2], dt;
-       float anim;
+       float anim, alpha;
 
        glClear(GL_COLOR_BUFFER_BIT);
 
        glLineWidth(5.0);
 
        anim = fmod(t / 6.0f, LOOPTIME);
+       alpha = 1.0f - ((anim - (LOOPTIME - 0.075)) / 0.06f);
+       if(alpha < 0.0f) alpha = 0.0f;
+       if(alpha > 1.0f) alpha = 1.0f;
 
        dt = (anim > 1.0f ? 1.0f : anim) / (float)(nverts - 1);
 
-       glColor3f(1, 1, 1);
+       glColor4f(1, 1, 1, alpha);
        for(i=0; i<nverts-1; i++) {
                float t0 = (float)i * dt;
                float t1 = (float)(i + 1) * dt;
@@ -143,18 +146,28 @@ void display(void)
 
        if(anim > 0.0f) {
                eval_logo(a, 0);
-               draw_disc(a[0], a[1], 0.05, 18);
+               draw_disc(a[0], a[1], 0.05, 22);
        }
        if(anim >= 1.0f) {
                eval_logo(b, 1);
-               draw_disc(b[0], b[1], 0.05, 18);
+               draw_disc(b[0], b[1], 0.05, 22);
        }
 
        glEnable(GL_BLEND);
        glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
 
        glColor4f(0.8, 0, 0, 2.0 * (anim - 1.0f) / (LOOPTIME - 1.0f));
-       draw_disc(0, 0, 0.14, 24);
+       draw_disc(0, 0, 0.14, 30);
+
+       if(alpha < 1.0f) {
+               glBegin(GL_QUADS);
+               glColor4f(0, 0, 0, 1.0f - alpha);
+               glVertex2f(-1, -1);
+               glVertex2f(1, -1);
+               glVertex2f(1, 1);
+               glVertex2f(-1, 1);
+               glEnd();
+       }
 
        glDisable(GL_BLEND);