SVG seed Attribute

Last Updated : 31 Mar, 2022

The seed attribute denotes the starting number for the pseudo-random number generator of the <feTurbulence> filter primitive. Only <feTurbulence> element is using this attribute.

Syntax:

seed = "number"

Attribute Values: The seed attribute accepts the values mentioned above and described below

  • number: It is either an integer or a number with a fractional component. The default value is equal to 0.

The Below examples illustrate the use of the seed attribute.

Example 1:

HTML
<!DOCTYPE html>
<html>

<body>
    <div style="color: green; 
              margin-left: 50px;">

        <h1>GeeksforGeeks</h1>

        <svg viewBox="0 0 920 200" 
            xmlns="http://www.w3.org/2000/svg">
            
            <filter id="geek1" x="0" y="0" 
                width="100%" height="100%">
                
                <feTurbulence baseFrequency="0.050" 
                    seed="0" />
            </filter>

            <rect x="0" y="0" width="200" 
                height="200" 
                style="filter:url(#geek1);" />
        </svg>
    </div>
</body>

</html>

Output:

Example 2:

HTML
<!DOCTYPE html>
<html>

<body>
    <div style="color: green; 
                margin-left: 50px;">

        <h1>GeeksforGeeks</h1>

        <svg viewBox="0 0 920 200" 
            xmlns="http://www.w3.org/2000/svg">

            <filter id="geek2" x="0" y="0" 
                width="100%" height="100%">

                <feTurbulence baseFrequency="0.050"
                    seed="100" />
            </filter>

            <rect x="0" y="0" width="200" 
                height="200" 
                style="filter:url(#geek2);" />
        </svg>
    </div>
</body>

</html>

Output:

Comment