Next: , Previous: Turtle, Up: Functions



12.11 UtilFunctions

Handy functions to make your life easier...

Example
     

12.11.1 (time)

Returns

time-number

Description

Returns the number of seconds (+ fraction) since midnight January 1st 1970. This is the simpest animation source for your scripts.

Example
      (define (animate)
          (rotate (sin (time)) 0 0)
          (draw-cube))
      (every-frame (animate))
     

12.11.2 (delta)

Returns

time-number

Description

Time in seconds since the last frame. Used to make animation frame rate independant.

Example
      (define (animate)
          (rotate (* (delta) 10) 0 0)
          (draw-cube))
      (every-frame (animate))
     

12.11.3 (flxrnd)

Returns

random-number

Description

Returns a random number between 0 and 1

Example
      (define (animate)
          (colour (flxrnd) (flxrnd) (flxrnd))
          (draw-cube))
      (every-frame (animate))
     

12.11.4 (flxseed seed-number)

Returns

void

Description

Seeds the random number generator so we can get the same sequence.

Example
      (define (animate)
          (colour (flxrnd) (flxrnd) (flxrnd))
          (draw-cube))
      (flxseed 10)
      (every-frame (animate)) ; the same seqence of colours will be generated
     

12.11.5 (searchpaths paths-list)

Returns

void

Description

Sets a list of search path strings to use for looking for fluxus related files, such as textures, shaders etc. Paths will be searched in order each time.

Example
      (searchpaths (list "/path/to/my/textures" "/path/to/my/other/textures"))
     

12.11.6 (fullpath filename-string)

Returns

fullpath-string

Description

Searches the search paths for the specified file and returns the first location it finds.

Example
      (fullpath "myfile")
     

12.11.7 (framedump filename)

Returns

void

Description

Saves out the current OpenGL front buffer to disk. Reads the filename extension to decide on the format used for saving, "tif", "jpg" or "ppm" are supported. This is the low level form of the frame dumping, use start-framedump and end-framedump instead.

Example
      (framedump "picture.jpg")