SetMaxScale

This function specifies a max size for scaling particles.

Syntax

Parameters

Example

--Create a window
window = Window:Create()
context = Context:Create(window)
world = World:Create()
camera = Camera:Create()
camera:Move(0,0,-3)

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

emitter:ClearScaleControlPoints() --Remove default control points

emitter:AddScaleControlPoint(0,0) --at spawn the particle will have a scale of 0
emitter:AddScaleControlPoint(.5,1) --halfway through the particle's lifetime its be equal to max scale
emitter:AddScaleControlPoint(1,0) --at death the particle will have a scale of 0

local maxscale = 1

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

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

--use up and down arrow key to ajust maxscale
if (window:KeyDown(Key.Up)) then
maxscale = maxscale + 1
emitter:SetMaxScale(maxscale,maxscale)
elseif (window:KeyDown(Key.Down) and maxscale > 0) then
maxscale = maxscale -1
emitter:SetMaxScale(maxscale,maxscale)
end

context:SetBlendMode(Blend.Alpha)
context:DrawText("Max scale: "..emitter:GetMaxScale():ToString(),2,2)

context:Sync()
end