Gradient library summary, Functions, Built-in functions – ETC Unison Mosaic Designer v1.11.0 User Manual
Page 239

Custom Preset Programming Guide
c:green
The value of the green component [0-255] of colour c.
c:blue
The value of the blue component [0-255] of colour c.
Gradient library summary
gradient.new(c1,c2)
Returns a new gradient with colour c1 at the start and colour c2 at the end.
Functions
g:lookup(f)
Returns the colour at fraction f through the gradient g. f will be limited to the range [0,1].
g:add_point(f, c)
Adds the colour c to the gradient g at fraction f.
Built-in functions
dist(x1,y1,x2,y2)
Returns the distance between coordinate (x1,y1) and coordinate (x2,y2)
dist_from_center(x,y)
Returns the distance between coordinate (x,y) and the center of the frame. This is not the same as calling dist
(x,y,width/2,height/2)
. It takes into account the fact that the center of the frame may fall in the middle of
a pixel. For example, if width and height were equal to 5, the center of the frame is the center of the pixel at
coordinate (2,2), but calling dist(2,2,width/2,height/2) will return 0.707, which is the distance between
the top left of pixel (2,2) and its center. Calling dist_from_center(2,2), where width and height are
equal to 5, will return 0.
print(message)
Prints message in the debugger's Output window.
You are advised to remove calls to this function when you have finished debugging because it will allow the script
to run faster when used in programming.
rgb_to_hsi(red,green,blue)
Converts an RGB (red, green, blue) colour to an HSI (hue, saturation, intensity) colour. red, green and blue
are in the range [0-255]. Returns three numbers, hue is in [0-2PI] radian, saturation and intensity are in the range
[0-1].
hsi_to_rgb(hue,saturation,intensity)
Converts an HSI (hue, saturation, intensity) colour into an RGB (red, green, blue) colour. hue is in [0-2PI] radi-
ans, saturation and intensity are in the range [0-1]. Returns three numbers in the range [0-255].
- 239 -