Colour library summary, Properties – ETC Unison Mosaic Designer v1.11.0 User Manual
Page 238

Unison Mosaic Designer User Manual
if (mod(x,total_band_width)>=band_width) then
-- in band separator
return background_colour
end
-- get the band in which this pixel falls
local band = math.floor(x/total_band_width)
-- get the fraction through the effect
local t = frame/frames
-- optionally reverse the ripple
if (reverse) then t = -t end
-- get the height of the band in which this pixel falls
local band_height = (math.sin((band/bands/wavelength+t)*math.pi*2)
+1)/2
-- adjust y to be relative to the center of the effect
y = y-(height/2)+0.5
-- decide if this pixel is inside the band
local h = math.abs(y)/(height/2)
if (h<=band_height) then
return band_gradient:lookup(h)
else
return background_colour
end
end
You will notice that adding properties to the example involved little more than changing the variable definitions at
the start of the script. There are also two new properties, wavelength, for setting the wavelength of the ripple,
and reverse, for changing the direction of the ripple.
By adjusting the values of the properties, we can now create a variety of different effects without having to alter
the script again.
Colour library summary
colour.new(r,g,b)
Returns a new colour that represents the RGB color specified by the components r, g and b. r, g and b will be
limited to the range [0,255].
colour.interpolate(c1,c2,f)
Returns the colour that is linearly interpolated between colour c1 and colour c2 at fraction f. f can fall outside of
the range [0,1] and the returned colour will be extrapolated accordingly.
Properties
c:red
The value of the red component [0-255] of colour c.
- 238 -