CSS3 Filters (not to be confused with the, now deprecated, Microsoft CSS filters) are used to post-process the rendering of parts of the DOM.
They are still a Draft and might change in the future. However, firefox and webkit have already some implementations.
Filters are enabled on one or more DOM elements with the CSS property filter. There are two quite different ways to implement filters. The more immediate one is by adding one or more filter directly in the CSS. The other is by specifying an URL to a SVG filter. This latter way is much more flexible and feature rich. It requires, however, that the browser supports SVG. Fortunately all major ones do so.
Somehwere in the HTML code we have to place this SVG tag. Since it's size is 0x0 it should not affect the rendering of the page.
The only child of this SVG is the filter we set in the CSS (myfilter).
While implementing the scripts of this post I encountered a problem with chrome. When changing some of the filters by modifying the DOM with javascript the image was not updated. I noticed however that
when the blur was changed, the filter was applied. A quick workaround was, therefore, to change the blur and set it back at each value change.
A probably better solution to the problem is to remove and re-add the filter.
No comments:
Post a Comment