SVGPathElement - Web API 接口参考 编辑

SVG path interface

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

接口概览

又作用于SVGElementSVGTestsSVGLangSpaceSVGExternalResourcesRequiredSVGStylableSVGTransformableSVGAnimatedPathData
方法
属性
规范文档SVG 1.1 (2nd Edition)

属性

名称类型描述
pathLengthSVGAnimatedNumber对应于给定<path>元素的pathLength属性。

方法

 

名称和参数返回描述
getTotalLength()浮点数返回用浏览器的 distance-along-a-path 算法计算得出的路径全长,匹配当前用户坐标系中的长度。
getPointAtLength(in float distance)SVGPointReturns 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()SVGPathSegClosePathReturns a stand-alone, parentless SVGPathSegClosePath object.
createSVGPathSegMovetoAbs(in float x, in float y)SVGPathSegMovetoAbsReturns a stand-alone, parentless SVGPathSegMovetoAbs object.

Parameters:
  • float x
    The absolute X coordinate for the end point of this path segment.
  • float y
    The absolute Y coordinate for the end point of this path segment.
createSVGPathSegMovetoRel(in float x, in float y)SVGPathSegMovetoRelReturns a stand-alone, parentless SVGPathSegMovetoRel object.

Parameters:
  • float x
    The relative X coordinate for the end point of this path segment.
  • float y
    The relative Y coordinate for the end point of this path segment.
createSVGPathSegLinetoAbs(in float x, in float y)SVGPathSegLinetoAbsReturns a stand-alone, parentless SVGPathSegLinetoAbs object.

Parameters:
  • float x
    The absolute X coordinate for the end point of this path segment.
  • float y
    The absolute Y coordinate for the end point of this path segment.
createSVGPathSegLinetoRel(in float x, in float y)SVGPathSegLinetoRelReturns a stand-alone, parentless SVGPathSegLinetoRel object.

Parameters:
  • float x
    The relative X coordinate for the end point of this path segment.
  • float y
    The relative Y coordinate for the end point of this path segment.
createSVGPathSegCurvetoCubicAbs(in float x, in float y, in float x1, in float y1, in float x2, in float y2)SVGPathSegCurvetoCubicAbsReturns a stand-alone, parentless SVGPathSegCurvetoCubicAbs object.

Parameters:
  • float x
    The absolute X coordinate for the end point of this path segment.
  • float y
    The absolute Y coordinate for the end point of this path segment.
  • float x1
    The absolute X coordinate for the first control point.
  • float y1
    The absolute Y coordinate for the first control point.
  • float x2
    The absolute X coordinate for the second control point.
  • float y2
    The absolute Y coordinate for the second control point.
createSVGPathSegCurvetoCubicRel(in float x, in float y, in float x1, in float y1, in float x2, in float y2)SVGPathSegCurvetoCubicRelReturns a stand-alone, parentless SVGPathSegCurvetoCubicRel object.

Parameters:
  • float x
    The relative X coordinate for the end point of this path segment.
  • float y
    The relative Y coordinate for the end point of this path segment.
  • float x1
    The relative X coordinate for the first control point.
  • float y1
    The relative Y coordinate for the first control point.
  • float x2
    The relative X coordinate for the second control point.
  • float y2
    The relative Y coordinate for the second control point.
createSVGPathSegCurvetoQuadraticAbs(in float x, in float y, in float x1, in float y1)SVGPathSegCurvetoQuadraticAbsReturns a stand-alone, parentless SVGPathSegCurvetoQuadraticAbs object.

Parameters:
  • float x
    The absolute X coordinate for the end point of this path segment.
  • float y
    The absolute Y coordinate for the end point of this path segment.
  • float x1
    The absolute X coordinate for the first control point.
  • float y1
    The absolute Y coordinate for the first control point.
createSVGPathSegCurvetoQuadraticRel(in float x, in float y, in float x1, in float y1)SVGPathSegCurvetoQuadraticRelReturns a stand-alone, parentless SVGPathSegCurvetoQuadraticRel object.

Parameters:
  • float x
    The relative X coordinate for the end point of this path segment.
  • float y
    The relative Y coordinate for the end point of this path segment.
  • float x1
    The relative X coordinate for the first control point.
  • float y1
    The relative Y coordinate for the first control point.
createSVGPathSegArcAbs(in float x, in float y, in float r1, in float r2, in float angle, in boolean largeArcFlag, in boolean sweepFlag)SVGPathSegArcAbsReturns a stand-alone, parentless SVGPathSegArcAbs object.

