SVG stroke 属性

  1、stroke

  2、stroke-width

  3、stroke-linecap

  4、stroke-dasharray

  5、stroke-opacity

  6、stroke-linejoin

Stroke 属性

  边框色,属性定义一条线,文本或元素轮廓颜色

SVG代码:

<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
 
<g fill="none">
   
<path stroke="red" d="M5 20 l215 0" />
   
<path stroke="blue" d="M5 40 l215 0" />
   
<path stroke="black" d="M5 60 l215 0" />
 
</g>
</svg>

stroke-width属性

stroke-width属性定义了一条线,文本或元素轮廓厚度

SVG代码:

<svg
xmlns="http://www.w3.org/2000/svg" version="1.1">
 
<g fill="none" stroke="black">
   
<path stroke-width="2" d="M5 20 l215 0" />
   
<path stroke-width="4" d="M5 40 l215 0" />
   
<path stroke-width="6" d="M5 60 l215 0" />
 
</g>
</svg>

Stroke-linecap属性

Stroke-linecap属性定义线段端点的风格,这个属性可以使用butt/square/round三个值

SVG代码:

<svg
xmlns="http://www.w3.org/2000/svg" version="1.1">
 
<g fill="none" stroke="black" stroke-width="6">
   
<path stroke-linecap="butt" d="M5 20 l215 0" />
   
<path stroke-linecap="round" d="M5 40 l215 0" />
   
<path stroke-linecap="square" d="M5 60 l215 0" />
 
</g>
</svg>

stroke-dasharray属性

该属性用于创建虚线:

SVG代码:

<svg
xmlns="http://www.w3.org/2000/svg" version="1.1">
 
<g fill="none" stroke="black" stroke-width="4">
   
<path stroke-dasharray="5,5" d="M5 20 l215 0" />
   
<path stroke-dasharray="10,10" d="M5 40 l215 0" />
   
<path stroke-dasharray="20,10,5,5,5,10" d="M5 60 l215 0"
/>
 
</g>
</svg>

stroke-opacity属性

该属性设置边框的透明度,值的范围从0到1

SVG代码:

<svg
width="160" height="280"
xmlns="http://www.w3.org/2000/svg">

<polyline points="40 60 80 20 120 60"
stroke="black" stroke-opacity="1"
stroke-width="10" 
fill="transparent" stroke-linejoin="miter" />

<polyline points="40 100 80 60 120 100"
stroke="black" stroke-opacity="0.5"
stroke-width="10" fill="transparent"
stroke-linejoin="round" />

<polyline points="40 140 80 100 120 140"
stroke="black" stroke-opacity="0.1"
stroke-width="10" fill="transparent" stroke-linejoin="bevel"
/>

</svg>

stroke-join属性

该属性设置线条拐弯处的连接方式

SVG代码:

<svg
width="160" height="280"
xmlns="http://www.w3.org/2000/svg">

<polyline points="40 60 80 20 120 60"
stroke="black" 
stroke-width="10" 
fill="transparent" stroke-linejoin="miter" />

<polyline points="40 100 80 60 120 100" stroke="black"  stroke-width="10"
fill="transparent" stroke-linejoin="round" />

<polyline points="40 140 80 100 120 140"
stroke="black" 
stroke-width="10" fill="transparent"
stroke-linejoin="bevel" />

</svg>

