how to draw a fuzzy point(using in particle system)?

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
gbstack
Prole
Posts: 3
Joined: Sat Mar 26, 2011 11:09 am

how to draw a fuzzy point(using in particle system)?

Post by gbstack »

Hi,everyone!

I want to draw fuzzy points(just like LOVE particle system),anyone could tell me the methods or what should I search?

Any suggestion is appreciated.:)
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: how to draw a fuzzy point(using in particle system)?

Post by Robin »

The simplest way to go about that would be to use an image of a fuzzy point, and drawing that or giving it to a particle system.
Help us help you: attach a .love.
gbstack
Prole
Posts: 3
Joined: Sat Mar 26, 2011 11:09 am

Re: how to draw a fuzzy point(using in particle system)?

Post by gbstack »

Thanks for your suggestion!:)
it's a good method but I want to change the color of particles as time passing by.Can I achieve this by using the image as the particle?

I don't know whether an algorithm which is used to create fuzzy particles exists...:(
User avatar
vrld
Party member
Posts: 917
Joined: Sun Apr 04, 2010 9:14 pm
Location: Germany
Contact:

Re: how to draw a fuzzy point(using in particle system)?

Post by vrld »

  1. Create a white fuzzy dot.
  2. Use love.graphics.setColor
  3. ?????
  4. Profit
You can create the fuzzy point by setting the pixels-alpha values of an ImageData depending on how far they are away from the image's center, e.g.:

Code: Select all

id:mapPixel(function(x,y) -- assuming a square imagedata
    local dx,dy = x - WIDTH/2, y - WIDTH/2
    local d = math.sqrt(dx*dx + dy*dy) / (WIDTH/2)
    return 255,255,255, math.max(0, 1 - d) * 255
end)
I have come here to chew bubblegum and kick ass... and I'm all out of bubblegum.

hump | HC | SUIT | moonshine
gbstack
Prole
Posts: 3
Joined: Sat Mar 26, 2011 11:09 am

Re: how to draw a fuzzy point(using in particle system)?

Post by gbstack »

vrld wrote:
  1. Create a white fuzzy dot.
  2. Use love.graphics.setColor
  3. ?????
  4. Profit
You can create the fuzzy point by setting the pixels-alpha values of an ImageData depending on how far they are away from the image's center, e.g.:

Code: Select all

id:mapPixel(function(x,y) -- assuming a square imagedata
    local dx,dy = x - WIDTH/2, y - WIDTH/2
    local d = math.sqrt(dx*dx + dy*dy) / (WIDTH/2)
    return 255,255,255, math.max(0, 1 - d) * 255
end)


thanks very much!
It has been solved by using your method.(sorry for my late reply...)
Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests