html canvas shape blur filter

后端 未结 5 675
故里飘歌
故里飘歌 2020-12-09 06:29

There must be a way to do this. I have drawn a shape with the html5 canvas and I would like to blur it. As far as I know there is no native method so I assume a js library i

5条回答
  •  眼角桃花
    2020-12-09 06:55

    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

    it's still experimental but is supported by chrome & firefox atm.

提交回复
热议问题