项目作者: Ldash4

项目描述 :
GPU particles for love2d
高级语言: Lua
项目地址: git://github.com/Ldash4/party.git
创建时间: 2017-12-18T12:45:17Z
项目社区:https://github.com/Ldash4/party

开源协议:MIT License

下载


party.lua (love2d 0.9.0+, tested with 0.10.2 - 0.11.0)

Disclaimer

  • This is not a replacement for love2d’s particlesystem
  • party.lua will look bad if you change any of it’s parameters while it is emitting particles
  • The system can be running or not running, there is nothing in between, and when it is not running, all the particles dissappear instantly

Why?

party.lua generates all particles each frame, independant of previous or future states. This means that when it is stopped, it doesn’t know how long ago it stopped. It also isn’t aware of what parameters it had last frame, so changing the parameters makes it think that the parameters have always been changed.

So why should I use this?

While it obviously isn’t good for dynamic systems, it is perfect for static systems. Think a waterfall or a fire.

Tested on a gtx 970, party.lua can easily spawn a few hundred thousand particles without slowing down.

Usage

  1. local party = require("party")
  2. local system = party(750)
  3. :origin(50, 50)
  4. :radius(5, 25)
  5. :startColor(0, 0.2, 1)
  6. :areaSpread(100, 60)
  7. :linearAcceleration(0, 1000)
  8. :endColor(0, 0.9, 1, 0)
  9. :lifetime(1, 1.2)
  10. :startAngle(-math.pi, math.pi)
  11. :spin(-2, 2)
  12. :direction(math.pi / 2)
  13. :speed(250)
  14. function love.update(dt)
  15. system:update(dt)
  16. end
  17. function love.draw()
  18. system:draw()
  19. end

This will spawn a nice waterfall with 750 particles.

Documentation

Documentation can be found here

Potential future features

  • Linear interpolation between more than two colors