学习SVG系列(3):SVG Stroke属性的更多相关文章

  1. SVG 学习<二>进阶 SVG世界,视野,视窗 stroke属性 svg分组

    目录 SVG 学习<一>基础图形及线段 SVG 学习<二>进阶 SVG世界,视野,视窗 stroke属性 svg分组 SVG 学习<三>渐变 SVG 学习<四 ...

  2. 学习SVG系列(4):SVG滤镜效果

    注意:Internet Explorer和Safari不支持SVG滤镜 <defs>.<filter> 所有互联网的SVG滤镜定义在<defs>元素中,<fi ...

  3. 学习SVG系列(1):SVG基础

    什么是SVG? 1.指可伸缩矢量图形 2.用来定义用于网络的基于矢量的图形 3.使用XML格式定义图形 4.图像在放大或改变尺寸的情况下其图形不会有所损失 5.万维网联盟的标准, 用于描述二维矢量图形 ...

  4. 3. svg学习笔记-基本形状和画笔属性

    svg中可以绘制的基本图形有线段,矩形,多边形,圆,椭圆,分别来看一下这些基本图形: 线段 使用<line>元素创建一条线段,格式如下: <line x1=" start- ...

  5. SVG Stroke属性

    一.stroke属性介绍 SVG提供了一个范围广泛stroke属性,用于描述轮廓,其中包括 stroke 指定颜色 stroke-width 指定宽度 stroke-linecap 指定端点样式 st ...

  6. 学习SVG系列(5):SVG渐变

    SVG渐变 渐变是一种从一种颜色到另一种颜色的平滑过渡,可以把多个颜色的过渡应用到同一个元素. 渐变有两种: Linear Redial 线性渐变-<linearGradient> lin ...

  7. SVG系列教程:SVG简介与嵌入HTML页面的方式

    地址:http://www.w3cplus.com/html5/svg-introduction-and-embedded-html-page.html 随着技术向前的推进,SVG相关的讨论也越渐频繁 ...

  8. HTML5 学习03——内联 SVG

    什么是SVG? SVG 指可伸缩矢量图形 (Scalable Vector Graphics) SVG 用于定义用于网络的基于矢量的图形 SVG 使用 XML 格式定义图形 SVG 图像在放大或改变尺 ...

  9. MongoDB学习笔记系列

    回到占占推荐博客索引 该来的总会来的,Ef,Redis,MVC甚至Sqlserver都有了自己的系列,MongoDB没有理由不去整理一下,这个系列都是平时在项目开发时总结出来的,希望可以为各位一些帮助 ...

随机推荐

  1. linux上使用shell脚本查看内存使用率

    如上的内存利用率 = [-/+buffers/cache:used]/[Mem:total ] =  6293404 / 16333656 对于free命令而言,有如下公式: total = used ...

  2. Redis学习笔记二

    学习Redis添加Object时,由于Redis只能存取字符串String,对于其它数据类型形容:Int,long,double,Date等不提供支持,因而需要设计到对象的序列化和反序列化.java序 ...

  3. java sqlhelper

    dbinfo.properties部分: 注意每行末尾不可以有空格 #oracle configure UserName=scott Password=tiger Driver=oracle.jdbc ...

  4. Ubuntu 16.04 安装 .NET Core[转]

    upir@upir-Rev-1-0:~$ sudo sh -c 'echo "deb [arch=amd64] https://apt-mo.trafficmanager.net/repos ...

  5. canvas学习笔记:canvas对图片的像素级处理--ImageData的应用

    学习了canvas的基本绘图功能后,惊喜的发现canvas对图片数据也有相当强大的处理功能,能够从像素级别操作位图,当然[lte ie8]不支持. 主要的函数有三个: ctx.createImageD ...

  6. Handle机制的原理

    Android提供了Handle和Looper来满足线程间的通信.Handle先进先出原则.Looper类用来管理特定线程内对象之间的消息交换(Message Exchange). 1.Looper: ...

  7. Proxy Pattern(Java动态代理和cglib的实现)

    代理模式:给某一个对象提供代理对象,由代理对象控制具体对象的引用. 代理,指的就是一个角色对表另一个角色采取行动,就生活中,一个红酒厂商,是不会直接把红酒零销给客户的,都是通过代理完成他的销售业务.而 ...

  8. Java常见面试题(含答案)

    第一,谈谈final, finally, finalize的区别. final?修饰符(关键字)如果一个类被声明为final,意味着它不能再派生出新的子类,不能作为父类被继承.因此一个类不能既被声明为 ...

  9. 实验一 cmd命令的编写

    一.目的和要求 1. 实验目的 (1)掌握命令解释程序的原理: (2)*掌握简单的DOS调用方法: (3)掌握C语言编程初步. 2.实验要求 编写类似于DOS,UNIX的命令行解释程序 (1)自行定义 ...

  10. windows内核编程 白话设备栈

    在ntddk.h中定义了该函数原型: #if (NTDDI_VERSION >= NTDDI_WINXP) NTKERNELAPI NTSTATUS IoAttachDeviceToDevice ...