x4js - v2.2.49
    Preparing search index...

    Class SvgGradient

    Represents an SVG linear gradient element. It extends SvgItem to inherit common SVG element functionalities.

    Hierarchy (View Summary)

    Index
    _dom: SVGElement
    • get id(): string

      Gets the URL reference to this gradient, suitable for use in fill or stroke attributes.

      Returns string

      A string in the format url(#<gradient_id>).

    • Adds a color stop to the gradient.

      Parameters

      • offset: number_or_perc

        The offset of the color stop, either as a number (0-100) or a percentage string.

      • color: string

        The color at this stop.

      Returns this

      The current SvgGradient instance for chaining.

    • Set the shape rendering attribute to control anti-aliasing for shapes.

      When enabled, the attribute is set to "auto" to allow smoothing/anti-aliasing. When disabled, the attribute is set to "crispEdges" to favor pixel-aligned, non-anti-aliased rendering.

      Parameters

      • set: boolean

        True to enable anti-aliasing ("auto"), false to disable ("crispEdges").

      Returns SvgGradient

      the current instance to allow chaining).

    • define a new attribute

      Parameters

      • name: string

        attibute name

      • value: string

        attribute value

      Returns this

      this

    • change one style value

      Type Parameters

      • K extends keyof CSSStyleDeclaration

      Parameters

      • name: K
      • value: string | number

      Returns this

    • change the stroke color

      Parameters

      • color: string
      • Optionalwidth: number

      Returns this