Lonce Wyse
Communication & New Media
lonce.wyse@cnm.nus.sg
<path d = "M 0 0 L 100 200" />
Load it in the html head:
Use it in Javascript:
<script type="text/javascript" src="jslibs/raphael.js"></script>
var paper = new Raphael (...);
// (x, y, width, height)
var rect1 = paper.rect(100, 100, 100, 100);
rect1.attr({ fill: '#0F6' });
Attribute object very similar to CSS:
Frequently-used attributes:
// (x, y, width, height)
var rect1 = paper.rect(100, 100, 100, 100);
rect1.attr({fill: '#9cf', stroke: '#ddd', 'stroke-width': 5});
cx number the x-axis coordinate of the center of the circle, or ellipse
cy number the y-axis coordinate of the center of the circle, or ellipse
fill string colour, gradient or image
height number
opacity number
path string SVG path string format
r number radius of the circle, ellipse or rounded corner on the rect
stroke string stroke colour
width number
x number
y number
//--------------------------------------//
fill-opacity number
font string
font-family string
font-size number font size in pixels
font-weight string
Load it in the html head:
Paths are commands and coordinates
var path1 = paper.path("m 200,200 l 280,200 l 290,290 z")
M = moveto
L = lineto
H = horizontal lineto
V = vertical lineto
C = curveto
S = smooth curveto
Q = quadratic Bézier curve
T = smooth quadratic Bézier curveto
A = elliptical Arc
Z = closepath