SVGPathElement

Baseline 广泛可用 *

此特性已相当成熟,可在许多设备和浏览器版本上使用。自 ⁨2015 年 7 月⁩以来,各浏览器均已提供此特性。

* 此特性的某些部分可能存在不同级别的支持。

SVGPathElement 接口对应于 <path> 元素。

EventTarget Node Element SVGElement SVGGraphicsElement SVGGeometryElement SVGPathElement

注意: 在 SVG 2 中,getPathSegAtLength()createSVGPathSeg* 方法被移除,pathLength 属性以及 getTotalLength()getPointAtLength() 方法被移至 SVGGeometryElement

实例属性

此接口继承了其父级 SVGGeometryElement 的属性。

SVGPathElement.pathLength 只读

此属性反映了 pathLength 属性。

实例方法

此接口还继承了其父级 SVGGeometryElement 的方法。

SVGPathElement.getPathData() 实验性

返回对应于路径数据的路径段序列,可选择标准化值和段类型。

SVGPathElement.getPointAtLength()

返回沿路径给定距离处的点。

SVGPathElement.getTotalLength()

返回用户代理计算出的路径总长度(用户单位)。

SVGPathElement.setPathData() 实验性

将路径段序列设置为新的路径数据。

SVGPathElement.getPathSegmentAtLength() 实验性

返回沿路径给定距离处的段。

已废弃的方法

SVGPathElement.getPathSegAtLength() 已废弃

返回一个无符号长整数,表示 pathSegList 中利用用户代理的沿路径距离算法的索引。

SVGPathElement.createSVGPathSegClosePath() 已废弃

返回一个独立的、无父级的 SVGPathSegClosePath 对象。

SVGPathElement.createSVGPathSegMovetoAbs() 已废弃

返回一个独立的、无父级的 SVGPathSegMovetoAbs 对象。

SVGPathElement.createSVGPathSegMovetoRel() 已废弃

返回一个独立的、无父级的 SVGPathSegMovetoRel 对象。

SVGPathElement.createSVGPathSegLinetoAbs() 已废弃

返回一个独立的、无父级的 SVGPathSegLinetoAbs 对象。

SVGPathElement.createSVGPathSegLinetoRel() 已废弃

返回一个独立的、无父级的 SVGPathSegLinetoRel 对象。

SVGPathElement.createSVGPathSegCurvetoCubicAbs() 已废弃

返回一个独立的、无父级的 SVGPathSegCurvetoCubicAbs 对象。

SVGPathElement.createSVGPathSegCurvetoCubicRel() 已废弃

返回一个独立的、无父级的 SVGPathSegCurvetoCubicRel 对象。

SVGPathElement.createSVGPathSegCurvetoQuadraticAbs() 已废弃

返回一个独立的、无父级的 SVGPathSegCurvetoQuadraticAbs 对象。

SVGPathElement.createSVGPathSegCurvetoQuadraticRel() 已废弃

返回一个独立的、无父级的 SVGPathSegCurvetoQuadraticRel 对象。

SVGPathElement.createSVGPathSegArcAbs() 已废弃

返回一个独立的、无父级的 SVGPathSegArcAbs 对象。

SVGPathElement.createSVGPathSegArcRel() 已废弃

返回一个独立的、无父级的 SVGPathSegArcRel 对象。

SVGPathElement.createSVGPathSegLinetoHorizontalAbs() 已废弃

返回一个独立的、无父级的 SVGPathSegLinetoHorizontalAbs 对象。

SVGPathElement.createSVGPathSegLinetoHorizontalRel() 已废弃

返回一个独立的、无父级的 SVGPathSegLinetoHorizontalRel 对象。

SVGPathElement.createSVGPathSegLinetoVerticalAbs() 已废弃

返回一个独立的、无父级的 SVGPathSegLinetoVerticalAbs 对象。

SVGPathElement.createSVGPathSegLinetoVerticalRel() 已废弃

返回一个独立的、无父级的 SVGPathSegLinetoVerticalRel 对象。

SVGPathElement.createSVGPathSegCurvetoCubicSmoothAbs() 已废弃

返回一个独立的、无父级的 SVGPathSegCurvetoCubicSmoothAbs 对象。

SVGPathElement.createSVGPathSegCurvetoCubicSmoothRel() 已废弃

返回一个独立的、无父级的 SVGPathSegCurvetoCubicSmoothRel 对象。

SVGPathElement.createSVGPathSegCurvetoQuadraticSmoothAbs() 已废弃

返回一个独立的、无父级的 SVGPathSegCurvetoQuadraticSmoothAbs 对象。

SVGPathElement.createSVGPathSegCurvetoQuadraticSmoothRel() 已废弃

返回一个独立的、无父级的 SVGPathSegCurvetoQuadraticSmoothRel 对象。

规范

规范
Scalable Vector Graphics (SVG) 2
# 接口SVGPathElement

浏览器兼容性

另见