SetAnimationCycles

This function sets the number of times an animated particle's animation will play during one lifetime.

Syntax

Parameters

Remarks

For smoother particle animations use the particle animation shader.

Example

time = 0

--Create a window
window = Window:Create()
context = Context:Create(window)
world = World:Create()
camera = Camera:Create()
camera:Move(0,0,-3)
local light = DirectionalLight:Create()
light:SetRotation(35,35,0)

--Create an emitter
emitter = Emitter:Create(1)

local material = Material:Load("Materials/Effects/explosion.mat")
if(material) then

emitter:SetMaterial(material)
end
emitter:SetVelocity(0,0,0,0)
emitter:SetDuration(400)
emitter:SetEmissionVolume(0,0,0)
emitter:SetMaxScale(10.0)
emitter:SetAnimationRows(2)
emitter:SetAnimationColumns(5)
emitter:SetPosition(-1.5,0,0,true)

emitter2 = Emitter:Create(1)

if (material) then
emitter2:SetMaterial(material)
material:Release()
end

emitter2:SetVelocity(0,0,0,0)
emitter2:SetDuration(400)
emitter2:SetEmissionVolume(0,0,0)
emitter2:SetMaxScale(10.0)
emitter2:SetAnimationRows(2)
emitter2:SetAnimationColumns(5)
emitter2:SetPosition(1.5,0,0,true)
emitter2:SetAnimationCycles(2)

while true do
if window:Closed() or window:KeyHit(Key.Escape) then return false end

Time:Update()
world:Update()
world:Render()

context:SetBlendMode(Blend.Alpha)
context:DrawText(emitter:GetAnimationCycles() .. " Animation Cycles" ,200,500)
context:DrawText(emitter2:GetAnimationCycles() .. " Animation Cycles" ,600,500)

context:Sync()
end