博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Elliptical Arcs with SVG
阅读量:4516 次
发布时间:2019-06-08

本文共 2458 字,大约阅读时间需要 8 分钟。

Elliptical Arcs with SVG

An elliptical arc draws an arc from the current point to a specified point. The arc command begins with the x and y radius and ends with the ending point of the arc. Between these are three other values: x axis rotation, large arc flag and sweep flag. The x axis rotation is used to rotate the ellipse that the arc is created from. This rotation maintains the start and end points, whereas a rotation with the transform attribute (outside the path description) would cause the entire path, including the start and end points, to be rotated. The large arc flag and sweep flag control which part of the ellipse is used to cut the arc. These are needed because there's more than one way to place an ellipse so that it includes the start and end points.

Varying x-axis-rotation Example

The leftmost arc has 0 degrees x-axis rotation, the top-middle arc has 30 degrees, the bottom-middle has 45 degrees and the rightmost has 135 degrees. Notice in the source that only the first move command and the angle change since I've used relative coordinates.

<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> 
<svg viewBox = "0 0 1100 400" version = "1.1">
    <stroke = "black" stroke-width = "3" fill = "none">
        <path d = "M 50 200 a 100 50 0 1 1 250 50"/>
        <path d = "M 400 100 a 100 50 30 1 1 250 50"/>
        <path d = "M 400 300 a 100 50 45 1 1 250 50"/>
        <path d = "M 750 200 a 100 50 135 1 1 250 50"/>
    </g>
</svg>

Varying Large Arc and Sweep Flags Example

This example is similar to the one in .

<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> 
<svg viewBox = "0 0 1100 400" version = "1.1">
    <stroke = "navy" stroke-width = "3" fill = "none">
        <path d = "M 300 50 a 150 50 0 0 0 250 50"/>
        <path d = "M 300 200 a 150 50 0 0 1 250 50"/>
        <path d = "M 700 50 a 150 50 0 1 0 250 50"/>
        <path d = "M 700 200 a 150 50 0 1 1 250 50"/>
    </g>
    <text-anchor = "middle" font-size = "25" font = "sans-serif">
        <text x = "400" y = "20">
            large-arc-flag=0
        </text>
        <text x = "825" y = "20">
            large-arc-flag=1
        </text>
    </g>
    <text-anchor = "end" font-size = "25" font = "sans-serif" rotate = "0">
        <text x = "230" y = "70">
            sweep-flag=0
        </text>
        <text x = "230" y = "220">
            sweep-flag=1
        </text>
    </g>
</svg>
参考:http://www.svgbasics.com/arcs.html

转载于:https://www.cnblogs.com/yjstonestar/p/5003731.html

你可能感兴趣的文章
论文网站相关链接
查看>>
ipad4自动下载了ios8的安装包,好几个G啊,不想更新,怎么删了呢?
查看>>
JS中的Navigator 对象
查看>>
Android 开源控件与常用开发框架开发工具类
查看>>
记录一次网站打开卡--排故障过程
查看>>
第四章小结
查看>>
Windows7下python2.7.6环境变量配置
查看>>
java设计模式------代理模式
查看>>
WPF学习笔记----注释标记,使用自定义资源字典(style)文件的流程
查看>>
元素定位的八大法则
查看>>
Sublime Text 3 使用小记
查看>>
总结Pycharm里面常用的快捷键
查看>>
util.promisify 的那些事儿
查看>>
配置phpstudy+phpstorm+xdebug环境
查看>>
BZOJ 1079 [SCOI2008]着色方案
查看>>
[Win8.1系统]双系统
查看>>
HDU 3899 树形DP
查看>>
获取当前页面url信息
查看>>
Java容器类源码分析前言之集合框架结构(基于JDK8)
查看>>
linux下C/C++程序的内存布局
查看>>