- From: Alex Fritze <alex@croczilla.com>
- Date: Thu, 15 Jul 2004 12:47:27 +0100
- To: www-svg@w3.org
Hi,
The SVGLinearGradientElement interfaces specifies that x1, y1, x2 and y2
are of type SVGAnimatedLength.
The specs further say:
" If patternUnits="userSpaceOnUse", x, y, width, height represent values
in the coordinate system that results from taking the current user
coordinate system in place at the time when the 'pattern' element is
referenced (i.e., the user coordinate system for the element referencing
the 'pattern' element via a 'fill'
<http://www.croczilla.com/%7Ealex/reference/SVG/REC-SVG11-20030114/painting.html#FillProperty>
or 'stroke'
<http://www.croczilla.com/%7Ealex/reference/SVG/REC-SVG11-20030114/painting.html#StrokeProperty>
property) and then applying the transform specified by attribute
patternTransform
<http://www.croczilla.com/%7Ealex/reference/SVG/REC-SVG11-20030114/pservers.html#PatternTransformAttribute>."
and
"Percentages are allowed for *x1, y1, x2, y2*. For
gradientUnits="userSpaceOnUse", percentages represent values relative to
the current viewport. For gradientUnits="objectBoundingBox", percentages
represent values relative to the bounding box for the object."
Now consider a gradient referenced by several elements:
<svg>
<defs>
<linearGradient id="MyGradient" x2="50%">
<stop offset="5%" stop-color="#F60" />
<stop offset="95%" stop-color="#FF6" />
</linearGradient>
</defs>
<rect fill="url(#MyGradient)" stroke="black" stroke-width="5"
x="100" y="100" width="600" height="200"/>
<rect fill="url(#MyGradient)" stroke="black" stroke-width="5"
x="100" y="400" width="60" height="20"/>
</svg>
My problem is, what value should the following expression yield:
document.getElementById("MyGradient").x2.baseVal.value;
Should it be 300 or 30 or 0.5, or throw an error even?
Alex
Received on Thursday, 15 July 2004 08:47:35 UTC