Let’s say we want to apply a SVG filter on a canvas element. According to this we can apply a SVG filter to the CanvasRenderingContext2D in javascript like this, the filter will only affect shapes drawn after that call: We can also just apply the filter in CSS on the whole canvas: I need to apply the filter in javascript