(bind-func draw_frame
(let ((fill (NVGcolor 1.0 1.0 1.0 0.3))
(stroke (NVGcolor 1.0 1.0 1.0 0.5))
(i 0) (x 0.0) (y 0.0)
(frame 0))
(lambda (beat:Rational)
(nvgBeginFrame vg (convert width) (convert height) pixel_ratio)
(nvgResetTransform vg)
;; loop and draw the circles
(dotimes (i 2000)
(nvgResetTransform vg)
(set! x (+ (/ width 2.0) (* 400.0 (cos (* 0.000005 (i64tof i) (convert frame))))))
(set! y (+ 400.0 (* 200.0 (cos (* 0.000005 (rtof (+ beat 100000:i64)) (i64tof i))))))
(nvgBeginPath vg)
(nvgCircle vg x y 15.0)
(if (= 0 ( % i 2))
(tfill! fill 1.0 0.0 0.0 0.1)
(tfill! fill 1.0 1.0 1.0 0.1))
(nvgFillColor vg fill)
(nvgFill vg)
(nvgStrokeWidth vg 1.0)
(nvgStrokeColor vg stroke)
(nvgStroke vg))
(set! frame (+ frame 1))
(nvgEndFrame vg))))