RFX-GIMP

Update of "make-progressor"
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview

Artifact ID: a750bfeff0204f8ef30d238ad7bb4d8d3034cf8e
Page Name:make-progressor
Date: 2012-03-30 04:28:39
Original User: saul
Content

'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.