function love.load() local canvas = love.graphics.newCanvas(16, 16) -- love.graphics.setCanvas(canvas) -- love.graphics.clear() -- love.graphics.setBlendMode("alpha") -- love.graphics.setColor(1, 0, 0, 0.8) -- love.graphics.rectangle('fill', 0, 0, 100, 100) -- love.graphics.setCanvas() local img = love.graphics.newImage('ghost.png') psystem = love.graphics.newParticleSystem(img, 32) psystem:setParticleLifetime(1, 5) -- Particles live at least 2s and at most 5s. psystem:setEmissionRate(5) psystem:setSizeVariation(0.7) psystem:setLinearAcceleration(-40, -40, 40, 40) -- Random movement in all directions. psystem:setColors(1, 1, 1, 0.5, 1, 1, 1, 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 local frame = 0 function love.update(dt) psystem:update(dt) frame = frame + 1 s = love.graphics.captureScreenshot(string.format( "%012d.png", frame ) ) end