I'm able to draw a simple circle on HTML5 canvas, but I'd like to add some blur around it.
What I found was this website which explains the shadowBlur
property which can come in handy here.
However, I cannot manage to make the circle itself blurry. What the shadowBlur
property basically does is painting some blur effect after the regular circle has been drawn. What I've tried so far I've put on jsFiddle.
As can be seen, it's a solid filled circle with some blur effect around it - the two parts do not blend into each other at all. What I actually would like to achieve is that the circle itself is fully blurred like this:
Is there any way to draw a blurred circle like this, i.e. that the circle itself also has a blur effect?
You can draw a blurred circle with the following function:
You probably can obtain the bitmap pixel array and apply some blurring algorithm on top of it. For example: http://www.jhlabs.com/ip/blurring.html
You may find the context.filter property useful
Note as of April 2017, IE, Opera and Safari don't support this
If you are still interested in seeing this effect done with EaselJS, this might help JSFiddle EaselJS blur
I'd strongly suggest against blur algorithms unless you are blurring some already-existing drawing that is complex.
For your case, just draw a rect with a radial gradient.
Example:
http://jsfiddle.net/r8Kqy/48/