[svg 翻译教程]Polyline(折线)polygon(多边形)
原文: http://tutorials.jenkov.com/svg/polygon-element.html
Polyline
虽然说这个 元素我没用过,但是还是蛮强大的,也翻译下
示例
<svg xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"> <polyline points="0,0 30,0 15,30"
style="stroke:#006600;"/>
</svg>
效果如下
折线是通过定义很多点来定义的,在points 属性中每个点 都是x,y 这样的形式,这个例子有3个点
折线是通过链接这三个点,然后填充,默认的填充颜色是黑色
看看另外的填充效果
<svg xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"> <polyline points="10,2 60,2 35,52"
style="stroke:#006600; stroke-width: 2;
fill: #33cc33;"/>
</svg>
效果
通过对比 我们发现边框的怎么少了一个边?
因为只有两个点之间才会被链接!要绘制闭合的三角形
代码如下
<svg xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"> <polyline points="10,2 60,2 35,52 10,2"
style="stroke:#006600; fill: #33cc33;"/>
</svg>

把最后一个点设为和起点一样,就可以看到闭合的三角形了
Polygon
首先看一个多边形示例
<svg xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"> <polygon points="10,0 60,0 35,50"
style="stroke:#660000; fill:#cc3333;"/> </svg>
效果如下

通过观察代码和效果发现,在points里面只有3个点,但是效果图里面3边都绘制了。
因为polygon 元素在连线的时候,会把所有的点连接起来,包括第一个点和最后一个点。
polyline 元素是不连接最后一个点和第一个点的。
这好像是polygon和polyline最大的区别
来个更夸张的 示意图 8变形
<svg xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"> <polygon points="50,5 100,5 125,30 125,80 100,105
50,105 25,80 25, 30"
style="stroke:#660000; fill:#cc3333; stroke-width: 3;"/> </svg>

[svg 翻译教程]Polyline(折线)polygon(多边形)的更多相关文章
- [svg翻译教程]椭圆(ellipse元素)和线(line元素)
line 先看个例子,这是svg中最简单的线 <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http:/ ...
- [javascript svg fill stroke stroke-width points polygon属性讲解] svg fill stroke stroke-width points polygon绘制多边形属性并且演示polyline和polygon区别讲解
<!DOCTYPE html> <html lang='zh-cn'> <head> <title>Insert you title</title ...
- AMap编辑折线、多边形、圆
<!doctype html> <html> <head> <meta charset="utf-8"> <meta http ...
- Leaflet:Path、Polyline、Polygon、Rectangle、Circle、CircleMarker
下边介绍Vector Layer Path(Layer) Path是其他Vector Layer的父类,比如Polyline.Polygon.Rectangle.Circle.CircleMarker ...
- PS网页设计教程——30个优秀的PS网页设计教程的中文翻译教程
PS网页设计教程--30个优秀的PS网页设计教程的中文翻译教程 作为编码者,美工基础是偏弱的.我们可以参考一些成熟的网页PS教程,提高自身的设计能力.套用一句话,"熟读唐诗三百首,不会作 ...
- pfSense用户界面汉化翻译教程
pfSense用户界面汉化翻译教程 来源 https://blog.51cto.com/fxn2025/2087182 为了记录自己的汉化过程,同时也为了方便网友自己制作汉化版本,我把自己汉化pfSe ...
- svg.js教程及使用手册详解(二)
上篇简要介绍了svg.js的基本信息和基本用法,这篇开始详细讲解svg.js的用法. SVG元素 SVG元素主要包括各种形状.线条.文本.路径. 矩形——Rect Rects有两个参数,即矩形的宽度和 ...
- svg学习(七)polygon
<polygon> 标签用来创建含有不少于三个边的图形. <?xml version="1.0" standalone="no"?> & ...
- NeHe OpenGL教程 第二课:多边形
前言 声明,此 NeHe OpenGL教程系列文章由51博客yarin翻译(2010-08-19),本博客为转载并稍加整理与修改.对NeHe的OpenGL管线教程的编写,以及yarn的翻译整理表示感谢 ...
随机推荐
- Android的Intent.FLAG_ACTIVITY_CLEAR_TOP无效
转载:http://blog.csdn.net/u011361576/article/details/48626237 今天写代码遇到了一个问题: 当 B - A - B 跳转的时候,使用Intent ...
- Windows Server 2012 在桌面上显示”我的电脑”图标
1.本地方式如果是在Windows Server 2012本地控制台下,直接按Win(键盘上的微软徽标键)+R,输入: rundll32.exe shell32.dll,Control_RunDLL ...
- Python之Web框架Django
Python之Web框架: Django 一. Django Django是一个卓越的新一代Web框架 Django的处理流程 1. 下载地址 Python 下载地址:https://www.pyt ...
- $.extend()、$.fn和$.fn.extend()
理解$.extend().$.fn和$.fn.extend() 原文链接:http://caibaojian.com/jquery-extend-and-jquery-fn-extend.ht ...
- PE读写
// 仿PE文件.cpp : Defines the entry point for the console application.// #include "stdafx.h"# ...
- html5 Application Cache 机制以及使用
那什么是Application Cache呢? 顾名思义,AppCache就是对app内存缓存的方案,具体表现为当请求某个文件时不是从网络获取该文件,而是从本地内存中获取. Application C ...
- hive 复杂类型
hive提供一种复合类型的数据 struct:可以使用"."来存取数据 map:可以使用键值对来存取数据 array:array中存取的数据为相同类型,其中的数据可以通过下表获取数 ...
- yum 源
epel 6源: cd /usr/local/src wget https://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noar ...
- IT 网址
蒋金楠 (Artech) WCF ,asp.net等 博客地址:http://www.cnblogs.com/artech/tag/WCF/ 伍华聪 ...
- 基于SOUI开发的应用展示
本页面列出基于SOUI开发的产品 欢迎使用SOUI的朋友提供资源:setoutsoft#qq.com #->@ 千万级平台后台在线监测客户端 1, 主页:用于显示管理服务端在线情况,左侧栏包括 ...
