--- title: SVGPathElement slug: Web/API/SVGPathElement tags: - API - SVG - SVG DOM - 参考 - 需要兼容性表 - 需要示例 translation_of: Web/API/SVGPathElement ---
SVGPathElement
接口对应于{{ SVGElement("path") }}元素。
又作用于 | {{ domxref("SVGElement") }}、 {{ domxref("SVGTests") }}、 {{ domxref("SVGLangSpace") }}、 {{ domxref("SVGExternalResourcesRequired") }}、 {{ domxref("SVGStylable") }}、 {{ domxref("SVGTransformable") }}、 {{ domxref("SVGAnimatedPathData") }} |
---|---|
方法 |
|
属性 |
|
规范文档 | SVG 1.1 (2nd Edition) |
名称 | 类型 | 描述 |
---|---|---|
pathLength |
{{ domxref("SVGAnimatedNumber") }} | 对应于给定{{ SVGElement("path") }}元素的{{ SVGAttr("pathLength") }}属性。 |
名称和参数 | 返回 | 描述 |
---|---|---|
getTotalLength () |
浮点数 | 返回用浏览器的 distance-along-a-path 算法计算得出的路径全长,匹配当前用户坐标系中的长度。 |
getPointAtLength(in float distance) |
{{ domxref("SVGPoint") }} | Returns the (x,y) coordinate in user space which is distance units along the path, utilizing the browser's distance-along-a-path algorithm. |
getPathSegAtLength(in float distance) |
无符号长整型 | Returns the index into pathSegList which is distance units along the path, utilizing the user agent's distance-along-a-path algorithm. |
createSVGPathSegClosePath() |
{{ domxref("SVGPathSegClosePath") }} | Returns a stand-alone, parentless {{ domxref("SVGPathSegClosePath") }} object. |
createSVGPathSegMovetoAbs(in float x, in float y) |
{{ domxref("SVGPathSegMovetoAbs") }} | Returns a stand-alone, parentless {{ domxref("SVGPathSegMovetoAbs") }} object. Parameters:
|
createSVGPathSegMovetoRel(in float x, in float y) |
{{ domxref("SVGPathSegMovetoRel") }} | Returns a stand-alone, parentless {{ domxref("SVGPathSegMovetoRel") }} object. Parameters:
|
createSVGPathSegLinetoAbs(in float x, in float y) |
{{ domxref("SVGPathSegLinetoAbs") }} | Returns a stand-alone, parentless {{ domxref("SVGPathSegLinetoAbs") }} object. Parameters:
|
createSVGPathSegLinetoRel(in float x, in float y) |
{{ domxref("SVGPathSegLinetoRel") }} | Returns a stand-alone, parentless {{ domxref("SVGPathSegLinetoRel") }} object. Parameters:
|
createSVGPathSegCurvetoCubicAbs(in float x, in float y, in float x1, in float y1, in float x2, in float y2) |
{{ domxref("SVGPathSegCurvetoCubicAbs") }} | Returns a stand-alone, parentless {{ domxref("SVGPathSegCurvetoCubicAbs") }} object. Parameters:
|
createSVGPathSegCurvetoCubicRel(in float x, in float y, in float x1, in float y1, in float x2, in float y2) |
{{ domxref("SVGPathSegCurvetoCubicRel") }} | Returns a stand-alone, parentless {{ domxref("SVGPathSegCurvetoCubicRel") }} object. Parameters:
|
createSVGPathSegCurvetoQuadraticAbs(in float x, in float y, in float x1, in float y1) |
{{ domxref("SVGPathSegCurvetoQuadraticAbs") }} | Returns a stand-alone, parentless {{ domxref("SVGPathSegCurvetoQuadraticAbs") }} object. Parameters:
|
createSVGPathSegCurvetoQuadraticRel(in float x, in float y, in float x1, in float y1) |
{{ domxref("SVGPathSegCurvetoQuadraticRel") }} | Returns a stand-alone, parentless {{ domxref("SVGPathSegCurvetoQuadraticRel") }} object. Parameters:
|
createSVGPathSegArcAbs(in float x, in float y, in float r1, in float r2, in float angle, in boolean largeArcFlag, in boolean sweepFlag) |
{{ domxref("SVGPathSegArcAbs") }} | Returns a stand-alone, parentless {{ domxref("SVGPathSegArcAbs") }} object. Parameters:
|
createSVGPathSegArcRel(in float x, in float y, in float r1, in float r2, in float angle, in boolean largeArcFlag, in boolean sweepFlag) |
{{ domxref("SVGPathSegArcRel") }} | Returns a stand-alone, parentless {{ domxref("SVGPathSegArcRel") }} object. Parameters:
|
createSVGPathSegLinetoHorizontalAbs(in float x) |
{{ domxref("SVGPathSegLinetoHorizontalAbs") }} | Returns a stand-alone, parentless {{ domxref("SVGPathSegLinetoHorizontalAbs") }} object. Parameters:
|
createSVGPathSegLinetoHorizontalRel(in float x) |
{{ domxref("SVGPathSegLinetoHorizontalRel") }} | Returns a stand-alone, parentless {{ domxref("SVGPathSegLinetoHorizontalRel") }} object. Parameters:
|
createSVGPathSegLinetoVerticalAbs(in float y) |
{{ domxref("SVGPathSegLinetoVerticalAbs") }} | Returns a stand-alone, parentless {{ domxref("SVGPathSegLinetoVerticalAbs") }} object. Parameters:
|
createSVGPathSegLinetoVerticalRel(in float y) |
{{ domxref("SVGPathSegLinetoVerticalRel") }} | Returns a stand-alone, parentless {{ domxref("SVGPathSegLinetoVerticalRel") }} object. Parameters:
|
createSVGPathSegCurvetoCubicSmoothAbs(in float x, in float y, in float x2, in float y2) |
{{ domxref("SVGPathSegCurvetoCubicSmoothAbs") }} | Returns a stand-alone, parentless {{ domxref("SVGPathSegCurvetoCubicSmoothAbs") }} object. Parameters
|
createSVGPathSegCurvetoCubicSmoothRel(in float x, in float y, in float x2, in float y2) |
{{ domxref("SVGPathSegCurvetoCubicSmoothRel") }} | Returns a stand-alone, parentless {{ domxref("SVGPathSegCurvetoCubicSmoothRel") }} object. Parameters
|
createSVGPathSegCurvetoQuadraticSmoothAbs(in float x, in float y) |
{{ domxref("SVGPathSegCurvetoQuadraticSmoothAbs") }} | Returns a stand-alone, parentless {{ domxref("SVGPathSegCurvetoQuadraticSmoothAbs") }} object. Parameters:
|
createSVGPathSegCurvetoQuadraticSmoothRel(in float x, in float y) |
{{ domxref("SVGPathSegCurvetoQuadraticSmoothRel") }} | Returns a stand-alone, parentless {{ domxref("SVGPathSegCurvetoQuadraticSmoothRel") }} object. Parameters:
|
{{ CompatibilityTable() }}
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
---|---|---|---|---|---|
Basic support | {{ CompatUnknown() }} | {{ CompatUnknown() }} | {{ CompatUnknown() }} | {{ CompatUnknown() }} | {{ CompatUnknown() }} |
Feature | Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|
Basic support | {{ CompatNo() }} | {{ CompatUnknown() }} | {{ CompatUnknown() }} | {{ CompatUnknown() }} | {{ CompatUnknown() }} |