1
是否可以在已绘制的画布上添加发光效果而无需自己计算? (使用渐变,阴影或其他...)HTML5画布上的发光效果?
我已经尝试通过将画布作为图像绘制到不同的画布并使用添加的阴影进行绘制来添加发光。 问题在于它取决于阴影周围的像素数量 - 因为它模糊了图像 - 所以这不够好。
是否可以在已绘制的画布上添加发光效果而无需自己计算? (使用渐变,阴影或其他...)HTML5画布上的发光效果?
我已经尝试通过将画布作为图像绘制到不同的画布并使用添加的阴影进行绘制来添加发光。 问题在于它取决于阴影周围的像素数量 - 因为它模糊了图像 - 所以这不够好。
有一个网站可以查看发光效果,以及其他印刷效果,如画布文字here。
这里的光晕效果要点:
// Assuming your canvas element is ctx
ctx.shadowColor = “red” // string
//Color of the shadow; RGB, RGBA, HSL, HEX, and other inputs are valid.
ctx.shadowOffsetX = 0; // integer
//Horizontal distance of the shadow, in relation to the text.
ctx.shadowOffsetY = 0; // integer
//Vertical distance of the shadow, in relation to the text.
ctx.shadowBlur = 10; // integer
//Blurring effect to the shadow, the larger the value, the greater the blur.