$r = $radius + $radius / 3.0 * sin($f * 2.0 * pi());
        $xpos = floor($xmid + $r * cos($ang) - $iw / 2.0 + 0.5);
        $ypos = floor($ymid + $r * sin($ang) - $ih / 2.0 + 0.5);
        $k = $i & 1 ? sin($f * 2.0 * pi()) : cos($f * 2.0 * pi());
        $k = 2.0 * $k * $k;
        $k = max(0.25, $k);
        $r1 = new GdkRectangle($xpos, $ypos, $iw * $k, $ih * $k);
        $r2 = new GdkRectangle(0, 0, $back_width, $back_height);
        $dest = $r1->intersect($r2);
        $images[$i]->composite($frame, $dest->x, $dest->y, $dest->width, $dest->height, $xpos, $ypos, $k, $k, Gdk::INTERP_NEAREST, $i & 1 ? max(127, abs(255 * sin($f * 2.0 * pi()))) : max(127, abs(255 * cos($f * 2.0 * pi()))));
    }
    $da->queue_draw();
    $frame_num++;
    return true;
}
$timeout_id = 0;
//pixbuf_init ();
if (!load_pixbufs()) {
    die("main(): Could not load all the pixbufs!");
}
$frame = new GdkPixbuf(Gdk::COLORSPACE_RGB, false, 8, $back_width, $back_height);
$window = new GtkWindow(Gtk::WINDOW_TOPLEVEL);
$window->set_size_request($back_width, $back_height);
$window->set_resizable(false);
$window->connect_simple('destroy', array('gtk', 'main_quit'));
$da = new GtkDrawingArea();
$da->connect('expose_event', 'expose_cb');
$window->add($da);
Gtk::timeout_add(FRAME_DELAY, 'timeout');
$window->show_all();
Gtk::main();