* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA."
*/
+/* This is simply a proof-of-concept for using cairo to implement a
+ * design idea for an OLPC boot-time animation. The animation here is
+ * implemented to mimic an animation originally provided as a
+ * Quicktime movie by Rebecca Allen <rallen@arts.ucla.edu>.
+ *
+ * So far, this animation has been developed exclusively on an x86
+ * laptop with GTK+ targeting the X Window System. No guarantees are
+ * provided as to how this might perform on an OLPC XO machine. What's
+ * likely desired is to write the application to use cairo image
+ * surfaces, and augment cairo to support targeting the XO's 565 image
+ * format directly.
+ *
+ * And obviously, to serve as a real boot-time animation, code will
+ * have to be written to advance the animation according to various
+ * system events, instead of using the hard-coded timeline below.
+ */
+
#include <gtk/gtk.h>
#include <cairo.h>
#include <math.h>
static void
draw_body (cairo_t *cr, double extra, double spin_transition)
{
+ double angle, x, y;
+
cairo_save (cr);
cairo_move_to (cr,
cairo_rel_line_to (cr, XO_BODY_DELTA, XO_BODY_DELTA);
cairo_translate (cr, XO_HEAD_CENTER_X, XO_HEAD_CENTER_Y);
- cairo_rotate (cr, 2 * M_PI * spin_transition);
+
+ angle = 2 * M_PI * spin_transition;
+ y = cos (angle) * XO_DOTS_POSITION_RADIUS;
+ x = sin (angle) * XO_DOTS_POSITION_RADIUS;
+ angle = atan2 (x, y + XO_BODY_CENTER_Y - XO_HEAD_CENTER_Y);
+
+ cairo_rotate (cr, angle);
cairo_translate (cr, -XO_HEAD_CENTER_X, -XO_HEAD_CENTER_Y);
cairo_move_to (cr,
cairo_translate (cr, XO_DOTS_CENTER_X, XO_DOTS_CENTER_Y);
cairo_rotate (cr, - 1.5 * M_PI);
- for (i = 0; i < num_dots; i++) {
+ for (i = 0; i <= num_dots; i++) {
if (i != 0) {
cairo_arc (cr,
XO_DOTS_POSITION_RADIUS, 0,
goto DONE;
if (anim_stage < ANIM_FADE) {
- draw_dots (cr, (XO_DOTS_NUM_DOTS + 1) * spin_transition);
+ draw_dots (cr, (XO_DOTS_NUM_DOTS) * spin_transition);
} else {
draw_ring (cr);
}