Parameters:
  • float x
    The absolute X coordinate for the end point of this path segment.
  • float y
    The absolute Y coordinate for the end point of this path segment.
  • float r1
    The x-axis radius for the ellipse.
  • float r2
    The y-axis radius for the ellipse.
  • float angle
    The rotation angle in degrees for the ellipse's x-axis relative to the x-axis of the user coordinate system.
  • boolean largeArcFlag
    The value of the large-arc-flag parameter.
  • boolean sweepFlag
    The value of the large-arc-flag parameter.
createSVGPathSegArcRel(in float x, in float y, in float r1, in float r2, in float angle, in boolean largeArcFlag, in boolean sweepFlag)SVGPathSegArcRelReturns a stand-alone, parentless SVGPathSegArcRel object.

Parameters:
  • float x
    The relative X coordinate for the end point of this path segment.
  • float y
    The relative Y coordinate for the end point of this path segment.
  • float r1
    The x-axis radius for the ellipse.
  • float r2
    The y-axis radius for the ellipse.
  • float angle
    The rotation angle in degrees for the ellipse's x-axis relative to the x-axis of the user coordinate system.
  • boolean largeArcFlag
    The value of the large-arc-flag parameter.
  • boolean sweepFlag
    The value of the large-arc-flag parameter.
createSVGPathSegLinetoHorizontalAbs(in float x)SVGPathSegLinetoHorizontalAbsReturns a stand-alone, parentless SVGPathSegLinetoHorizontalAbs object.

Parameters:
  • float x
    The absolute X coordinate for the end point of this path segment.
createSVGPathSegLinetoHorizontalRel(in float x)SVGPathSegLinetoHorizontalRelReturns a stand-alone, parentless SVGPathSegLinetoHorizontalRel object.

Parameters:
  • float x
    The relative X coordinate for the end point of this path segment.
createSVGPathSegLinetoVerticalAbs(in float y)SVGPathSegLinetoVerticalAbsReturns a stand-alone, parentless SVGPathSegLinetoVerticalAbs object.

Parameters:
  • float y
    The absolute Y coordinate for the end point of this path segment.
createSVGPathSegLinetoVerticalRel(in float y)SVGPathSegLinetoVerticalRelReturns a stand-alone, parentless SVGPathSegLinetoVerticalRel object.

Parameters:
  • float y
    The relative Y coordinate for the end point of this path segment.
createSVGPathSegCurvetoCubicSmoothAbs(in float x, in float y, in float x2, in float y2)SVGPathSegCurvetoCubicSmoothAbsReturns a stand-alone, parentless SVGPathSegCurvetoCubicSmoothAbs object.

Parameters
  • float x
    The absolute X coordinate for the end point of this path segment.
  • float y
    The absolute Y coordinate for the end point of this path segment.
  • float x2
    The absolute X coordinate for the second control point.
  • float y2
    The absolute Y coordinate for the second control point.
createSVGPathSegCurvetoCubicSmoothRel(in float x, in float y, in float x2, in float y2)SVGPathSegCurvetoCubicSmoothRelReturns a stand-alone, parentless SVGPathSegCurvetoCubicSmoothRel object.

Parameters
  • float x
    The absolute X coordinate for the end point of this path segment.
  • float y
    The absolute Y coordinate for the end point of this path segment.
  • float x2
    The absolute X coordinate for the second control point.
  • float y2
    The absolute Y coordinate for the second control point.
createSVGPathSegCurvetoQuadraticSmoothAbs(in float x, in float y)SVGPathSegCurvetoQuadraticSmoothAbsReturns a stand-alone, parentless SVGPathSegCurvetoQuadraticSmoothAbs object.

Parameters:
  • float x
    The absolute X coordinate for the end point of this path segment.
  • float y
    The absolute Y coordinate for the end point of this path segment.
createSVGPathSegCurvetoQuadraticSmoothRel(in float x, in float y)SVGPathSegCurvetoQuadraticSmoothRelReturns a stand-alone, parentless SVGPathSegCurvetoQuadraticSmoothRel object.

Parameters:
  • float x
    The absolute X coordinate for the end point of this path segment.
  • float y
    The absolute Y coordinate for the end point of this path segment.

 

浏览器兼容性

We're converting our compatibility data into a machine-readable JSON format. This compatibility table still uses the old format, because we haven't yet converted the data it contains. Find out how you can help!
FeatureChromeFirefox (Gecko)Internet ExplorerOperaSafari (WebKit)
Basic support?????
FeatureAndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Basic support未实现????

参见

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:99 次

字数:25230

最后编辑:7年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文