RFX-GIMP

make-progressor
Login

'make-progressor' is a Script-fu procedure that is available for all RFX-GIMP scripts to use for creating incremental counters.

The procedure requires two parameters: the initial value of the counter and the increment at each step. An optional third value can specify the period of the function.

'make-progressor' returns a function (i.e., a lambda) that evaluates to the next step in the series.

For example, the following define a simple ramp function that increments from 0.0 to 1.0 over the range of selected frames:

(if (= $start $end)
  (define next-step (make-progressor 0 (/ (succ (- $end $start)))))

Each time through the loop, '(next-step)' would be evaluated to return the current value of the progressor. The first time '(next-step)' is evaluated, the initial value of the progressor is returned.

Negative initial values and negative increments are permitted, and you can make create as many progressors as you would like.