Custom Preset Scripting Examples. Acclaim Lighting PHAROS VLC, PHAROS LPC X, PHAROS TPS, PHAROS EXT, PHAROS TPC, PHAROS LPC
Reklāma
Reklāma
Pharos Designer User Manual
Custom Preset Scripting Examples
Matrix
The green randomly scrolling bars from the Matrix film.
Show Code
-- seed for the random number generator property("seed", INTEGER, 0, 0)
-- initialise the random number generator math.randomseed(seed)
-- generate a random period,active,offset value for each column of the effect table = {} local i = 0 while (i < width) do table[i] = { math.random(1, 3), math.random(4, 10)/10, math.random() } i = i+1 end
-- ramp-down effect curve lookup function ramp_down(f,period,active,offset) f = f/period f = f+offset f = f-math.floor(f) if (f>active) then return 0 else return f/active end end
-- the pixel function function pixel(frame, x, y) local t = frame/frames local period = table[x][1] local active = table[x][2] local offset = table[x][3] local f = ramp_down(y/height,period,active,1-t+offset)
- 332 -
Custom Preset Scripting Examples return 0,255*f,0 end
Colour Rain
Similar to Matrix, but the random bars fade between two colours as they drop, also the direction can be set.
Show Code
-- seed for the random number generator property("seed", INTEGER, 0, 0) property("gradient", GRADIENT, 0.0, 255, 128, 0, 0.5, 255, 255, 255, 1.0, 0,
192, 255) property("reverse", BOOLEAN, false) property("rotate", BOOLEAN, false)
-- initialise the random number generator math.randomseed(seed)
-- generate a random period,active,offset value for each column of the effect table = {} local i = 0 local dimension = width if (rotate) then end dimension = height while (i < dimension) do table[i] = { math.random(1, 3), math.random(4, 10)/10, math.random() } i = i+1 end
-- ramp-down effect curve lookup function ramp_down(f,period,active,offset) f = f/period f = f+offset f = f-math.floor(f)
- 333 -
Pharos Designer User Manual if (f>active) then return 0 else end return f/active end
-- the pixel function function pixel(frame, x, y) local t = frame/frames local col = x local row = y local rowWidth = width local colHeight = height if (rotate) then col = y row = x rowWidth = height end colHeight = width if (reverse) then col = rowWidth - col - 1 row = colHeight - row - 1 end local period = table[col][1] local active = table[col][2] local offset = table[col][3] local f = ramp_down(row/height,period,active,1-t+offset) local c = gradient:lookup(row / colHeight) return colour.new(c.red * f, c.green * f, c.blue * f) end
- 334 -
Custom Preset Scripting Examples
Plasma
Generates a classic plasma effect.
Show Code
-- return a multi-frequency noise value function plasma(x, y, x_period, y_period) local cx = width/2-0.5
local cy = height/2-0.5
return (math.cos(((cx-x)/x_period)*math.pi*2)+ math.cos(((cy-y)/y_period)*math.pi*2))/2 end
-- return a colour for a given noise value function colour(f) end return (math.sin(f*math.pi*4)+1)/2*255,(math.sin(f*math.pi)+1)/2*255,0
-- the pixel function function pixel(frame, x, y)
-- calculate a noise value local f = plasma(x,y,width,height)
-- offset the noise to animate the effect local offset = frame/frames*2 end
-- lookup the colour for the noise value return colour(f+offset)
More Examples
More examples are available on our website .
- 335 -
Lejupielādēt
Reklāma