GetScaleAtTime
This function returns a scale value for a given time.
Syntax
- number GetScaleAtTime(number time)
Parameters
- time: - A value between 0.0 and 1.0 specifying the time at which you want to find the scale. 0 being a particle's birth and 1 being a particles death.
Returns
This function returns a float with a value between 0.0 and 1.0 designating the scale at that time. 0.0 being tiny and 1.0 corresponding to max scale.
Example
time = 0.5
--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(100)
emitter:AddScaleControlPoint(0,0)
emitter:AddScaleControlPoint(1,1)
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
time = time + 0.01
elseif (window:KeyDown(Key.Down)) then
time = time - 0.01
end
time = math.max(0,time)
time = math.min(1,time)
context:SetBlendMode(Blend.Alpha)
context:DrawText("At "..(time*100) .. " percent of the particles life scale will be :" .. emitter:GetScaleAtTime(time) ,2,2)
context:Sync()
end