一定有办法做到这一点。我用 html5 Canvas 绘制了一个形状,我想对其进行模糊处理。据我所知,没有本地方法,所以我假设需要一个 js 库。问题是大多数图书馆只模糊图像 this一个例如。这可能吗?
最佳答案
myContext.filter = 'blur(10px)';
The CanvasRenderingContext2D.filter property of the Canvas 2D API provides filter effects like blurring or gray-scaling. It is similar to the CSS filter property and accepts the same functions. https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/filter
它仍处于试验阶段,但受 chrome 和 firefox atm 支持。
关于javascript - html Canvas 形状模糊滤镜,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3468038/