General discussion about LÖVE, Lua, game development, puns, and unicorns.
gbstack
Prole
Posts: 3 Joined: Sat Mar 26, 2011 11:09 am
Post
by gbstack » Sat Mar 26, 2011 11:22 am
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.
Robin
The Omniscient
Posts: 6506 Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:
Post
by Robin » Sat Mar 26, 2011 1:34 pm
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.
gbstack
Prole
Posts: 3 Joined: Sat Mar 26, 2011 11:09 am
Post
by gbstack » Sun Mar 27, 2011 8:26 am
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...
vrld
Party member
Posts: 917 Joined: Sun Apr 04, 2010 9:14 pm
Location: Germany
Contact:
Post
by vrld » Sun Mar 27, 2011 8:41 am
Create a white fuzzy dot.
Use love.graphics.setColor
?????
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
Post
by gbstack » Wed May 04, 2011 9:37 am
vrld wrote:
Create a white fuzzy dot.
Use love.graphics.setColor
?????
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...)
Users browsing this forum: No registered users and 5 guests