SetInterval
This function sets the time interval, in milliseconds, in which particles will be released.
Syntax
- SetInterval(number interval)
Parameters
- interval: a specified time in milliseconds for new interval.
Example
--Create a window
window = Window:Create()
context = Context:Create(window)
world = World:Create()
camera = Camera:Create()
camera:Move(0,0,-3)
local interval = 1000
--Create an emitter
emitter = Emitter:Create(10)
emitter:SetEmissionVolume(0,0,0)
emitter:SetInterval(interval)
while true do
if window:Closed() or window:KeyHit(Key.Escape) then return false end
Time:Update()
world:Update()
world:Render()
if (window:KeyDown(Key.Up)) then
interval = interval + 1000
emitter:SetInterval(interval)
elseif (window:KeyDown(Key.Down) and interval > 0) then
interval = interval - 1000
emitter:SetInterval(interval)
end
context:SetBlendMode(Blend.Alpha)
context:DrawText("Interval: " ..(emitter:GetInterval()/1000) .. " seconds.",2,2)
context:Sync()
end