SVG blur effects
- Previous page SVG filters
- Next page SVG shadows
<defs> i <filter>
Wszystkie filtry SVG znajdują się w <defs>
zdefiniowane w elementach.<defs>
Elementy definiują (definitions) skrócone, które zawierają definicje specjalnych elementów (np. filtrów).
<filter>
Elementy do definiowania filtrów SVG.<filter>
Element ma wymagany atrybut id, który identyfikuje filtr. Następnie grafika wskazuje na używany filtr.
SVG <feGaussianBlur>
Przykład 1
<feGaussianBlur>
Elementy do tworzenia efektu rozmycia:
Oto kod SVG:
<svg height="110" width="110"> <defs> <filter id="f1" x="0" y="0"> <feGaussianBlur in="SourceGraphic" stdDeviation="15" /> </filter> </defs> <rect width="90" height="90" stroke="green" stroke-width="3" fill="yellow" filter="url(#f1)" /> </svg>
Wyjaśnienie kodu:
- Atrybut id elementu <filter> definiuje unikalną nazwę filtra
- Element <feGaussianBlur> definiuje efekt rozmycia
- definiowanie efektu dla całego elementu
- The stdDeviation attribute defines the amount of blur
- The filter attribute of the <rect> element links the element to the "f1" filter
- Previous page SVG filters
- Next page SVG shadows