+
+ /* if we sleep every time, it's too slow */
+ if(subdelay && i%16 == 0) usleep(subdelay);
+
+ XFlush (dpy);
+ }
+}
+
+static void
+trig (Display *dpy, Window window,
+ int d_angle, int factor1, int factor2,
+ int offset, int d_angle_offset, int dir, int density)
+{
+ XWindowAttributes xgwa;
+ int width, height;
+ int xmid, ymid;
+ int x1, y1, x2, y2;
+ int tmp, angle;
+ Colormap cmap;
+
+ XClearWindow (dpy, window);
+ XGetWindowAttributes (dpy, window, &xgwa);
+ cmap = xgwa.colormap;
+ width = xgwa.width;
+ height = xgwa.height;
+
+ xmid = width / 2;
+ ymid = height / 2;
+
+ while (d_angle >= -360 && d_angle <= 360)
+ {
+ angle = d_angle + d_angle_offset;
+ x1 = (sins [pmod(angle * factor1, 360)] * xmid) + xmid;
+ y1 = (coss [pmod(angle * factor1, 360)] * ymid) + ymid;
+ x2 = (sins [pmod(angle * factor2 + offset, 360)] * xmid) + xmid;
+ y2 = (coss [pmod(angle * factor2 + offset, 360)] * ymid) + ymid;
+ XDrawLine(dpy, window, draw_gc, x1, y1, x2, y2);
+ tmp = (int) 360 / (2 * density * factor1 * factor2);
+ if (tmp == 0) /* Do not want it getting stuck... */
+ tmp = 1; /* Would not need if floating point */
+ d_angle += dir * tmp;
+
+ /* this draws faster, so we sleep somewhat more often */
+ if(subdelay && d_angle%4 == 0) usleep(subdelay);
+
+ /* without this, the subdelay effect is lost */