Creates a new ParticleSystem.
This function can be slow if it is called repeatedly, such as from love.update or love.draw. If you need to use a specific resource often, create it once and store it somewhere it can be reused!
system = love.graphics.newParticleSystem( image, buffer )
ParticleSystem system
Available since LÖVE 0.9.1
This variant is not supported in earlier versions.
system = love.graphics.newParticleSystem( texture, buffer )
Texture texture
number buffer
ParticleSystem system
You can use the LÖVE logo as an example image.
function love.load() local img = love.graphics.newImage('logo.png') psystem = love.graphics.newParticleSystem(img, 32) psystem:setParticleLifetime(2, 5) -- Particles live at least 2s and at most 5s. psystem:setEmissionRate(5) psystem:setSizeVariation(1) psystem:setLinearAcceleration(-20, -20, 20, 20) -- Random movement in all directions. psystem:setColors(255, 255, 255, 255, 255, 255, 255, 0) -- Fade to transparency. end function love.draw() -- Draw the particle system at the center of the game window. love.graphics.draw(psystem, love.graphics.getWidth() * 0.5, love.graphics.getHeight() * 0.5) end function love.update(dt) psystem:update(dt) end
© 2006–2016 LÖVE Development Team
Licensed under the GNU Free Documentation License, Version 1.3.
https://love2d.org/wiki/love.graphics.newParticleSystem