linearGradient()
Produces a SVG "linearGradient"
element.
Syntax
linearGradient(
id STRING,
x1 STRING,
y1 STRING,
x2 STRING,
y2 STRING,
spreadMethod STRING,
gradientTransform STRING,
gradientUnits STRING )
RETURNS om.DomNode
- id is the SVG object identifier.
- x1 defines the X coordinate of the linear gradient start point.
- y1 defines the Y coordinate of the linear gradient start point.
- x2 defines the X coordinate of the linear gradient end point.
- y2 defines the Y coordinate of the linear gradient end point.
- spreadMethod defines how the gradient is spread out through the shape.
- gradientTransform defines the gradient transformation.
- gradientUnits defines the coordinate system to be used.
Usage
This function creates a "linearGradient"
SVG DOM element from the
parameters.
A SVG "linearGradient"
element can be used to define fill colors of shapes.
The element must contain "stop"
elements that can be created with the stop
function.
The resulting gradient definition can be added to a "defs"
SVG DOM element.
Example
DEFINE root_svg, defs, lg om.DomNode
...
LET defs = fglsvgcanvas.defs( NULL )
CALL root_svg.appendChild( defs )
LET lg = fglsvgcanvas.linearGradient( "gradient_1",
"0%", "0%", "0%", "100%",
"pad", NULL, NULL )
CALL lg.appendChild( fglsvgcanvas.stop( "0%", "gray", 0.8 ) )
CALL lg.appendChild( fglsvgcanvas.stop( "100%", "navy", 0.6 ) )
CALL defs.appendChild( lg )
...