ImageVerifierCode 换一换
格式:DOCX , 页数:25 ,大小:30.55KB ,
资源ID:2259172      下载积分:12 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/2259172.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(Svgjs使用手册.docx)为本站会员(b****2)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

Svgjs使用手册.docx

1、Svgjs使用手册Svg.js使用手册简介:SVG.js是一个轻量级的JavaScript库,允许你轻松操作SVG和定义动画。SVG(Scalable Vector Graphics,可缩放矢量图形)是基于XML、用于描述二维矢量图形的一种图形格式。SVG由W3C制定,是一个开放标准。SVG.js中包含了大量用于定义动画的方法,如移动、缩放、旋转、倾斜等,具体可参阅相关演示。SVG.js中的一些亮点: 易读的简洁的语法 非常轻量,gzip压缩版只有5k 针对大小、位置、颜色等的动画元素 模块化结构,轻松扩展 各种实用插件 各种形状类型间拥有统一的API. 元素可以绑定事件,包括触摸事件 完全支

2、持不透明蒙版 元素组 动态渐变 填充模式 完整的文档记录使用说明:Create a SVG documentUse theSVG()function to create a SVG document within a given html element:var draw = SVG(canvas).size(300, 300)var rect = draw.rect(100, 100).attr( fill: #f06 )The first argument can either be an id of the element or the selected element itself.

3、This will generate the following output: By default the svg canvas follows the dimensions of its parent, in this case#canvas:var draw = SVG(canvas).size(100%, 100%)Checking for SVG supportBy default this library assumes the clients browser supports SVG. You can test support as follows:if (SVG.suppor

4、ted) var draw = SVG(canvas) var rect = draw.rect(100, 100) else alert(SVG not supported)ViewBoxTheviewBoxattribute of anelement can be managed with theviewbox()method. When supplied with four arguments it will act as a setter:draw.viewbox(0, 0, 297, 210)Alternatively you can also supply an object as

5、 the first argument:draw.viewbox( x: 0, y: 0, width: 297, height: 210 )Without any arguments an instance ofSVG.ViewBoxwill be returned:var box = draw.viewbox()But the best thing about theviewbox()method is that you can get the zoom of the viewbox:var box = draw.viewbox()var zoom = box.zoomIf the siz

6、e of the viewbox equals the size of the svg canvas, the zoom value will be 1.Nested svgWith this feature you can nest svg documents within each other. Nested svg documents have exactly the same features as the main, top-level svg document:var nested = draw.nested()var rect = nested.rect(200, 200)Thi

7、s functionality requires the nested.js module which is included in the default distribution.SVG documentSvg.js also works outside of the HTML DOM, inside an SVG document for example: ElementsRectRects have two arguments, theirwidthandheight:var rect = draw.rect(100, 100)EllipseEllipses, like rects,

8、have two arguments, theirwidthandheight:var ellipse = draw.ellipse(200, 100)CircleThe only argument necessary for a circle is the diameter:var circle = draw.circle(100)Note that this generates anelement instead of a. This choice has been made to keep the size of the library down.LineThe line element

9、 always takes four arguments,x1,y1,x2andy2:var line = draw.line(0, 0, 100, 150).stroke( width: 1 )PolylineThe polyline element defines a set of connected straight line segments. Typically, polyline elements define open shapes:/ polyline(x,y x,y x,y)var polyline = draw.polyline(0,0 100,50 50,100).fil

10、l(none).stroke( width: 1 )Polyline strings consist of a list of points separated by spaces:x,y x,y x,y.As an alternative an array of points will work as well:/ polyline(x,y, x,y, x,y)var polyline = draw.polyline(0,0, 100,50, 50,100).fill(none).stroke( width: 1 )Polylines can be updated using theplot

11、()method:polyline.plot(0,0, 100,50, 50,100, 150,50, 200,50)Theplot()method can also be animated:polyline.animate(3000).plot(0,0, 100,50, 50,100, 150,50, 200,50, 250,100, 300,50, 350,50)PolygonThe polygon element, unlike the polyline element, defines a closed shape consisting of a set of connected st

12、raight line segments:/ polygon(x,y x,y x,y)var polygon = draw.polygon(0,0 100,50 50,100).fill(none).stroke( width: 1 )Polygon strings are exactly the same as polyline strings. There is no need to close the shape as the first and last point will be connected automatically.PathThe path string is simil

13、ar to the polygon string but much more complex in order to support curves:/ path(path data)var path = draw.path(M10,20L30,40)For more details on path data strings, please refer to the SVG documentation:http:/www.w3.org/TR/SVG/paths.html#PathDataNote that paths will always be positioned at x=0, y=0 on creation. This is to make the unifiedmove()api possible. Svg.js assumes you are creating a path to move it afterwards. If you need to constantl

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1