To draw a circle with a blurry outline like shown in How to draw a blurry circle on HTML5 canvas?, you need to fill the EaselJS Shape with a radial gradient using the same red color but varying transparency values. The key is to specify the colors via the rgba() function, which let you set the alpha channel (opacity or transparency).
Here is the code snippet:
var circle = new createjs.Shape();
var solidRed = 'rgba(255, 0, 0, 1)';
var transparentRed = 'rgba(255, 0, 0, 0)';
circle.graphics.beginRadialGradientFill(
[ solidRed, solidRed, transparentRed ],
[ 0, 0.75, 1 ],
0, 0, 0,
0, 0, 100)
.drawCircle(0, 0, 100);
3 "stop" colors are provided to the radial gradient fill of a 100px radius circle (specified by the 2 arrays [ solidRed, solidRed, transparentRed ] and [ 0, 0.75, 1 ]): solid red at the center, solid red at 75% of the radius, and transparent red at the radius.
The gradient will generate a 75px circle filled with solid red, bordered by a halo going from solid red at 75px to completely transparent red at 100px.
Then you can have fun adjusting:
- that threshold value at which the transparent gradient start (2nd
element of the 2nd array: closer to 0 gives you a larger blurry
outline, closer to 1 gives you a sharper outline)
- the alpha value of your EaselJS Shape (now even the solid circle in the center will also be semi-transparent)
- the compositeOperation of your EaselJS Shape if you plan to have multiple circles overlaps ('lighter' will add the colors together towards white).
I've used a mix of these 3 techniques to create this
image with EaselJS.