Use Raphael to draw (quad) path (i) (JavaScript)

Source: Internet
Author: User

This chapter describes the path, I think it is more difficult and the essence of the part.

Introduce the basics first:

can refer to:

Http://www.chinasvg.com/support/svg-tutorial/svg-path-directive-guide.html

/*   command explanation: M = moveto   parameter: (x y)
L = lineto  parameter: (x y)  
H = horizontal LineTo    parameter: (x)
V = vertical LineTo   parameter: (y)  
C = Curveto   
S = Smooth Curveto   
Q = quadratic belzier curve   parameter: (x1 y1 x y)  
T = smooth quadratic belzier curveto   parameter: (x y)  
A = Elliptical ARC    parameter: (Rx ry x-axis-rotation large-arc-flag sweep-flag x y)  
Z = Closepath   parameter (none)  /  

Example:

var p1 = Paper.path (' M250 L180 L350 Z '). attr ({stroke: ' red ', ' stroke-width ': 2});         var p2 = Paper.path (' m350,100 h-100 a100,100 0 1,0 100,-100 z '). attr ({stroke: ' Blue ', ' stroke-width ': 2});         var p3 = Paper.path (' m350,300 a100,100 0 1,0 100,-100 z '). attr ({stroke: ' green ', ' stroke-width ': 2});         var p4 = Paper.path (' M150 L100 Z '). attr ({' Stroke-width ': 2}); var p5 = Paper.path (' M100 L150 Z '). attr ({' Stroke-width ': 2});

Note: example P1 defines a path that starts at position 250 150, arrives at position 150 350, then starts from there to 350 350, and finally closes the path in 250 150.

Use Raphael to draw (quad) path (i) (JavaScript)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.