(bind-func draw_frame
(let ((fill (NVGcolor 1.0 0.0 0.0 0.5))
(stroke (NVGcolor 0.0 0.0 1.0 0.5))
(i 0.:f)
(frame 0))
(lambda ()
(nvgBeginFrame vg (convert width) (convert height) pixel_ratio)
(nvgResetTransform vg)
(if (not (null? bg_paint))
;; draw background image
(begin
(nvgFillPaint vg bg_paint)
(nvgBeginPath vg)
(nvgRect vg 0. 0. width height)
(nvgFill vg)))
;; loop and draw the circles
(dotimes (i 200.0)
(nvgResetTransform vg)
(nvgTranslate vg
(+ (/ width 2.0) (* 200. (cos (* i 0.00025 (convert frame)))))
(+ (/ height 2.0) (* 100. (tan (* 0.0001 i (convert frame))))))
(nvgBeginPath vg)
(nvgCircle vg 0. 0. 20.)
(tfill! fill (/ i 200.0) 0.0 (- 1.0 (/ i 200.0)) 0.5)
(nvgFillColor vg fill)
(nvgFill vg)
(nvgStrokeWidth vg 10.)
(nvgStrokeColor vg stroke)
(nvgStroke vg))
(set! frame (+ frame 1))
(nvgEndFrame vg))))