Listing 5, Listing 6 – ETC Unison Mosaic Designer v1.11.0 User Manual
Page 229

Custom Preset Programming Guide
Listing 5
function pixel(frame,x,y)
-- calculate the progress through the animation
local t = frame/frames
-- compare the fraction across the effect with the animation pro-
gress
if (x/width<t) then
return 255,0,0
else
return 0,0,0
end
end
Now, once the red wipe reaches the right side of the frame, it immediately jumps back to the start. Returning to
our vertical band example, we are going to introduce animation by changing the height of each band over time:
Listing 6
-- width of the bands in pixels
band_width = 4
-- space between bands in pixels
band_spacing = 1
-- get the combined width of band and separator
local total_band_width = band_width+band_spacing
-- get the number of visible bands
local bands = width/total_band_width
-- modulo operator (a%b)
function mod(a,b)
return a - math.floor(a/b)*b
end
-- the pixel function
function pixel(frame,x,y)
if (mod(x,total_band_width)>=band_width) then
-- in band separator
return 0,0,0
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
-- get the height of the band in which this pixel falls
local band_height = (math.sin((band/bands+t)*math.pi*2)+1)/2
- 229 -