Documentation update
[raphael] / reference.html
1 <!DOCTYPE html>
2 <!-- Generated with Dr.js -->
3 <html lang="en"><head><meta charset="utf-8"><title>Raphaël Reference</title><link rel="stylesheet" href="dr.css"></head><body id="dr-js"><div id="dr"><ol class="dr-toc"><li class="dr-lvl0"><a href="#Animation" class="undefined"><span>Animation</span></a></li><li class="dr-lvl1"><a href="#Animation.delay" class="dr-method"><span>Animation.delay()</span></a></li><li class="dr-lvl1"><a href="#Animation.repeat" class="dr-method"><span>Animation.repeat()</span></a></li><li class="dr-lvl0"><a href="#Element" class="undefined"><span>Element</span></a></li><li class="dr-lvl1"><a href="#Element.animate" class="dr-method"><span>Element.animate()</span></a></li><li class="dr-lvl1"><a href="#Element.animateWith" class="dr-method"><span>Element.animateWith()</span></a></li><li class="dr-lvl1"><a href="#Element.attr" class="dr-method"><span>Element.attr()</span></a></li><li class="dr-lvl1"><a href="#Element.clone" class="dr-method"><span>Element.clone()</span></a></li><li class="dr-lvl1"><a href="#Element.drag" class="dr-method"><span>Element.drag()</span></a></li><li class="dr-lvl1"><a href="#Element.getBBox" class="dr-method"><span>Element.getBBox()</span></a></li><li class="dr-lvl1"><a href="#Element.getPointAtLength" class="dr-method"><span>Element.getPointAtLength()</span></a></li><li class="dr-lvl1"><a href="#Element.getSubpath" class="dr-method"><span>Element.getSubpath()</span></a></li><li class="dr-lvl1"><a href="#Element.getTotalLength" class="dr-method"><span>Element.getTotalLength()</span></a></li><li class="dr-lvl1"><a href="#Element.glow" class="dr-method"><span>Element.glow()</span></a></li><li class="dr-lvl1"><a href="#Element.hide" class="dr-method"><span>Element.hide()</span></a></li><li class="dr-lvl1"><a href="#Element.hover" class="dr-method"><span>Element.hover()</span></a></li><li class="dr-lvl1"><a href="#Element.id" class="dr-property"><span>Element.id</span></a></li><li class="dr-lvl1"><a href="#Element.insertAfter" class="dr-method"><span>Element.insertAfter()</span></a></li><li class="dr-lvl1"><a href="#Element.insertBefore" class="dr-method"><span>Element.insertBefore()</span></a></li><li class="dr-lvl1"><a href="#Element.next" class="dr-property"><span>Element.next</span></a></li><li class="dr-lvl1"><a href="#Element.node" class="dr-property"><span>Element.node</span></a></li><li class="dr-lvl1"><a href="#Element.onDragOver" class="dr-method"><span>Element.onDragOver()</span></a></li><li class="dr-lvl1"><a href="#Element.paper" class="dr-property"><span>Element.paper</span></a></li><li class="dr-lvl1"><a href="#Element.pause" class="dr-method"><span>Element.pause()</span></a></li><li class="dr-lvl1"><a href="#Element.prev" class="dr-property"><span>Element.prev</span></a></li><li class="dr-lvl1"><a href="#Element.raphael" class="dr-property"><span>Element.raphael</span></a></li><li class="dr-lvl1"><a href="#Element.remove" class="dr-method"><span>Element.remove()</span></a></li><li class="dr-lvl1"><a href="#Element.resume" class="dr-method"><span>Element.resume()</span></a></li><li class="dr-lvl1"><a href="#Element.rotate" class="dr-method"><span>Element.rotate()</span></a></li><li class="dr-lvl1"><a href="#Element.scale" class="dr-method"><span>Element.scale()</span></a></li><li class="dr-lvl1"><a href="#Element.setTime" class="dr-method"><span>Element.setTime()</span></a></li><li class="dr-lvl1"><a href="#Element.show" class="dr-method"><span>Element.show()</span></a></li><li class="dr-lvl1"><a href="#Element.status" class="dr-method"><span>Element.status()</span></a></li><li class="dr-lvl1"><a href="#Element.stop" class="dr-method"><span>Element.stop()</span></a></li><li class="dr-lvl1"><a href="#Element.toBack" class="dr-method"><span>Element.toBack()</span></a></li><li class="dr-lvl1"><a href="#Element.toFront" class="dr-method"><span>Element.toFront()</span></a></li><li class="dr-lvl1"><a href="#Element.transform" class="dr-method"><span>Element.transform()</span></a></li><li class="dr-lvl1"><a href="#Element.translate" class="dr-method"><span>Element.translate()</span></a></li><li class="dr-lvl1"><a href="#Element.undrag" class="dr-method"><span>Element.undrag()</span></a></li><li class="dr-lvl1"><a href="#Element.unhover" class="dr-method"><span>Element.unhover()</span></a></li><li class="dr-lvl0"><a href="#Paper" class="undefined"><span>Paper</span></a></li><li class="dr-lvl1"><a href="#Paper.bottom" class="dr-property"><span>Paper.bottom</span></a></li><li class="dr-lvl1"><a href="#Paper.circle" class="dr-method"><span>Paper.circle()</span></a></li><li class="dr-lvl1"><a href="#Paper.clear" class="dr-method"><span>Paper.clear()</span></a></li><li class="dr-lvl1"><a href="#Paper.customAttributes" class="dr-property"><span>Paper.customAttributes</span></a></li><li class="dr-lvl1"><a href="#Paper.ellipse" class="dr-method"><span>Paper.ellipse()</span></a></li><li class="dr-lvl1"><a href="#Paper.forEach" class="dr-method"><span>Paper.forEach()</span></a></li><li class="dr-lvl1"><a href="#Paper.getById" class="dr-method"><span>Paper.getById()</span></a></li><li class="dr-lvl1"><a href="#Paper.getElementByPoint" class="dr-method"><span>Paper.getElementByPoint()</span></a></li><li class="dr-lvl1"><a href="#Paper.image" class="dr-method"><span>Paper.image()</span></a></li><li class="dr-lvl1"><a href="#Paper.path" class="dr-method"><span>Paper.path()</span></a></li><li class="dr-lvl1"><a href="#Paper.raphael" class="dr-property"><span>Paper.raphael</span></a></li><li class="dr-lvl1"><a href="#Paper.rect" class="dr-method"><span>Paper.rect()</span></a></li><li class="dr-lvl1"><a href="#Paper.remove" class="dr-method"><span>Paper.remove()</span></a></li><li class="dr-lvl1"><a href="#Paper.safari" class="dr-method"><span>Paper.safari()</span></a></li><li class="dr-lvl1"><a href="#Paper.set" class="dr-method"><span>Paper.set()</span></a></li><li class="dr-lvl1"><a href="#Paper.setSize" class="dr-method"><span>Paper.setSize()</span></a></li><li class="dr-lvl1"><a href="#Paper.setViewBox" class="dr-method"><span>Paper.setViewBox()</span></a></li><li class="dr-lvl1"><a href="#Paper.text" class="dr-method"><span>Paper.text()</span></a></li><li class="dr-lvl1"><a href="#Paper.top" class="dr-property"><span>Paper.top</span></a></li><li class="dr-lvl0"><a href="#Raphael" class="dr-method"><span>Raphael()</span></a></li><li class="dr-lvl1"><a href="#Raphael.angle" class="dr-method"><span>Raphael.angle()</span></a></li><li class="dr-lvl1"><a href="#Raphael.animation" class="dr-method"><span>Raphael.animation()</span></a></li><li class="dr-lvl1"><a href="#Raphael.deg" class="dr-method"><span>Raphael.deg()</span></a></li><li class="dr-lvl1"><a href="#Raphael.easing_formulas" class="dr-property"><span>Raphael.easing_formulas</span></a></li><li class="dr-lvl1"><a href="#Raphael.el" class="dr-property"><span>Raphael.el</span></a></li><li class="dr-lvl1"><a href="#Raphael.findDotsAtSegment" class="dr-method"><span>Raphael.findDotsAtSegment()</span></a></li><li class="dr-lvl1"><a href="#Raphael.fn" class="dr-property"><span>Raphael.fn</span></a></li><li class="dr-lvl1"><a href="#Raphael.getColor" class="dr-method"><span>Raphael.getColor()</span></a></li><li class="dr-lvl2"><a href="#Raphael.getColor.reset" class="dr-method"><span>Raphael.getColor.reset()</span></a></li><li class="dr-lvl1"><a href="#Raphael.getPointAtLength" class="dr-method"><span>Raphael.getPointAtLength()</span></a></li><li class="dr-lvl1"><a href="#Raphael.getRGB" class="dr-method"><span>Raphael.getRGB()</span></a></li><li class="dr-lvl1"><a href="#Raphael.getSubpath" class="dr-method"><span>Raphael.getSubpath()</span></a></li><li class="dr-lvl1"><a href="#Raphael.getTotalLength" class="dr-method"><span>Raphael.getTotalLength()</span></a></li><li class="dr-lvl1"><a href="#Raphael.hsb" class="dr-method"><span>Raphael.hsb()</span></a></li><li class="dr-lvl1"><a href="#Raphael.hsb2rgb" class="dr-method"><span>Raphael.hsb2rgb()</span></a></li><li class="dr-lvl1"><a href="#Raphael.hsl" class="dr-method"><span>Raphael.hsl()</span></a></li><li class="dr-lvl1"><a href="#Raphael.hsl2rgb" class="dr-method"><span>Raphael.hsl2rgb()</span></a></li><li class="dr-lvl1"><a href="#Raphael.is" class="dr-method"><span>Raphael.is()</span></a></li><li class="dr-lvl1"><a href="#Raphael.parsePathString" class="dr-method"><span>Raphael.parsePathString()</span></a></li><li class="dr-lvl1"><a href="#Raphael.parseTransformString" class="dr-method"><span>Raphael.parseTransformString()</span></a></li><li class="dr-lvl1"><a href="#Raphael.path2curve" class="dr-method"><span>Raphael.path2curve()</span></a></li><li class="dr-lvl1"><a href="#Raphael.pathToRelative" class="dr-method"><span>Raphael.pathToRelative()</span></a></li><li class="dr-lvl1"><a href="#Raphael.rad" class="dr-method"><span>Raphael.rad()</span></a></li><li class="dr-lvl1"><a href="#Raphael.rgb" class="dr-method"><span>Raphael.rgb()</span></a></li><li class="dr-lvl1"><a href="#Raphael.rgb2hsb" class="dr-method"><span>Raphael.rgb2hsb()</span></a></li><li class="dr-lvl1"><a href="#Raphael.rgb2hsl" class="dr-method"><span>Raphael.rgb2hsl()</span></a></li><li class="dr-lvl1"><a href="#Raphael.setWindow" class="dr-method"><span>Raphael.setWindow()</span></a></li><li class="dr-lvl1"><a href="#Raphael.snapTo" class="dr-method"><span>Raphael.snapTo()</span></a></li><li class="dr-lvl1"><a href="#Raphael.svg" class="dr-property"><span>Raphael.svg</span></a></li><li class="dr-lvl1"><a href="#Raphael.type" class="dr-property"><span>Raphael.type</span></a></li><li class="dr-lvl1"><a href="#Raphael.vml" class="dr-property"><span>Raphael.vml</span></a></li><li class="dr-lvl0"><a href="#Set" class="undefined"><span>Set</span></a></li><li class="dr-lvl1"><a href="#Set.forEach" class="dr-method"><span>Set.forEach()</span></a></li><li class="dr-lvl1"><a href="#Set.pop" class="dr-method"><span>Set.pop()</span></a></li><li class="dr-lvl1"><a href="#Set.push" class="dr-method"><span>Set.push()</span></a></li></ol><div class="dr-doc"><h1>Raphaël Reference</h1><p class="dr-source">Check out the source: <a href="raphael-src.html">raphael.js</a></p><h2 id="Animation" class="undefined">Animation<a href="#Animation" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to source" href="raphael-src.html#Lundefined">&#x27ad;</a></h2>
4 <h3 id="Animation.delay" class="dr-method">Animation.delay(delay)<a href="#Animation.delay" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to source" href="raphael-src.html#L5092">&#x27ad;</a></h3>
5 <div class="dr-method"><p>Creates copy of existing animation object with given delay.
6 </p>
7 <p class="header">Parameters
8 </p>
9 <dl class="dr-parameters"><dt class="dr-param">delay</dt>
10 <dd class="dr-type"><em class="dr-type-number">number</em></dd>
11 <dd class="dr-description">number of ms to pass between animation start and actual animation</dd>
12 </dl>
13 <p class="dr-returns"><strong class="dr-title">Returns:</strong> <em class="dr-type-object">object</em> <span class="dr-description">new altered Animation object</span></p>
14 </div><h3 id="Animation.repeat" class="dr-method">Animation.repeat(repeat)<a href="#Animation.repeat" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to source" href="raphael-src.html#L5110">&#x27ad;</a></h3>
15 <div class="dr-method"><p>Creates copy of existing animation object with given repetition.
16 </p>
17 <p class="header">Parameters
18 </p>
19 <dl class="dr-parameters"><dt class="dr-param">repeat</dt>
20 <dd class="dr-type"><em class="dr-type-number">number</em></dd>
21 <dd class="dr-description">number iterations of animation. For infinite animation pass <code>Infinity</code></dd>
22 </dl>
23 <p class="dr-returns"><strong class="dr-title">Returns:</strong> <em class="dr-type-object">object</em> <span class="dr-description">new altered Animation object</span></p>
24 </div><h2 id="Element" class="undefined">Element<a href="#Element" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to source" href="raphael-src.html#Lundefined">&#x27ad;</a></h2>
25 <h3 id="Element.animate" class="dr-method">Element.animate(…)<a href="#Element.animate" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to source" href="raphael-src.html#L5369">&#x27ad;</a></h3>
26 <div class="dr-method"><p>Creates and starts animation for given element.
27 </p>
28 <p class="header">Parameters
29 </p>
30 <dl class="dr-parameters"><dt class="dr-param">params</dt>
31 <dd class="dr-type"><em class="dr-type-object">object</em></dd>
32 <dd class="dr-description">final attributes for the element, see also <a href="#Element.attr" class="dr-link">Element.attr</a></dd>
33 <dt class="dr-param">ms</dt>
34 <dd class="dr-type"><em class="dr-type-number">number</em></dd>
35 <dd class="dr-description">number of milliseconds for animation to run</dd>
36 <dt class="dr-param optional">easing</dt>
37 <dd class="dr-optional">optional</dd>
38 <dd class="dr-type"><em class="dr-type-string">string</em></dd>
39 <dd class="dr-description">easing type. Accept on of <a href="#Raphael.easing_formulas" class="dr-link">Raphael.easing_formulas</a> or CSS format: <code>cubic&#x2010;bezier(XX,&#160;XX,&#160;XX,&#160;XX)</code></dd>
40 <dt class="dr-param optional">callback</dt>
41 <dd class="dr-optional">optional</dd>
42 <dd class="dr-type"><em class="dr-type-function">function</em></dd>
43 <dd class="dr-description">callback function. Will be called at the end of animation.</dd>
44 </dl>
45 <p>or
46 </p>
47 <dl class="dr-parameters"><dt class="dr-param">animation</dt>
48 <dd class="dr-type"><em class="dr-type-object">object</em></dd>
49 <dd class="dr-description">animation object, see <a href="#Raphael.animation" class="dr-link">Raphael.animation</a></dd>
50 </dl>
51 <p class="dr-returns"><strong class="dr-title">Returns:</strong> <em class="dr-type-object">object</em> <span class="dr-description">original element</span></p>
52 </div><h3 id="Element.animateWith" class="dr-method">Element.animateWith(…)<a href="#Element.animateWith" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to source" href="raphael-src.html#L5001">&#x27ad;</a></h3>
53 <div class="dr-method"><p>Acts similar to <a href="#Element.animate" class="dr-link">Element.animate</a>, but ensure that given animation runs in sync with another given element.
54 </p>
55 <p class="header">Parameters
56 </p>
57 <dl class="dr-parameters"><dt class="dr-param">params</dt>
58 <dd class="dr-type"><em class="dr-type-object">object</em></dd>
59 <dd class="dr-description">final attributes for the element, see also <a href="#Element.attr" class="dr-link">Element.attr</a></dd>
60 <dt class="dr-param">ms</dt>
61 <dd class="dr-type"><em class="dr-type-number">number</em></dd>
62 <dd class="dr-description">number of milliseconds for animation to run</dd>
63 <dt class="dr-param optional">easing</dt>
64 <dd class="dr-optional">optional</dd>
65 <dd class="dr-type"><em class="dr-type-string">string</em></dd>
66 <dd class="dr-description">easing type. Accept on of <a href="#Raphael.easing_formulas" class="dr-link">Raphael.easing_formulas</a> or CSS format: <code>cubic&#x2010;bezier(XX,&#160;XX,&#160;XX,&#160;XX)</code></dd>
67 <dt class="dr-param optional">callback</dt>
68 <dd class="dr-optional">optional</dd>
69 <dd class="dr-type"><em class="dr-type-function">function</em></dd>
70 <dd class="dr-description">callback function. Will be called at the end of animation.</dd>
71 </dl>
72 <p>or
73 </p>
74 <dl class="dr-parameters"><dt class="dr-param">animation</dt>
75 <dd class="dr-type"><em class="dr-type-object">object</em></dd>
76 <dd class="dr-description">animation object, see <a href="#Raphael.animation" class="dr-link">Raphael.animation</a></dd>
77 </dl>
78 <p class="dr-returns"><strong class="dr-title">Returns:</strong> <em class="dr-type-object">object</em> <span class="dr-description">original element</span></p>
79 </div><h3 id="Element.attr" class="dr-method">Element.attr(…)<a href="#Element.attr" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to source" href="raphael-src.html#L2713">&#x27ad;</a></h3>
80 <div class="dr-method"><p>Sets the attributes of the element.
81 </p>
82 <p class="header">Parameters
83 </p>
84 <dl class="dr-parameters"><dt class="dr-param">attrName</dt>
85 <dd class="dr-type"><em class="dr-type-string">string</em></dd>
86 <dd class="dr-description">attribute’s name</dd>
87 <dt class="dr-param">value</dt>
88 <dd class="dr-type"><em class="dr-type-string">string</em></dd>
89 <dd class="dr-description">value</dd>
90 </dl>
91 <p>or
92 </p>
93 <dl class="dr-parameters"><dt class="dr-param">params</dt>
94 <dd class="dr-type"><em class="dr-type-object">object</em></dd>
95 <dd class="dr-description">object of name/value pairs</dd>
96 </dl>
97 <p>or
98 </p>
99 <dl class="dr-parameters"><dt class="dr-param">attrName</dt>
100 <dd class="dr-type"><em class="dr-type-string">string</em></dd>
101 <dd class="dr-description">attribute’s name</dd>
102 </dl>
103 <p>or
104 </p>
105 <dl class="dr-parameters"><dt class="dr-param">attrNames</dt>
106 <dd class="dr-type"><em class="dr-type-array">array</em></dd>
107 <dd class="dr-description">in this case method returns array of current values for given attribute names</dd>
108 </dl>
109 <p class="dr-returns"><strong class="dr-title">Returns:</strong> <em class="dr-type-object">object</em> <span class="dr-description"><a href="#Element" class="dr-link">Element</a> if attrsName <em class="amp">&amp;</em> value or params are passed in.</span></p>
110 <p class="dr-returns"><strong class="dr-title">Returns:</strong> <em class="dr-type-...">...</em> <span class="dr-description">value of the attribute if only attrsName is passed in.</span></p>
111 <p class="dr-returns"><strong class="dr-title">Returns:</strong> <em class="dr-type-array">array</em> <span class="dr-description">array of values of the attribute if attrsNames is passed in.</span></p>
112 <p class="dr-returns"><strong class="dr-title">Returns:</strong> <em class="dr-type-object">object</em> <span class="dr-description">object of attributes if nothing is passed in.</span></p>
113 <p class="header">Possible parameters
114 </p>
115 <p>Please refer to the <a href="http://www.w3.org/TR/SVG/" title="The W3C Recommendation for the SVG language describes these properties in detail.">SVG specification</a> for an explanation of these parameters.</p>
116 <ol class="dr-json"><li><span class="dr-json-key">arrow-end</span><span class="dr-type"><em class="dr-type-string">string</em></span><span class="dr-json-description">arrowhead on the end of the path. The format for string is <code>&lt;type>[-&lt;width>[-&lt;length>]]</code>. Possible types: <code>classic</code>, <code>block</code>, <code>open</code>, <code>oval</code>, <code>diamond</code>, <code>none</code>, width: <code>wide</code>, <code>narrow</code>, <code>midium</code>, length: <code>long</code>, <code>short</code>, <code>midium</code>.</span>
117 <li><span class="dr-json-key">clip-rect</span><span class="dr-type"><em class="dr-type-string">string</em></span><span class="dr-json-description">comma or space separated values: x, y, width and height</span>
118 <li><span class="dr-json-key">cursor</span><span class="dr-type"><em class="dr-type-string">string</em></span><span class="dr-json-description">CSS type of the cursor</span>
119 <li><span class="dr-json-key">cx</span><span class="dr-type"><em class="dr-type-number">number</em></span><span class="dr-json-description">&#160;</span>
120 <li><span class="dr-json-key">cy</span><span class="dr-type"><em class="dr-type-number">number</em></span><span class="dr-json-description">&#160;</span>
121 <li><span class="dr-json-key">fill</span><span class="dr-type"><em class="dr-type-string">string</em></span><span class="dr-json-description">colour, gradient or image</span>
122 <li><span class="dr-json-key">fill-opacity</span><span class="dr-type"><em class="dr-type-number">number</em></span><span class="dr-json-description">&#160;</span>
123 <li><span class="dr-json-key">font</span><span class="dr-type"><em class="dr-type-string">string</em></span><span class="dr-json-description">&#160;</span>
124 <li><span class="dr-json-key">font-family</span><span class="dr-type"><em class="dr-type-string">string</em></span><span class="dr-json-description">&#160;</span>
125 <li><span class="dr-json-key">font-size</span><span class="dr-type"><em class="dr-type-number">number</em></span><span class="dr-json-description">font size in pixels</span>
126 <li><span class="dr-json-key">font-weight</span><span class="dr-type"><em class="dr-type-string">string</em></span><span class="dr-json-description">&#160;</span>
127 <li><span class="dr-json-key">height</span><span class="dr-type"><em class="dr-type-number">number</em></span><span class="dr-json-description">&#160;</span>
128 <li><span class="dr-json-key">href</span><span class="dr-type"><em class="dr-type-string">string</em></span><span class="dr-json-description">URL, if specified element behaves as hyperlink</span>
129 <li><span class="dr-json-key">opacity</span><span class="dr-type"><em class="dr-type-number">number</em></span><span class="dr-json-description">&#160;</span>
130 <li><span class="dr-json-key">path</span><span class="dr-type"><em class="dr-type-string">string</em></span><span class="dr-json-description">SVG path string format</span>
131 <li><span class="dr-json-key">r</span><span class="dr-type"><em class="dr-type-number">number</em></span><span class="dr-json-description">&#160;</span>
132 <li><span class="dr-json-key">rx</span><span class="dr-type"><em class="dr-type-number">number</em></span><span class="dr-json-description">&#160;</span>
133 <li><span class="dr-json-key">ry</span><span class="dr-type"><em class="dr-type-number">number</em></span><span class="dr-json-description">&#160;</span>
134 <li><span class="dr-json-key">src</span><span class="dr-type"><em class="dr-type-string">string</em></span><span class="dr-json-description">image URL, only works for <a href="#Element.image" class="dr-link">Element.image</a> element</span>
135 <li><span class="dr-json-key">stroke</span><span class="dr-type"><em class="dr-type-string">string</em></span><span class="dr-json-description">stroke colour</span>
136 <li><span class="dr-json-key">stroke-dasharray</span><span class="dr-type"><em class="dr-type-string">string</em></span><span class="dr-json-description">[“”, “<code>-</code>”, “<code>.</code>”, “<code>-.</code>”, “<code>-..</code>”, “<code>. </code>”, “<code>- </code>”, “<code>--</code>”, “<code>- .</code>”, “<code>--.</code>”, “<code>--..</code>”]</span>
137 <li><span class="dr-json-key">stroke-linecap</span><span class="dr-type"><em class="dr-type-string">string</em></span><span class="dr-json-description">[“<code>butt</code>”, “<code>square</code>”, “<code>round</code>”]</span>
138 <li><span class="dr-json-key">stroke-linejoin</span><span class="dr-type"><em class="dr-type-string">string</em></span><span class="dr-json-description">[“<code>bevel</code>”, “<code>round</code>”, “<code>miter</code>”]</span>
139 <li><span class="dr-json-key">stroke-miterlimit</span><span class="dr-type"><em class="dr-type-number">number</em></span><span class="dr-json-description">&#160;</span>
140 <li><span class="dr-json-key">stroke-opacity</span><span class="dr-type"><em class="dr-type-number">number</em></span><span class="dr-json-description">&#160;</span>
141 <li><span class="dr-json-key">stroke-width</span><span class="dr-type"><em class="dr-type-number">number</em></span><span class="dr-json-description">stroke width in pixels, default is '1'</span>
142 <li><span class="dr-json-key">target</span><span class="dr-type"><em class="dr-type-string">string</em></span><span class="dr-json-description">used with href</span>
143 <li><span class="dr-json-key">text</span><span class="dr-type"><em class="dr-type-string">string</em></span><span class="dr-json-description">contents of the text element. Use <code>\n</code> for multiline text</span>
144 <li><span class="dr-json-key">text-anchor</span><span class="dr-type"><em class="dr-type-string">string</em></span><span class="dr-json-description">[“<code>start</code>”, “<code>middle</code>”, “<code>end</code>”], default is “<code>middle</code>”</span>
145 <li><span class="dr-json-key">title</span><span class="dr-type"><em class="dr-type-string">string</em></span><span class="dr-json-description">will create tooltip with a given text</span>
146 <li><span class="dr-json-key">transform</span><span class="dr-type"><em class="dr-type-string">string</em></span><span class="dr-json-description">see <a href="#Element.transform" class="dr-link">Element.transform</a></span>
147 <li><span class="dr-json-key">width</span><span class="dr-type"><em class="dr-type-number">number</em></span><span class="dr-json-description">&#160;</span>
148 <li><span class="dr-json-key">x</span><span class="dr-type"><em class="dr-type-number">number</em></span><span class="dr-json-description">&#160;</span>
149 <li><span class="dr-json-key">y</span><span class="dr-type"><em class="dr-type-number">number</em></span><span class="dr-json-description">&#160;</span>
150 </ol>
151 <p class="header">Gradients
152 <p>Linear gradient format: “<code>‹angle›-‹colour›[-‹colour›[:‹offset›]]*-‹colour›</code>”, example: “<code>90-#fff-#000</code>” – 90°
153 gradient from white to black or “<code>0-#fff-#f00:20-#000</code>” – 0° gradient from white via red (at 20%) to black.
154 </p>
155 <p>radial gradient: “<code>r[(‹fx›, ‹fy›)]‹colour›[-‹colour›[:‹offset›]]*-‹colour›</code>”, example: “<code>r#fff-#000</code>” –
156 gradient from white to black or “<code>r(0.25, 0.75)#fff-#000</code>” – gradient from white to black with focus point
157 at 0.25, 0.75. Focus point coordinates are in 0..1 range. Radial gradients can only be applied to circles and ellipses.
158 </p>
159 <p class="header">Path String
160 </p>
161 <p>Please refer to <a href="http://www.w3.org/TR/SVG/paths.html#PathData" title="Details of a path’s data attribute’s format are described in the SVG specification.">SVG documentation regarding path string</a>. Raphaël fully supports it.</p>
162 <p class="header">Colour Parsing
163 </p>
164 <ul>
165     <li>Colour name (“<code>red</code>”, “<code>green</code>”, “<code>cornflowerblue</code>”, etc)</li>
166     <li>#••• — shortened HTML colour: (“<code>#000</code>”, “<code>#fc0</code>”, etc)</li>
167     <li>#•••••• — full length HTML colour: (“<code>#000000</code>”, “<code>#bd2300</code>”)</li>
168     <li>rgb(•••, •••, •••) — red, green and blue channels’ values: (“<code>rgb(200,&nbsp;100,&nbsp;0)</code>”)</li>
169     <li>rgb(•••%, •••%, •••%) — same as above, but in %: (“<code>rgb(100%,&nbsp;175%,&nbsp;0%)</code>”)</li>
170     <li>rgba(•••, •••, •••, •••) — red, green and blue channels’ values: (“<code>rgba(200,&nbsp;100,&nbsp;0, .5)</code>”)</li>
171     <li>rgba(•••%, •••%, •••%, •••%) — same as above, but in %: (“<code>rgba(100%,&nbsp;175%,&nbsp;0%, 50%)</code>”)</li>
172     <li>hsb(•••, •••, •••) — hue, saturation and brightness values: (“<code>hsb(0.5,&nbsp;0.25,&nbsp;1)</code>”)</li>
173     <li>hsb(•••%, •••%, •••%) — same as above, but in %</li>
174     <li>hsba(•••, •••, •••, •••) — same as above, but with opacity</li>
175     <li>hsl(•••, •••, •••) — almost the same as hsb, see <a href="http://en.wikipedia.org/wiki/HSL_and_HSV" title="HSL and HSV - Wikipedia, the free encyclopedia">Wikipedia page</a></li>
176     <li>hsl(•••%, •••%, •••%) — same as above, but in %</li>
177     <li>hsla(•••, •••, •••) — same as above, but with opacity</li>
178     <li>Optionally for hsb and hsl you could specify hue as a degree: “<code>hsl(240deg,&nbsp;1,&nbsp;.5)</code>” or, if you want to go fancy, “<code>hsl(240°,&nbsp;1,&nbsp;.5)</code>”</li>
179 </ul>
180 </div><h3 id="Element.clone" class="dr-method">Element.clone()<a href="#Element.clone" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to source" href="raphael-src.html#L4548">&#x27ad;</a></h3>
181 <div class="dr-method"><p class="dr-returns"><strong class="dr-title">Returns:</strong> <em class="dr-type-object">object</em> <span class="dr-description">clone of a given element</span></p>
182 </div><h3 id="Element.drag" class="dr-method">Element.drag(onmove, onstart, onend, [mcontext], [scontext], [econtext])<a href="#Element.drag" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to source" href="raphael-src.html#L4151">&#x27ad;</a></h3>
183 <div class="dr-method"><p>Adds event handlers for drag of the element.
184 </p>
185 <p class="header">Parameters
186 </p>
187 <dl class="dr-parameters"><dt class="dr-param">onmove</dt>
188 <dd class="dr-type"><em class="dr-type-function">function</em></dd>
189 <dd class="dr-description">handler for moving</dd>
190 <dt class="dr-param">onstart</dt>
191 <dd class="dr-type"><em class="dr-type-function">function</em></dd>
192 <dd class="dr-description">handler for drag start</dd>
193 <dt class="dr-param">onend</dt>
194 <dd class="dr-type"><em class="dr-type-function">function</em></dd>
195 <dd class="dr-description">handler for drag end</dd>
196 <dt class="dr-param optional">mcontext</dt>
197 <dd class="dr-optional">optional</dd>
198 <dd class="dr-type"><em class="dr-type-object">object</em></dd>
199 <dd class="dr-description">context for moving handler</dd>
200 <dt class="dr-param optional">scontext</dt>
201 <dd class="dr-optional">optional</dd>
202 <dd class="dr-type"><em class="dr-type-object">object</em></dd>
203 <dd class="dr-description">context for drag start handler</dd>
204 <dt class="dr-param optional">econtext</dt>
205 <dd class="dr-optional">optional</dd>
206 <dd class="dr-type"><em class="dr-type-object">object</em></dd>
207 <dd class="dr-description">context for drag end handler</dd>
208 </dl>
209 <p>Additionaly following <code>drag</code> events will be triggered: <code>drag.start.&lt;id></code> on start, 
210 <code>drag.end.&lt;id></code> on end and <code>drag.move.&lt;id></code> on every move. When element will be dragged over another element 
211 <code>drag.over.&lt;id></code> will be fired as well.
212 </p>
213 <p>Start event and start handler will be called in specified context or in context of the element with following parameters:
214 </p>
215 <ol class="dr-json"><li><span class="dr-json-key">x</span><span class="dr-type"><em class="dr-type-number">number</em></span><span class="dr-json-description">x position of the mouse</span>
216 <li><span class="dr-json-key">y</span><span class="dr-type"><em class="dr-type-number">number</em></span><span class="dr-json-description">y position of the mouse</span>
217 <li><span class="dr-json-key">event</span><span class="dr-type"><em class="dr-type-object">object</em></span><span class="dr-json-description">DOM event object</span>
218 </ol>
219 <p>Move event and move handler will be called in specified context or in context of the element with following parameters:
220 </p>
221 <ol class="dr-json"><li><span class="dr-json-key">dx</span><span class="dr-type"><em class="dr-type-number">number</em></span><span class="dr-json-description">shift by x from the start point</span>
222 <li><span class="dr-json-key">dy</span><span class="dr-type"><em class="dr-type-number">number</em></span><span class="dr-json-description">shift by y from the start point</span>
223 <li><span class="dr-json-key">x</span><span class="dr-type"><em class="dr-type-number">number</em></span><span class="dr-json-description">x position of the mouse</span>
224 <li><span class="dr-json-key">y</span><span class="dr-type"><em class="dr-type-number">number</em></span><span class="dr-json-description">y position of the mouse</span>
225 <li><span class="dr-json-key">event</span><span class="dr-type"><em class="dr-type-object">object</em></span><span class="dr-json-description">DOM event object</span>
226 </ol>
227 <p>End event and end handler will be called in specified context or in context of the element with following parameters:
228 </p>
229 <ol class="dr-json"><li><span class="dr-json-key">event</span><span class="dr-type"><em class="dr-type-object">object</em></span><span class="dr-json-description">DOM event object</span>
230 </ol>
231 <p class="dr-returns"><strong class="dr-title">Returns:</strong> <em class="dr-type-object">object</em> <span class="dr-description"><a href="#Element" class="dr-link">Element</a></span></p>
232 </div><h3 id="Element.getBBox" class="dr-method">Element.getBBox(isWithoutTransform)<a href="#Element.getBBox" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to source" href="raphael-src.html#L4516">&#x27ad;</a></h3>
233 <div class="dr-method"><p>Return bounding box for a given element
234 </p>
235 <p class="header">Parameters
236 </p>
237 <dl class="dr-parameters"><dt class="dr-param">isWithoutTransform</dt>
238 <dd class="dr-type"><em class="dr-type-boolean">boolean</em></dd>
239 <dd class="dr-description">flag, <code>true</code> if you want to have bounding box before transformations. Default is <code>false</code>.</dd>
240 </dl>
241 <p class="dr-returns"><strong class="dr-title">Returns:</strong> <em class="dr-type-object">object</em> <span class="dr-description">Bounding box object:</span></p>
242 <ol class="dr-json"><li>{<ol class="dr-json"><li><span class="dr-json-key">x:</span><span class="dr-type"><em class="dr-type-number">number</em></span><span class="dr-json-description">top left corner x</span>
243 <li><span class="dr-json-key">y:</span><span class="dr-type"><em class="dr-type-number">number</em></span><span class="dr-json-description">top left corner y</span>
244 <li><span class="dr-json-key">width:</span><span class="dr-type"><em class="dr-type-number">number</em></span><span class="dr-json-description">width</span>
245 <li><span class="dr-json-key">height:</span><span class="dr-type"><em class="dr-type-number">number</em></span><span class="dr-json-description">height</span>
246 </ol></li><li>}</li></ol>
247 </div><h3 id="Element.getPointAtLength" class="dr-method">Element.getPointAtLength(length)<a href="#Element.getPointAtLength" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to source" href="raphael-src.html#L4751">&#x27ad;</a></h3>
248 <div class="dr-method"><p>Return coordinates of the point located at the given length on the given path. Only works for element of “path” type.
249 </p>
250 <p class="header">Parameters
251 </p>
252 <dl class="dr-parameters"><dt class="dr-param">length</dt>
253 <dd class="dr-type"><em class="dr-type-number">number</em></dd>
254 <dd class="dr-description">&#160;</dd>
255 </dl>
256 <p class="dr-returns"><strong class="dr-title">Returns:</strong> <em class="dr-type-object">object</em> <span class="dr-description">representation of the point:</span></p>
257 <ol class="dr-json"><li>{<ol class="dr-json"><li><span class="dr-json-key">x:</span><span class="dr-type"><em class="dr-type-number">number</em></span><span class="dr-json-description">x coordinate</span>
258 <li><span class="dr-json-key">y:</span><span class="dr-type"><em class="dr-type-number">number</em></span><span class="dr-json-description">y coordinate</span>
259 <li><span class="dr-json-key">alpha:</span><span class="dr-type"><em class="dr-type-number">number</em></span><span class="dr-json-description">angle of derivative</span>
260 </ol></li><li>}</li></ol>
261 </div><h3 id="Element.getSubpath" class="dr-method">Element.getSubpath(from, to)<a href="#Element.getSubpath" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to source" href="raphael-src.html#L4768">&#x27ad;</a></h3>
262 <div class="dr-method"><p>Return subpath of a given element from given length to given length. Only works for element of “path” type.
263 </p>
264 <p class="header">Parameters
265 </p>
266 <dl class="dr-parameters"><dt class="dr-param">from</dt>
267 <dd class="dr-type"><em class="dr-type-number">number</em></dd>
268 <dd class="dr-description">position of the start of the segment</dd>
269 <dt class="dr-param">to</dt>
270 <dd class="dr-type"><em class="dr-type-number">number</em></dd>
271 <dd class="dr-description">position of the end of the segment</dd>
272 </dl>
273 <p class="dr-returns"><strong class="dr-title">Returns:</strong> <em class="dr-type-string">string</em> <span class="dr-description">pathstring for the segment</span></p>
274 </div><h3 id="Element.getTotalLength" class="dr-method">Element.getTotalLength()<a href="#Element.getTotalLength" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to source" href="raphael-src.html#L4727">&#x27ad;</a></h3>
275 <div class="dr-method"><p>Returns length of the path in pixels. Only works for element of “path” type.
276 </p>
277 <p class="dr-returns"><strong class="dr-title">Returns:</strong> <em class="dr-type-number">number</em> <span class="dr-description">length.</span></p>
278 </div><h3 id="Element.glow" class="dr-method">Element.glow()<a href="#Element.glow" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to source" href="raphael-src.html#L4567">&#x27ad;</a></h3>
279 <div class="dr-method"><p>Return set of elements that create glow-like effect around given element. See <a href="#Paper.set" class="dr-link">Paper.set</a>.
280 </p>
281 <p>Note: Glow is not connected to the elment. If you change element attributes it won’t adjust itself.
282 </p>
283 <p class="dr-returns"><strong class="dr-title">Returns:</strong> <em class="dr-type-object">object</em> <span class="dr-description"><a href="#Paper.set" class="dr-link">Paper.set</a> of elements that represents glow</span></p>
284 </div><h3 id="Element.hide" class="dr-method">Element.hide()<a href="#Element.hide" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to source" href="raphael-src.html#L2583">&#x27ad;</a></h3>
285 <div class="dr-method"><p>Makes element invisible. See <a href="#Element.show" class="dr-link">Element.show</a>.
286 </p>
287 <p class="dr-returns"><strong class="dr-title">Returns:</strong> <em class="dr-type-object">object</em> <span class="dr-description"><a href="#Element" class="dr-link">Element</a></span></p>
288 </div><h3 id="Element.hover" class="dr-method">Element.hover(f_in, f_out, [icontext], [ocontext])<a href="#Element.hover" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to source" href="raphael-src.html#L4105">&#x27ad;</a></h3>
289 <div class="dr-method"><p>Adds event handlers for hover for the element.
290 </p>
291 <p class="header">Parameters
292 </p>
293 <dl class="dr-parameters"><dt class="dr-param">f_in</dt>
294 <dd class="dr-type"><em class="dr-type-function">function</em></dd>
295 <dd class="dr-description">handler for hover in</dd>
296 <dt class="dr-param">f_out</dt>
297 <dd class="dr-type"><em class="dr-type-function">function</em></dd>
298 <dd class="dr-description">handler for hover out</dd>
299 <dt class="dr-param optional">icontext</dt>
300 <dd class="dr-optional">optional</dd>
301 <dd class="dr-type"><em class="dr-type-object">object</em></dd>
302 <dd class="dr-description">context for hover in handler</dd>
303 <dt class="dr-param optional">ocontext</dt>
304 <dd class="dr-optional">optional</dd>
305 <dd class="dr-type"><em class="dr-type-object">object</em></dd>
306 <dd class="dr-description">context for hover out handler</dd>
307 </dl>
308 <p class="dr-returns"><strong class="dr-title">Returns:</strong> <em class="dr-type-object">object</em> <span class="dr-description"><a href="#Element" class="dr-link">Element</a></span></p>
309 </div><h3 id="Element.id" class="dr-property">Element.id<a href="#Element.id" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to source" href="raphael-src.html#L2386">&#x27ad;</a></h3>
310 <div class="dr-property"><em class="dr-type dr-type-number">number</em><p>Unique id of the element. Especially usesful when you want to listen to events of the element, 
311 because all events are fired in format <code>&lt;module>.&lt;action>.&lt;id></code>. Also useful for <a href="#Paper.getById" class="dr-link">Paper.getById</a> method.
312 </p>
313 </div><h3 id="Element.insertAfter" class="dr-method">Element.insertAfter()<a href="#Element.insertAfter" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to source" href="raphael-src.html#L2805">&#x27ad;</a></h3>
314 <div class="dr-method"><p>Inserts current object after the given one.
315 </p>
316 <p class="dr-returns"><strong class="dr-title">Returns:</strong> <em class="dr-type-object">object</em> <span class="dr-description"><a href="#Element" class="dr-link">Element</a></span></p>
317 </div><h3 id="Element.insertBefore" class="dr-method">Element.insertBefore()<a href="#Element.insertBefore" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to source" href="raphael-src.html#L2825">&#x27ad;</a></h3>
318 <div class="dr-method"><p>Inserts current object before the given one.
319 </p>
320 <p class="dr-returns"><strong class="dr-title">Returns:</strong> <em class="dr-type-object">object</em> <span class="dr-description"><a href="#Element" class="dr-link">Element</a></span></p>
321 </div><h3 id="Element.next" class="dr-property">Element.next<a href="#Element.next" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to source" href="raphael-src.html#L2429">&#x27ad;</a></h3>
322 <div class="dr-property"><em class="dr-type dr-type-object">object</em><p>Reference to the next element in the hierarchy.
323 </p>
324 </div><h3 id="Element.node" class="dr-property">Element.node<a href="#Element.node" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to source" href="raphael-src.html#L2365">&#x27ad;</a></h3>
325 <div class="dr-property"><em class="dr-type dr-type-object">object</em><p>Gives you a reference to the DOM object, so you can assign event handlers or just mess around.
326 </p>
327 <p class="header">Usage
328 </p>
329 <pre class="javascript code"><code><span class="c">// draw a circle at coordinate <span class="d">10</span>,<span class="d">10</span> <b>with</b> radius of <span class="d">10</span></span>
330 <b>var</b> c<span class="s"> = </span>paper.circle(<span class="d">10</span>, <span class="d">10</span>, <span class="d">10</span>);
331 c.node.onclick<span class="s"> = </span><b>function</b> () {
332     c.attr(<i>"fill"</i>, <i>"red"</i>);
333 };
334 </code></pre>
335 </div><h3 id="Element.onDragOver" class="dr-method">Element.onDragOver(f)<a href="#Element.onDragOver" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to source" href="raphael-src.html#L4178">&#x27ad;</a></h3>
336 <div class="dr-method"><p>Shortcut for assigning event handler for <code>drag.over.&lt;id></code> event, where id is id of the element (see <a href="#Element.id" class="dr-link">Element.id</a>).
337 </p>
338 <p class="header">Parameters
339 </p>
340 <dl class="dr-parameters"><dt class="dr-param">f</dt>
341 <dd class="dr-type"><em class="dr-type-function">function</em></dd>
342 <dd class="dr-description">handler for event</dd>
343 </dl>
344 </div><h3 id="Element.paper" class="dr-property">Element.paper<a href="#Element.paper" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to source" href="raphael-src.html#L2402">&#x27ad;</a></h3>
345 <div class="dr-property"><em class="dr-type dr-type-object">object</em><p>Internal reference to “paper” where object drawn. Mainly for use in plugins and element extensions.
346 </p>
347 <p class="header">Usage
348 </p>
349 <pre class="javascript code"><code>Raphael.el.cross<span class="s"> = </span><b>function</b> () {
350     <b>this</b>.attr({fill: <i>"red"</i>});
351     <b>this</b>.paper.path(<i>"M10,10L50,50M50,10L10,<span class="d">50</span>"</i>)
352         .attr({stroke: <i>"red"</i>});
353 }
354 </code></pre>
355 </div><h3 id="Element.pause" class="dr-method">Element.pause([anim])<a href="#Element.pause" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to source" href="raphael-src.html#L5459">&#x27ad;</a></h3>
356 <div class="dr-method"><p>Stops animation of the element with ability to resume it later on.
357 </p>
358 <p class="header">Parameters
359 </p>
360 <dl class="dr-parameters"><dt class="dr-param optional">anim</dt>
361 <dd class="dr-optional">optional</dd>
362 <dd class="dr-type"><em class="dr-type-object">object</em></dd>
363 <dd class="dr-description">animation object</dd>
364 </dl>
365 <p class="dr-returns"><strong class="dr-title">Returns:</strong> <em class="dr-type-object">object</em> <span class="dr-description">original element</span></p>
366 </div><h3 id="Element.prev" class="dr-property">Element.prev<a href="#Element.prev" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to source" href="raphael-src.html#L2420">&#x27ad;</a></h3>
367 <div class="dr-property"><em class="dr-type dr-type-object">object</em><p>Reference to the previous element in the hierarchy.
368 </p>
369 </div><h3 id="Element.raphael" class="dr-property">Element.raphael<a href="#Element.raphael" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to source" href="raphael-src.html#L2378">&#x27ad;</a></h3>
370 <div class="dr-property"><em class="dr-type dr-type-object">object</em><p>Internal reference to <a href="#Raphael" class="dr-link">Raphael</a> object. In case it is not available.
371 </p>
372 <p class="header">Usage
373 </p>
374 <pre class="javascript code"><code>Raphael.el.red<span class="s"> = </span><b>function</b> () {
375     <b>var</b> hsb<span class="s"> = </span><b>this</b>.paper.raphael.rgb2hsb(<b>this</b>.attr(<i>"fill"</i>));
376     hsb.h<span class="s"> = </span><span class="d">1</span>;
377     <b>this</b>.attr({fill: <b>this</b>.paper.raphael.hsb2rgb(hsb).hex});
378 }
379 </code></pre>
380 </div><h3 id="Element.remove" class="dr-method">Element.remove()<a href="#Element.remove" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to source" href="raphael-src.html#L2604">&#x27ad;</a></h3>
381 <div class="dr-method"><p>Removes element form the paper.
382 </p>
383 </div><h3 id="Element.resume" class="dr-method">Element.resume([anim])<a href="#Element.resume" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to source" href="raphael-src.html#L5479">&#x27ad;</a></h3>
384 <div class="dr-method"><p>Resumes animation if it was paused with <a href="#Element.pause" class="dr-link">Element.pause</a> method.
385 </p>
386 <p class="header">Parameters
387 </p>
388 <dl class="dr-parameters"><dt class="dr-param optional">anim</dt>
389 <dd class="dr-optional">optional</dd>
390 <dd class="dr-type"><em class="dr-type-object">object</em></dd>
391 <dd class="dr-description">animation object</dd>
392 </dl>
393 <p class="dr-returns"><strong class="dr-title">Returns:</strong> <em class="dr-type-object">object</em> <span class="dr-description">original element</span></p>
394 </div><h3 id="Element.rotate" class="dr-method">Element.rotate(deg, [cx], [cy])<a href="#Element.rotate" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to source" href="raphael-src.html#L2445">&#x27ad;</a></h3>
395 <div class="dr-method"><p>Adds rotation by given angle around given point to the list of
396 transformations of the element.
397 </p>
398 <p class="header">Parameters
399 </p>
400 <dl class="dr-parameters"><dt class="dr-param">deg</dt>
401 <dd class="dr-type"><em class="dr-type-number">number</em></dd>
402 <dd class="dr-description">angle in degrees</dd>
403 <dt class="dr-param optional">cx</dt>
404 <dd class="dr-optional">optional</dd>
405 <dd class="dr-type"><em class="dr-type-number">number</em></dd>
406 <dd class="dr-description">x coordinate of the centre of rotation</dd>
407 <dt class="dr-param optional">cy</dt>
408 <dd class="dr-optional">optional</dd>
409 <dd class="dr-type"><em class="dr-type-number">number</em></dd>
410 <dd class="dr-description">y coordinate of the centre of rotation</dd>
411 </dl>
412 <p>If cx <em class="amp">&amp;</em> cy aren’t specified centre of the shape is used as a point of rotation.
413 </p>
414 <p class="dr-returns"><strong class="dr-title">Returns:</strong> <em class="dr-type-object">object</em> <span class="dr-description"><a href="#Element" class="dr-link">Element</a></span></p>
415 </div><h3 id="Element.scale" class="dr-method">Element.scale(sx, sy, [cx], [cy])<a href="#Element.scale" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to source" href="raphael-src.html#L2478">&#x27ad;</a></h3>
416 <div class="dr-method"><p>Adds scale by given amount relative to given point to the list of
417 transformations of the element.
418 </p>
419 <p class="header">Parameters
420 </p>
421 <dl class="dr-parameters"><dt class="dr-param">sx</dt>
422 <dd class="dr-type"><em class="dr-type-number">number</em></dd>
423 <dd class="dr-description">horisontal scale amount</dd>
424 <dt class="dr-param">sy</dt>
425 <dd class="dr-type"><em class="dr-type-number">number</em></dd>
426 <dd class="dr-description">vertical scale amount</dd>
427 <dt class="dr-param optional">cx</dt>
428 <dd class="dr-optional">optional</dd>
429 <dd class="dr-type"><em class="dr-type-number">number</em></dd>
430 <dd class="dr-description">x coordinate of the centre of scale</dd>
431 <dt class="dr-param optional">cy</dt>
432 <dd class="dr-optional">optional</dd>
433 <dd class="dr-type"><em class="dr-type-number">number</em></dd>
434 <dd class="dr-description">y coordinate of the centre of scale</dd>
435 </dl>
436 <p>If cx <em class="amp">&amp;</em> cy aren’t specified centre of the shape is used instead.
437 </p>
438 <p class="dr-returns"><strong class="dr-title">Returns:</strong> <em class="dr-type-object">object</em> <span class="dr-description"><a href="#Element" class="dr-link">Element</a></span></p>
439 </div><h3 id="Element.setTime" class="dr-method">Element.setTime(anim, value)<a href="#Element.setTime" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to source" href="raphael-src.html#L5395">&#x27ad;</a></h3>
440 <div class="dr-method"><p>Sets the status of animation of the element in milliseconds. Similar to <a href="#Element.status" class="dr-link">Element.status</a> method.
441 </p>
442 <p class="header">Parameters
443 </p>
444 <dl class="dr-parameters"><dt class="dr-param">anim</dt>
445 <dd class="dr-type"><em class="dr-type-object">object</em></dd>
446 <dd class="dr-description">animation object</dd>
447 <dt class="dr-param">value</dt>
448 <dd class="dr-type"><em class="dr-type-number">number</em></dd>
449 <dd class="dr-description">number of milliseconds from the beginning of the animation</dd>
450 </dl>
451 <p class="dr-returns"><strong class="dr-title">Returns:</strong> <em class="dr-type-object">object</em> <span class="dr-description">original element if <code>value</code> is specified</span></p>
452 <p>Note, that during animation following events are triggered:
453 </p>
454 <p>On each animation frame event <code>anim.frame.&lt;id></code>, on start <code>anim.start.&lt;id></code> and on end <code>anim.finish.&lt;id></code>.
455 </p>
456 </div><h3 id="Element.show" class="dr-method">Element.show()<a href="#Element.show" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to source" href="raphael-src.html#L2594">&#x27ad;</a></h3>
457 <div class="dr-method"><p>Makes element visible. See <a href="#Element.hide" class="dr-link">Element.hide</a>.
458 </p>
459 <p class="dr-returns"><strong class="dr-title">Returns:</strong> <em class="dr-type-object">object</em> <span class="dr-description"><a href="#Element" class="dr-link">Element</a></span></p>
460 </div><h3 id="Element.status" class="dr-method">Element.status([anim], [value])<a href="#Element.status" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to source" href="raphael-src.html#L5422">&#x27ad;</a></h3>
461 <div class="dr-method"><p>Gets or sets the status of animation of the element.
462 </p>
463 <p class="header">Parameters
464 </p>
465 <dl class="dr-parameters"><dt class="dr-param optional">anim</dt>
466 <dd class="dr-optional">optional</dd>
467 <dd class="dr-type"><em class="dr-type-object">object</em></dd>
468 <dd class="dr-description">animation object</dd>
469 <dt class="dr-param optional">value</dt>
470 <dd class="dr-optional">optional</dd>
471 <dd class="dr-type"><em class="dr-type-number">number</em></dd>
472 <dd class="dr-description">0 – 1. If specified, method works like a setter and sets the status of a given animation to the value. This will cause animation to jump to the given position.</dd>
473 </dl>
474 <p class="dr-returns"><strong class="dr-title">Returns:</strong> <em class="dr-type-number">number</em> <span class="dr-description">status</span></p>
475 <p>or
476 </p>
477 <p class="dr-returns"><strong class="dr-title">Returns:</strong> <em class="dr-type-array">array</em> <span class="dr-description">status if <code>anim</code> is not specified. Array of objects in format:</span></p>
478 <ol class="dr-json"><li>{<ol class="dr-json"><li><span class="dr-json-key">anim:</span><span class="dr-type"><em class="dr-type-object">object</em></span><span class="dr-json-description">animation object</span>
479 <li><span class="dr-json-key">status:</span><span class="dr-type"><em class="dr-type-number">number</em></span><span class="dr-json-description">status</span>
480 </ol></li><li>}</li></ol>
481 <p>or
482 </p>
483 <p class="dr-returns"><strong class="dr-title">Returns:</strong> <em class="dr-type-object">object</em> <span class="dr-description">original element if <code>value</code> is specified</span></p>
484 </div><h3 id="Element.stop" class="dr-method">Element.stop([anim])<a href="#Element.stop" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to source" href="raphael-src.html#L5501">&#x27ad;</a></h3>
485 <div class="dr-method"><p>Stops animation of the element.
486 </p>
487 <p class="header">Parameters
488 </p>
489 <dl class="dr-parameters"><dt class="dr-param optional">anim</dt>
490 <dd class="dr-optional">optional</dd>
491 <dd class="dr-type"><em class="dr-type-object">object</em></dd>
492 <dd class="dr-description">animation object</dd>
493 </dl>
494 <p class="dr-returns"><strong class="dr-title">Returns:</strong> <em class="dr-type-object">object</em> <span class="dr-description">original element</span></p>
495 </div><h3 id="Element.toBack" class="dr-method">Element.toBack()<a href="#Element.toBack" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to source" href="raphael-src.html#L2787">&#x27ad;</a></h3>
496 <div class="dr-method"><p>Moves the element so it is the furthest from the viewer’s eyes, behind other elements.
497 </p>
498 <p class="dr-returns"><strong class="dr-title">Returns:</strong> <em class="dr-type-object">object</em> <span class="dr-description"><a href="#Element" class="dr-link">Element</a></span></p>
499 </div><h3 id="Element.toFront" class="dr-method">Element.toFront()<a href="#Element.toFront" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to source" href="raphael-src.html#L2771">&#x27ad;</a></h3>
500 <div class="dr-method"><p>Moves the element so it is the closest to the viewer’s eyes, on top of other elements.
501 </p>
502 <p class="dr-returns"><strong class="dr-title">Returns:</strong> <em class="dr-type-object">object</em> <span class="dr-description"><a href="#Element" class="dr-link">Element</a></span></p>
503 </div><h3 id="Element.transform" class="dr-method">Element.transform([tstr])<a href="#Element.transform" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to source" href="raphael-src.html#L2557">&#x27ad;</a></h3>
504 <div class="dr-method"><p>Adds transformation to the element which is separate to other attributes,
505 i.e. translation doesn’t change <code>x</code> or <code>y</code> of the rectange. The format
506 of transformation string is similar to the path string syntax:
507 </p>
508 <pre class="javascript code"><code><i>"t100,100r30,<span class="d">100</span>,100s2,<span class="d">2</span>,<span class="d">100</span>,100r45s1<span class="d">.5</span>"</i>
509 </code></pre>
510 <p>Each letter is a command. There are four commands: <code>t</code> is for translate, <code>r</code> is for rotate, <code>s</code> is for
511 scale and <code>m</code> is for matrix.
512 </p>
513 <p>So, example line could be read like “translate by 100, 100, rotate 30° around 100, 100, scale twice around 100, 100
514 rotate 45° around centre and scale 1.5 times relative to centre”. As you see rotate and scale commands has origin
515 coordinates as a optional parameters.
516 Matrix accepts six parameters.
517 </p>
518 <p class="header">Usage
519 </p>
520 <pre class="javascript code"><code><b>var</b> el<span class="s"> = </span>paper.rect(<span class="d">10</span>, <span class="d">20</span>, <span class="d">300</span>, <span class="d">200</span>);
521 <span class="c">// translate <span class="d">100</span>, <span class="d">100</span>, rotate <span class="d">45</span>°, translate -<span class="d">100</span>, <span class="d">0</span></span>
522 el.transform(<i>"t100,100r45t-<span class="d">100</span>,<span class="d">0</span>"</i>);
523 <span class="c">// <b>if</b> you want you can append or prepend transformations</span>
524 el.transform(<i>"...t50,<span class="d">50</span>"</i>);
525 el.transform(<i>"s2..."</i>);
526 <span class="c">// or even wrap</span>
527 el.transform(<i>"t50,<span class="d">50</span>...t-<span class="d">50</span>-<span class="d">50</span>"</i>);
528 <span class="c">// to reset transformation call method <b>with</b> empty string</span>
529 el.transform(<i>""</i>);
530 <span class="c">// to get current value call it without parameters</span>
531 console.log(el.transform());
532 </code></pre>
533 <p class="header">Parameters
534 </p>
535 <dl class="dr-parameters"><dt class="dr-param optional">tstr</dt>
536 <dd class="dr-optional">optional</dd>
537 <dd class="dr-type"><em class="dr-type-string">string</em></dd>
538 <dd class="dr-description">transformation string</dd>
539 </dl>
540 <p>If tstr isn’t specified
541 </p>
542 <p class="dr-returns"><strong class="dr-title">Returns:</strong> <em class="dr-type-string">string</em> <span class="dr-description">current transformation string</span></p>
543 <p>else
544 </p>
545 <p class="dr-returns"><strong class="dr-title">Returns:</strong> <em class="dr-type-object">object</em> <span class="dr-description"><a href="#Element" class="dr-link">Element</a></span></p>
546 </div><h3 id="Element.translate" class="dr-method">Element.translate(dx, dy)<a href="#Element.translate" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to source" href="raphael-src.html#L2509">&#x27ad;</a></h3>
547 <div class="dr-method"><p>Adds translation by given amount to the list of transformations of the element.
548 </p>
549 <p class="header">Parameters
550 </p>
551 <dl class="dr-parameters"><dt class="dr-param">dx</dt>
552 <dd class="dr-type"><em class="dr-type-number">number</em></dd>
553 <dd class="dr-description">horisontal shift</dd>
554 <dt class="dr-param">dy</dt>
555 <dd class="dr-type"><em class="dr-type-number">number</em></dd>
556 <dd class="dr-description">vertical shift</dd>
557 </dl>
558 <p class="dr-returns"><strong class="dr-title">Returns:</strong> <em class="dr-type-object">object</em> <span class="dr-description"><a href="#Element" class="dr-link">Element</a></span></p>
559 </div><h3 id="Element.undrag" class="dr-method">Element.undrag()<a href="#Element.undrag" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to source" href="raphael-src.html#L4187">&#x27ad;</a></h3>
560 <div class="dr-method"><p>Removes all drag event handlers from given element.
561 </p>
562 </div><h3 id="Element.unhover" class="dr-method">Element.unhover(f_in, f_out)<a href="#Element.unhover" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to source" href="raphael-src.html#L4118">&#x27ad;</a></h3>
563 <div class="dr-method"><p>Removes event handlers for hover for the element.
564 </p>
565 <p class="header">Parameters
566 </p>
567 <dl class="dr-parameters"><dt class="dr-param">f_in</dt>
568 <dd class="dr-type"><em class="dr-type-function">function</em></dd>
569 <dd class="dr-description">handler for hover in</dd>
570 <dt class="dr-param">f_out</dt>
571 <dd class="dr-type"><em class="dr-type-function">function</em></dd>
572 <dd class="dr-description">handler for hover out</dd>
573 </dl>
574 <p class="dr-returns"><strong class="dr-title">Returns:</strong> <em class="dr-type-object">object</em> <span class="dr-description"><a href="#Element" class="dr-link">Element</a></span></p>
575 </div><h2 id="Paper" class="undefined">Paper<a href="#Paper" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to source" href="raphael-src.html#Lundefined">&#x27ad;</a></h2>
576 <h3 id="Paper.bottom" class="dr-property">Paper.bottom<a href="#Paper.bottom" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to source" href="raphael-src.html#L4388">&#x27ad;</a></h3>
577 <div class="dr-property"><p>Points to the bottom element on the paper
578 </p>
579 </div><h3 id="Paper.circle" class="dr-method">Paper.circle(x, y, r)<a href="#Paper.circle" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to source" href="raphael-src.html#L4212">&#x27ad;</a></h3>
580 <div class="dr-method"><p>Draws a circle.
581 </p>
582 <p class="header">Parameters
583 </p>
584 <dl class="dr-parameters"><dt class="dr-param">x</dt>
585 <dd class="dr-type"><em class="dr-type-number">number</em></dd>
586 <dd class="dr-description">x coordinate of the centre</dd>
587 <dt class="dr-param">y</dt>
588 <dd class="dr-type"><em class="dr-type-number">number</em></dd>
589 <dd class="dr-description">y coordinate of the centre</dd>
590 <dt class="dr-param">r</dt>
591 <dd class="dr-type"><em class="dr-type-number">number</em></dd>
592 <dd class="dr-description">radius</dd>
593 </dl>
594 <p class="dr-returns"><strong class="dr-title">Returns:</strong> <em class="dr-type-object">object</em> <span class="dr-description">Raphaël element object with type “circle”</span></p>
595 <p class="header">Usage
596 </p>
597 <pre class="javascript code"><code><b>var</b> c<span class="s"> = </span>paper.circle(<span class="d">50</span>, <span class="d">50</span>, <span class="d">40</span>);
598 </code></pre>
599 </div><h3 id="Paper.clear" class="dr-method">Paper.clear()<a href="#Paper.clear" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to source" href="raphael-src.html#L2991">&#x27ad;</a></h3>
600 <div class="dr-method"><p>Clears the paper, i.e. removes all the elements.
601 </p>
602 </div><h3 id="Paper.customAttributes" class="dr-property">Paper.customAttributes<a href="#Paper.customAttributes" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to source" href="raphael-src.html#L260">&#x27ad;</a></h3>
603 <div class="dr-property"><em class="dr-type dr-type-object">object</em><p>If you have a set of attributes that you would like to represent
604 as a function of some number you can do it easily with custom attributes:
605 </p>
606 <p class="header">Usage
607 </p>
608 <pre class="javascript code"><code>paper.customAttributes.hue<span class="s"> = </span><b>function</b> (num) {
609     num<span class="s"> = </span>num<span class="s"> % </span><span class="d">1</span>;
610     <b>return</b> {fill: <i>"hsb("</i><span class="s"> + </span>num<span class="s"> + </span><i>", <span class="d">.75</span>, <span class="d">1</span>)"</i>};
611 };
612 <span class="c">// Custom attribute “hue” will change fill</span>
613 <span class="c">// to be given hue <b>with</b> fixed saturation and brightness.</span>
614 <span class="c">// Now you can use it like <b>this</b>:</span>
615 <b>var</b> c<span class="s"> = </span>paper.circle(<span class="d">10</span>, <span class="d">10</span>, <span class="d">10</span>).attr({hue: <span class="d">.45</span>});
616 <span class="c">// or even like <b>this</b>:</span>
617 c.animate({hue: <span class="d">1</span>}, <span class="d">1e3</span>);
618
619 <span class="c">// You could also create custom attribute</span>
620 <span class="c">// <b>with</b> multiple parameters:</span>
621 paper.customAttributes.hsb<span class="s"> = </span><b>function</b> (h, s, b) {
622     <b>return</b> {fill: <i>"hsb("</i><span class="s"> + </span>[h, s, b].join(<i>","</i>)<span class="s"> + </span><i>")"</i>};
623 };
624 c.attr({hsb: <i>"<span class="d">.5</span> <span class="d">.8</span> <span class="d">1</span>"</i>});
625 c.animate({hsb: <i>"<span class="d">1</span> <span class="d">0</span> <span class="d">.5</span>"</i>}, <span class="d">1e3</span>);
626 </code></pre>
627 </div><h3 id="Paper.ellipse" class="dr-method">Paper.ellipse(x, y, rx, ry)<a href="#Paper.ellipse" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to source" href="raphael-src.html#L4256">&#x27ad;</a></h3>
628 <div class="dr-method"><p>Draws an ellipse.
629 </p>
630 <p class="header">Parameters
631 </p>
632 <dl class="dr-parameters"><dt class="dr-param">x</dt>
633 <dd class="dr-type"><em class="dr-type-number">number</em></dd>
634 <dd class="dr-description">x coordinate of the centre</dd>
635 <dt class="dr-param">y</dt>
636 <dd class="dr-type"><em class="dr-type-number">number</em></dd>
637 <dd class="dr-description">y coordinate of the centre</dd>
638 <dt class="dr-param">rx</dt>
639 <dd class="dr-type"><em class="dr-type-number">number</em></dd>
640 <dd class="dr-description">horisontal radius</dd>
641 <dt class="dr-param">ry</dt>
642 <dd class="dr-type"><em class="dr-type-number">number</em></dd>
643 <dd class="dr-description">vertical radius</dd>
644 </dl>
645 <p class="dr-returns"><strong class="dr-title">Returns:</strong> <em class="dr-type-object">object</em> <span class="dr-description">Raphaël element object with type “ellipse”</span></p>
646 <p class="header">Usage
647 </p>
648 <pre class="javascript code"><code><b>var</b> c<span class="s"> = </span>paper.ellipse(<span class="d">50</span>, <span class="d">50</span>, <span class="d">40</span>, <span class="d">20</span>);
649 </code></pre>
650 </div><h3 id="Paper.forEach" class="dr-method">Paper.forEach(callback, thisArg)<a href="#Paper.forEach" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to source" href="raphael-src.html#L4483">&#x27ad;</a></h3>
651 <div class="dr-method"><p>Executes given function for each element on the paper
652 </p>
653 <p>If function returns <code>false</code> it will stop loop running.
654 </p>
655 <p class="header">Parameters
656 </p>
657 <dl class="dr-parameters"><dt class="dr-param">callback</dt>
658 <dd class="dr-type"><em class="dr-type-function">function</em></dd>
659 <dd class="dr-description">function to run</dd>
660 <dt class="dr-param">thisArg</dt>
661 <dd class="dr-type"><em class="dr-type-object">object</em></dd>
662 <dd class="dr-description">context object for the callback</dd>
663 </dl>
664 <p class="dr-returns"><strong class="dr-title">Returns:</strong> <em class="dr-type-object">object</em> <span class="dr-description">Paper object</span></p>
665 </div><h3 id="Paper.getById" class="dr-method">Paper.getById(id)<a href="#Paper.getById" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to source" href="raphael-src.html#L4459">&#x27ad;</a></h3>
666 <div class="dr-method"><p>Returns you element by it’s internal ID.
667 </p>
668 <p class="header">Parameters
669 </p>
670 <dl class="dr-parameters"><dt class="dr-param">id</dt>
671 <dd class="dr-type"><em class="dr-type-number">number</em></dd>
672 <dd class="dr-description">id</dd>
673 </dl>
674 <p class="dr-returns"><strong class="dr-title">Returns:</strong> <em class="dr-type-object">object</em> <span class="dr-description">Raphaël element object</span></p>
675 </div><h3 id="Paper.getElementByPoint" class="dr-method">Paper.getElementByPoint(x, y)<a href="#Paper.getElementByPoint" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to source" href="raphael-src.html#L4423">&#x27ad;</a></h3>
676 <div class="dr-method"><p>Returns you topmost element under given point.
677 </p>
678 <p class="dr-returns"><strong class="dr-title">Returns:</strong> <em class="dr-type-object">object</em> <span class="dr-description">Raphaël element object</span></p>
679 <p class="header">Parameters
680 </p>
681 <dl class="dr-parameters"><dt class="dr-param">x</dt>
682 <dd class="dr-type"><em class="dr-type-number">number</em></dd>
683 <dd class="dr-description">x coordinate from the top left corner of the window</dd>
684 <dt class="dr-param">y</dt>
685 <dd class="dr-type"><em class="dr-type-number">number</em></dd>
686 <dd class="dr-description">y coordinate from the top left corner of the window</dd>
687 </dl>
688 <p class="header">Usage
689 </p>
690 <pre class="javascript code"><code>paper.getElementByPoint(mouseX, mouseY).attr({stroke: <i>"#f00"</i>});
691 </code></pre>
692 </div><h3 id="Paper.image" class="dr-method">Paper.image(src, x, y, width, height)<a href="#Paper.image" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to source" href="raphael-src.html#L4298">&#x27ad;</a></h3>
693 <div class="dr-method"><p>Embeds an image into the surface.
694 </p>
695 <p class="header">Parameters
696 </p>
697 <dl class="dr-parameters"><dt class="dr-param">src</dt>
698 <dd class="dr-type"><em class="dr-type-string">string</em></dd>
699 <dd class="dr-description">URI of the source image</dd>
700 <dt class="dr-param">x</dt>
701 <dd class="dr-type"><em class="dr-type-number">number</em></dd>
702 <dd class="dr-description">x coordinate position</dd>
703 <dt class="dr-param">y</dt>
704 <dd class="dr-type"><em class="dr-type-number">number</em></dd>
705 <dd class="dr-description">y coordinate position</dd>
706 <dt class="dr-param">width</dt>
707 <dd class="dr-type"><em class="dr-type-number">number</em></dd>
708 <dd class="dr-description">width of the image</dd>
709 <dt class="dr-param">height</dt>
710 <dd class="dr-type"><em class="dr-type-number">number</em></dd>
711 <dd class="dr-description">height of the image</dd>
712 </dl>
713 <p class="dr-returns"><strong class="dr-title">Returns:</strong> <em class="dr-type-object">object</em> <span class="dr-description">Raphaël element object with type “image”</span></p>
714 <p class="header">Usage
715 </p>
716 <pre class="javascript code"><code><b>var</b> c<span class="s"> = </span>paper.image(<i>"apple.png"</i>, <span class="d">10</span>, <span class="d">10</span>, <span class="d">80</span>, <span class="d">80</span>);
717 </code></pre>
718 </div><h3 id="Paper.path" class="dr-method">Paper.path(pathString)<a href="#Paper.path" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to source" href="raphael-src.html#L4276">&#x27ad;</a></h3>
719 <div class="dr-method"><p>Creates a path element by given path data string.
720 </p>
721 <p class="header">Parameters
722 </p>
723 <dl class="dr-parameters"><dt class="dr-param">pathString</dt>
724 <dd class="dr-type"><em class="dr-type-string">string</em></dd>
725 <dd class="dr-description">path data in SVG path string format.</dd>
726 </dl>
727 <p class="dr-returns"><strong class="dr-title">Returns:</strong> <em class="dr-type-object">object</em> <span class="dr-description">Raphaël element object with type “ellipse”</span></p>
728 Details of a path's data attribute's format are described in the <a href="http://www.w3.org/TR/SVG/paths.html#PathData">SVG specification</a>.
729 <p class="header">Usage
730 </p>
731 <pre class="javascript code"><code><b>var</b> c<span class="s"> = </span>paper.path(<i>"M10 10L90 <span class="d">90</span>"</i>);
732 <span class="c">// draw a diagonal line:</span>
733 <span class="c">// move to <span class="d">10</span>,<span class="d">10</span>, line to <span class="d">90</span>,<span class="d">90</span></span>
734 </code></pre>
735 </div><h3 id="Paper.raphael" class="dr-property">Paper.raphael<a href="#Paper.raphael" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to source" href="raphael-src.html#L4395">&#x27ad;</a></h3>
736 <div class="dr-property"><p>Points to the <a href="#Raphael" class="dr-link">Raphael</a> object/function
737 </p>
738 </div><h3 id="Paper.rect" class="dr-method">Paper.rect(x, y, width, height, r)<a href="#Paper.rect" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to source" href="raphael-src.html#L4236">&#x27ad;</a></h3>
739 <div class="dr-method"><p></p>
740 <p>Draws a rectangle.
741 </p>
742 <p class="header">Parameters
743 </p>
744 <dl class="dr-parameters"><dt class="dr-param">x</dt>
745 <dd class="dr-type"><em class="dr-type-number">number</em></dd>
746 <dd class="dr-description">x coordinate of the top left corner</dd>
747 <dt class="dr-param">y</dt>
748 <dd class="dr-type"><em class="dr-type-number">number</em></dd>
749 <dd class="dr-description">y coordinate of the top left corner</dd>
750 <dt class="dr-param">width</dt>
751 <dd class="dr-type"><em class="dr-type-number">number</em></dd>
752 <dd class="dr-description">width</dd>
753 <dt class="dr-param">height</dt>
754 <dd class="dr-type"><em class="dr-type-number">number</em></dd>
755 <dd class="dr-description">height</dd>
756 <dt class="dr-param">r</dt>
757 <dd class="dr-type"><em class="dr-type-number">number</em></dd>
758 <dd class="dr-description"><a href="#optional" class="dr-link">optional</a> radius for rounded corners, default is 0</dd>
759 </dl>
760 <p class="dr-returns"><strong class="dr-title">Returns:</strong> <em class="dr-type-object">object</em> <span class="dr-description">Raphaël element object with type “rect”</span></p>
761 <p class="header">Usage
762 </p>
763 <pre class="javascript code"><code><span class="c">// regular rectangle</span>
764 <b>var</b> c<span class="s"> = </span>paper.rect(<span class="d">10</span>, <span class="d">10</span>, <span class="d">50</span>, <span class="d">50</span>);
765 <span class="c">// rectangle <b>with</b> rounded corners</span>
766 <b>var</b> c<span class="s"> = </span>paper.rect(<span class="d">40</span>, <span class="d">40</span>, <span class="d">50</span>, <span class="d">50</span>, <span class="d">10</span>);
767 </code></pre>
768 </div><h3 id="Paper.remove" class="dr-method">Paper.remove()<a href="#Paper.remove" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to source" href="raphael-src.html#L3008">&#x27ad;</a></h3>
769 <div class="dr-method"><p>Removes the paper from the DOM.
770 </p>
771 </div><h3 id="Paper.safari" class="dr-method">Paper.safari(f_in, f_out, [icontext], [ocontext])<a href="#Paper.safari" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to source" href="raphael-src.html#L3956">&#x27ad;</a></h3>
772 <div class="dr-method"><p>Adds event handlers for hover for the element.
773 </p>
774 <p class="header">Parameters
775 </p>
776 <dl class="dr-parameters"><dt class="dr-param">f_in</dt>
777 <dd class="dr-type"><em class="dr-type-function">function</em></dd>
778 <dd class="dr-description">handler for hover in</dd>
779 <dt class="dr-param">f_out</dt>
780 <dd class="dr-type"><em class="dr-type-function">function</em></dd>
781 <dd class="dr-description">handler for hover out</dd>
782 <dt class="dr-param optional">icontext</dt>
783 <dd class="dr-optional">optional</dd>
784 <dd class="dr-type"><em class="dr-type-object">object</em></dd>
785 <dd class="dr-description">context for hover in handler</dd>
786 <dt class="dr-param optional">ocontext</dt>
787 <dd class="dr-optional">optional</dd>
788 <dd class="dr-type"><em class="dr-type-object">object</em></dd>
789 <dd class="dr-description">context for hover out handler</dd>
790 </dl>
791 <p class="dr-returns"><strong class="dr-title">Returns:</strong> <em class="dr-type-object">object</em> <span class="dr-description"><a href="#Element" class="dr-link">Element</a></span></p>
792 </div><h3 id="Paper.set" class="dr-method">Paper.set()<a href="#Paper.set" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to source" href="raphael-src.html#L4336">&#x27ad;</a></h3>
793 <div class="dr-method"><p>Creates array-like object to keep and operate couple of elements at once.
794 Warning: it doesn’t create any elements for itself in the page.
795 </p>
796 <p class="dr-returns"><strong class="dr-title">Returns:</strong> <em class="dr-type-object">object</em> <span class="dr-description">array-like object that represents set of elements</span></p>
797 <p class="header">Usage
798 </p>
799 <pre class="javascript code"><code><b>var</b> st<span class="s"> = </span>paper.set();
800 st.push(
801     paper.circle(<span class="d">10</span>, <span class="d">10</span>, <span class="d">5</span>),
802     paper.circle(<span class="d">30</span>, <span class="d">10</span>, <span class="d">5</span>)
803 );
804 st.attr({fill: <i>"red"</i>});
805 </code></pre>
806 </div><h3 id="Paper.setSize" class="dr-method">Paper.setSize(width, height)<a href="#Paper.setSize" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to source" href="raphael-src.html#L4358">&#x27ad;</a></h3>
807 <div class="dr-method"><p>If you need to change dimensions of the canvas call this method
808 </p>
809 <p class="header">Parameters
810 </p>
811 <dl class="dr-parameters"><dt class="dr-param">width</dt>
812 <dd class="dr-type"><em class="dr-type-number">number</em></dd>
813 <dd class="dr-description">new width of the canvas</dd>
814 <dt class="dr-param">height</dt>
815 <dd class="dr-type"><em class="dr-type-number">number</em></dd>
816 <dd class="dr-description">new height of the canvas</dd>
817 </dl>
818 <p class="header">Usage
819 </p>
820 <pre class="javascript code"><code><b>var</b> st<span class="s"> = </span>paper.set();
821 st.push(
822     paper.circle(<span class="d">10</span>, <span class="d">10</span>, <span class="d">5</span>),
823     paper.circle(<span class="d">30</span>, <span class="d">10</span>, <span class="d">5</span>)
824 );
825 st.attr({fill: <i>"red"</i>});
826 </code></pre>
827 </div><h3 id="Paper.setViewBox" class="dr-method">Paper.setViewBox(x, y, w, h, fit)<a href="#Paper.setViewBox" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to source" href="raphael-src.html#L4375">&#x27ad;</a></h3>
828 <div class="dr-method"><p>Sets the view box of the paper. Practically it gives you ability to zoom and pan whole paper surface by 
829 specifying new boundaries.
830 </p>
831 <p class="header">Parameters
832 </p>
833 <dl class="dr-parameters"><dt class="dr-param">x</dt>
834 <dd class="dr-type"><em class="dr-type-number">number</em></dd>
835 <dd class="dr-description">new x position, default is <code>0</code></dd>
836 <dt class="dr-param">y</dt>
837 <dd class="dr-type"><em class="dr-type-number">number</em></dd>
838 <dd class="dr-description">new y position, default is <code>0</code></dd>
839 <dt class="dr-param">w</dt>
840 <dd class="dr-type"><em class="dr-type-number">number</em></dd>
841 <dd class="dr-description">new width of the canvas</dd>
842 <dt class="dr-param">h</dt>
843 <dd class="dr-type"><em class="dr-type-number">number</em></dd>
844 <dd class="dr-description">new height of the canvas</dd>
845 <dt class="dr-param">fit</dt>
846 <dd class="dr-type"><em class="dr-type-boolean">boolean</em></dd>
847 <dd class="dr-description"><code>true</code> if you want graphics to fit into new boundary box</dd>
848 </dl>
849 </div><h3 id="Paper.text" class="dr-method">Paper.text(x, y, text)<a href="#Paper.text" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to source" href="raphael-src.html#L4317">&#x27ad;</a></h3>
850 <div class="dr-method"><p>Draws a text string. If you need line breaks, put “\n” in the string.
851 </p>
852 <p class="header">Parameters
853 </p>
854 <dl class="dr-parameters"><dt class="dr-param">x</dt>
855 <dd class="dr-type"><em class="dr-type-number">number</em></dd>
856 <dd class="dr-description">x coordinate position</dd>
857 <dt class="dr-param">y</dt>
858 <dd class="dr-type"><em class="dr-type-number">number</em></dd>
859 <dd class="dr-description">y coordinate position</dd>
860 <dt class="dr-param">text</dt>
861 <dd class="dr-type"><em class="dr-type-string">string</em></dd>
862 <dd class="dr-description">The text string to draw</dd>
863 </dl>
864 <p class="dr-returns"><strong class="dr-title">Returns:</strong> <em class="dr-type-object">object</em> <span class="dr-description">Raphaël element object with type “text”</span></p>
865 <p class="header">Usage
866 </p>
867 <pre class="javascript code"><code><b>var</b> t<span class="s"> = </span>paper.text(<span class="d">50</span>, <span class="d">50</span>, <i>"Raphaël\nkicks\nbutt!"</i>);
868 </code></pre>
869 </div><h3 id="Paper.top" class="dr-property">Paper.top<a href="#Paper.top" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to source" href="raphael-src.html#L4382">&#x27ad;</a></h3>
870 <div class="dr-property"><p>Points to the topmost element on the paper
871 </p>
872 </div><h2 id="Raphael" class="dr-method">Raphael(…)<a href="#Raphael" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to source" href="raphael-src.html#L55">&#x27ad;</a></h2>
873 <div class="dr-method"><p>Creates a canvas object on which to draw.
874 You must do this first, as all future calls to drawing methods
875 from this instance will be bound to this canvas.
876 </p>
877 <p class="header">Parameters
878 </p>
879 <dl class="dr-parameters"><dt class="dr-param">container</dt>
880 <dd class="dr-type"><em class="dr-type-HTMLElement">HTMLElement</em> <em class="dr-type-string">string</em></dd>
881 <dd class="dr-description">DOM element or it’s id which is going to be a parent for drawing surface</dd>
882 <dt class="dr-param">width</dt>
883 <dd class="dr-type"><em class="dr-type-number">number</em></dd>
884 <dd class="dr-description">&#160;</dd>
885 <dt class="dr-param">height</dt>
886 <dd class="dr-type"><em class="dr-type-number">number</em></dd>
887 <dd class="dr-description">&#160;</dd>
888 </dl>
889 <p>or
890 </p>
891 <dl class="dr-parameters"><dt class="dr-param">x</dt>
892 <dd class="dr-type"><em class="dr-type-number">number</em></dd>
893 <dd class="dr-description">&#160;</dd>
894 <dt class="dr-param">y</dt>
895 <dd class="dr-type"><em class="dr-type-number">number</em></dd>
896 <dd class="dr-description">&#160;</dd>
897 <dt class="dr-param">width</dt>
898 <dd class="dr-type"><em class="dr-type-number">number</em></dd>
899 <dd class="dr-description">&#160;</dd>
900 <dt class="dr-param">height</dt>
901 <dd class="dr-type"><em class="dr-type-number">number</em></dd>
902 <dd class="dr-description">&#160;</dd>
903 </dl>
904 <p>or
905 </p>
906 <dl class="dr-parameters"><dt class="dr-param">all</dt>
907 <dd class="dr-type"><em class="dr-type-array">array</em></dd>
908 <dd class="dr-description">(first 3 or 4 elements in the array are equal to [containerID, width, height] or [x, y, width, height]. The rest are element descriptions in format {type: type, &lt;attributes>})</dd>
909 </dl>
910 <p>or
911 </p>
912 <dl class="dr-parameters"><dt class="dr-param">onReadyCallback</dt>
913 <dd class="dr-type"><em class="dr-type-function">function</em></dd>
914 <dd class="dr-description">function that is going to be called on DOM ready event. You can also subscribe to this event via Eve’s “DOMLoad” event. In this case method returns <code>undefined</code>.</dd>
915 </dl>
916 <p class="dr-returns"><strong class="dr-title">Returns:</strong> <em class="dr-type-object">object</em> <span class="dr-description"><a href="#Paper" class="dr-link">Paper</a></span></p>
917 <p class="header">Usage
918 </p>
919 <pre class="javascript code"><code><span class="c">// Each of the following examples create a canvas that is 320px wide by 200px high</span>
920 <span class="c">// Canvas is created at the viewport’s <span class="d">10</span>,<span class="d">50</span> coordinate</span>
921 <b>var</b> paper<span class="s"> = </span>Raphael(<span class="d">10</span>, <span class="d">50</span>, <span class="d">320</span>, <span class="d">200</span>);
922 <span class="c">// Canvas is created at the top left corner of the #notepad element</span>
923 <span class="c">// (or its top right corner <b>in</b> dir=<i>"rtl"</i> elements)</span>
924 <b>var</b> paper<span class="s"> = </span>Raphael(document.getElementById(<i>"notepad"</i>), <span class="d">320</span>, <span class="d">200</span>);
925 <span class="c">// Same as above</span>
926 <b>var</b> paper<span class="s"> = </span>Raphael(<i>"notepad"</i>, <span class="d">320</span>, <span class="d">200</span>);
927 <span class="c">// Image dump</span>
928 <b>var</b> set<span class="s"> = </span>Raphael([<i>"notepad"</i>, <span class="d">320</span>, <span class="d">200</span>, {
929     type: <i>"rect"</i>,
930     x: <span class="d">10</span>,
931     y: <span class="d">10</span>,
932     width: <span class="d">25</span>,
933     height: <span class="d">25</span>,
934     stroke: <i>"#f00"</i>
935 }, {
936     type: <i>"text"</i>,
937     x: <span class="d">30</span>,
938     y: <span class="d">40</span>,
939     text: <i>"Dump"</i>
940 }]);
941 </code></pre>
942 </div><h3 id="Raphael.angle" class="dr-method">Raphael.angle(x1, y1, x2, y2, [x3], [y3])<a href="#Raphael.angle" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to source" href="raphael-src.html#L324">&#x27ad;</a></h3>
943 <div class="dr-method"><p>Returns angle between two or three points
944 </p>
945 <p class="header">Parameters
946 </p>
947 <dl class="dr-parameters"><dt class="dr-param">x1</dt>
948 <dd class="dr-type"><em class="dr-type-number">number</em></dd>
949 <dd class="dr-description">x coord of first point</dd>
950 <dt class="dr-param">y1</dt>
951 <dd class="dr-type"><em class="dr-type-number">number</em></dd>
952 <dd class="dr-description">y coord of first point</dd>
953 <dt class="dr-param">x2</dt>
954 <dd class="dr-type"><em class="dr-type-number">number</em></dd>
955 <dd class="dr-description">x coord of second point</dd>
956 <dt class="dr-param">y2</dt>
957 <dd class="dr-type"><em class="dr-type-number">number</em></dd>
958 <dd class="dr-description">y coord of second point</dd>
959 <dt class="dr-param optional">x3</dt>
960 <dd class="dr-optional">optional</dd>
961 <dd class="dr-type"><em class="dr-type-number">number</em></dd>
962 <dd class="dr-description">x coord of third point</dd>
963 <dt class="dr-param optional">y3</dt>
964 <dd class="dr-optional">optional</dd>
965 <dd class="dr-type"><em class="dr-type-number">number</em></dd>
966 <dd class="dr-description">y coord of third point</dd>
967 </dl>
968 <p class="dr-returns"><strong class="dr-title">Returns:</strong> <em class="dr-type-number">number</em> <span class="dr-description">angle in degrees.</span></p>
969 </div><h3 id="Raphael.animation" class="dr-method">Raphael.animation(params, ms, [easing], [callback])<a href="#Raphael.animation" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to source" href="raphael-src.html#L5330">&#x27ad;</a></h3>
970 <div class="dr-method"><p>Creates animation object. That later could be used for <a href="#Element.animate" class="dr-link">Element.animate</a> or <a href="#Element.animateWith" class="dr-link">Element.animateWith</a> methods.
971 See also <a href="#Animation.delay" class="dr-link">Animation.delay</a> and <a href="#Animation.repeat" class="dr-link">Animation.repeat</a> methods.
972 </p>
973 <p class="header">Parameters
974 </p>
975 <dl class="dr-parameters"><dt class="dr-param">params</dt>
976 <dd class="dr-type"><em class="dr-type-object">object</em></dd>
977 <dd class="dr-description">final attributes for the element, see also <a href="#Element.attr" class="dr-link">Element.attr</a></dd>
978 <dt class="dr-param">ms</dt>
979 <dd class="dr-type"><em class="dr-type-number">number</em></dd>
980 <dd class="dr-description">number of milliseconds for animation to run</dd>
981 <dt class="dr-param optional">easing</dt>
982 <dd class="dr-optional">optional</dd>
983 <dd class="dr-type"><em class="dr-type-string">string</em></dd>
984 <dd class="dr-description">easing type. Accept one of <a href="#Raphael.easing_formulas" class="dr-link">Raphael.easing_formulas</a> or CSS format: <code>cubic&#x2010;bezier(XX,&#160;XX,&#160;XX,&#160;XX)</code></dd>
985 <dt class="dr-param optional">callback</dt>
986 <dd class="dr-optional">optional</dd>
987 <dd class="dr-type"><em class="dr-type-function">function</em></dd>
988 <dd class="dr-description">callback function. Will be called at the end of animation.</dd>
989 </dl>
990 <p class="dr-returns"><strong class="dr-title">Returns:</strong> <em class="dr-type-object">object</em> <span class="dr-description"><a href="#Animation" class="dr-link">Animation</a></span></p>
991 </div><h3 id="Raphael.deg" class="dr-method">Raphael.deg(deg)<a href="#Raphael.deg" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to source" href="raphael-src.html#L357">&#x27ad;</a></h3>
992 <div class="dr-method"><p>Transform angle to degrees
993 </p>
994 <p class="header">Parameters
995 </p>
996 <dl class="dr-parameters"><dt class="dr-param">deg</dt>
997 <dd class="dr-type"><em class="dr-type-number">number</em></dd>
998 <dd class="dr-description">angle in radians</dd>
999 </dl>
1000 <p class="dr-returns"><strong class="dr-title">Returns:</strong> <em class="dr-type-number">number</em> <span class="dr-description">angle in degrees.</span></p>
1001 </div><h3 id="Raphael.easing_formulas" class="dr-property">Raphael.easing_formulas<a href="#Raphael.easing_formulas" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to source" href="raphael-src.html#L4789">&#x27ad;</a></h3>
1002 <div class="dr-property"><p>Object that contains easing formulas for animation. You could extend it with your owns. By default it has following list of easing:
1003 </p>
1004 <ul>
1005     <li>“linear”</li>
1006     <li>“&lt;” or “easeIn” or “ease-in”</li>
1007     <li>“>” or “easeOut” or “ease-out”</li>
1008     <li>“&lt;>” or “easeInOut” or “ease-in-out”</li>
1009     <li>“backIn” or “back-in”</li>
1010     <li>“backOut” or “back-out”</li>
1011     <li>“elastic”</li>
1012     <li>“bounce”</li>
1013 </ul>
1014 <p>See also <a href="http://raphaeljs.com/easing.html">Easing demo</a>.</p>
1015 </div><h3 id="Raphael.el" class="dr-property">Raphael.el<a href="#Raphael.el" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to source" href="raphael-src.html#L5777">&#x27ad;</a></h3>
1016 <div class="dr-property"><em class="dr-type dr-type-object">object</em><p>You can add your own method to elements. This is usefull when you want to hack default functionality or
1017 want to wrap some common transformation or attributes in one method. In difference to canvas methods,
1018 you can redefine element method at any time. Expending element methods wouldn’t affect set
1019 </p>
1020 <p class="header">Usage
1021 </p>
1022 <pre class="javascript code"><code>Raphael.el.red<span class="s"> = </span><b>function</b> () {
1023     <b>this</b>.attr({fill: <i>"#f00"</i>});
1024 };
1025 <span class="c">// then use it</span>
1026 paper.circle(<span class="d">100</span>, <span class="d">100</span>, <span class="d">20</span>).red();
1027 </code></pre>
1028 </div><h3 id="Raphael.findDotsAtSegment" class="dr-method">Raphael.findDotsAtSegment(p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y, t)<a href="#Raphael.findDotsAtSegment" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to source" href="raphael-src.html#L966">&#x27ad;</a></h3>
1029 <div class="dr-method"><p>Utility method
1030 Find dot coordinates on the given cubic bezier curve at the given t.
1031 </p>
1032 <p class="header">Parameters
1033 </p>
1034 <dl class="dr-parameters"><dt class="dr-param">p1x</dt>
1035 <dd class="dr-type"><em class="dr-type-number">number</em></dd>
1036 <dd class="dr-description">x of the first point of the curve</dd>
1037 <dt class="dr-param">p1y</dt>
1038 <dd class="dr-type"><em class="dr-type-number">number</em></dd>
1039 <dd class="dr-description">y of the first point of the curve</dd>
1040 <dt class="dr-param">c1x</dt>
1041 <dd class="dr-type"><em class="dr-type-number">number</em></dd>
1042 <dd class="dr-description">x of the first anchor of the curve</dd>
1043 <dt class="dr-param">c1y</dt>
1044 <dd class="dr-type"><em class="dr-type-number">number</em></dd>
1045 <dd class="dr-description">y of the first anchor of the curve</dd>
1046 <dt class="dr-param">c2x</dt>
1047 <dd class="dr-type"><em class="dr-type-number">number</em></dd>
1048 <dd class="dr-description">x of the second anchor of the curve</dd>
1049 <dt class="dr-param">c2y</dt>
1050 <dd class="dr-type"><em class="dr-type-number">number</em></dd>
1051 <dd class="dr-description">y of the second anchor of the curve</dd>
1052 <dt class="dr-param">p2x</dt>
1053 <dd class="dr-type"><em class="dr-type-number">number</em></dd>
1054 <dd class="dr-description">x of the second point of the curve</dd>
1055 <dt class="dr-param">p2y</dt>
1056 <dd class="dr-type"><em class="dr-type-number">number</em></dd>
1057 <dd class="dr-description">y of the second point of the curve</dd>
1058 <dt class="dr-param">t</dt>
1059 <dd class="dr-type"><em class="dr-type-number">number</em></dd>
1060 <dd class="dr-description">position on the curve (0..1)</dd>
1061 </dl>
1062 <p class="dr-returns"><strong class="dr-title">Returns:</strong> <em class="dr-type-object">object</em> <span class="dr-description">point information in format:</span></p>
1063 <ol class="dr-json"><li>{<ol class="dr-json"><li><span class="dr-json-key">x:</span><span class="dr-type"><em class="dr-type-number">number</em></span><span class="dr-json-description">x coordinate of the point</span>
1064 <li><span class="dr-json-key">y:</span><span class="dr-type"><em class="dr-type-number">number</em></span><span class="dr-json-description">y coordinate of the point</span>
1065 <li>    m: {<ol class="dr-json"><li><span class="dr-json-key">x:</span><span class="dr-type"><em class="dr-type-number">number</em></span><span class="dr-json-description">x coordinate of the left anchor</span>
1066 <li><span class="dr-json-key">y:</span><span class="dr-type"><em class="dr-type-number">number</em></span><span class="dr-json-description">y coordinate of the left anchor</span>
1067 </ol></li><li>    }</li><li>    n: {<ol class="dr-json"><li><span class="dr-json-key">x:</span><span class="dr-type"><em class="dr-type-number">number</em></span><span class="dr-json-description">x coordinate of the right anchor</span>
1068 <li><span class="dr-json-key">y:</span><span class="dr-type"><em class="dr-type-number">number</em></span><span class="dr-json-description">y coordinate of the right anchor</span>
1069 </ol></li><li>    }</li><li>    start: {<ol class="dr-json"><li><span class="dr-json-key">x:</span><span class="dr-type"><em class="dr-type-number">number</em></span><span class="dr-json-description">x coordinate of the start of the curve</span>
1070 <li><span class="dr-json-key">y:</span><span class="dr-type"><em class="dr-type-number">number</em></span><span class="dr-json-description">y coordinate of the start of the curve</span>
1071 </ol></li><li>    }</li><li>    end: {<ol class="dr-json"><li><span class="dr-json-key">x:</span><span class="dr-type"><em class="dr-type-number">number</em></span><span class="dr-json-description">x coordinate of the end of the curve</span>
1072 <li><span class="dr-json-key">y:</span><span class="dr-type"><em class="dr-type-number">number</em></span><span class="dr-json-description">y coordinate of the end of the curve</span>
1073 </ol></li><li>    }</li><li><span class="dr-json-key">alpha:</span><span class="dr-type"><em class="dr-type-number">number</em></span><span class="dr-json-description">angle of the curve derivative at the point</span>
1074 </ol></li><li>}</li></ol>
1075 </div><h3 id="Raphael.fn" class="dr-property">Raphael.fn<a href="#Raphael.fn" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to source" href="raphael-src.html#L288">&#x27ad;</a></h3>
1076 <div class="dr-property"><em class="dr-type dr-type-object">object</em><p>You can add your own method to the canvas. For example if you want to draw pie chart,
1077 you can create your own pie chart function and ship it as a Raphaël plugin. To do this
1078 you need to extend <code>Raphael.fn</code> object. Please note that you can create your own namespaces
1079 inside <code>fn</code> object. Methods will be run in context of canvas anyway. You should alter <code>fn</code>
1080 object before Raphaël instance was created, otherwise it will take no effect.
1081 </p>
1082 <p class="header">Usage
1083 </p>
1084 <pre class="javascript code"><code>Raphael.fn.arrow<span class="s"> = </span><b>function</b> (x1, y1, x2, y2, size) {
1085     <b>return</b> <b>this</b>.path( ... );
1086 };
1087 <span class="c">// or create namespace</span>
1088 Raphael.fn.mystuff<span class="s"> = </span>{
1089     arrow: <b>function</b> () {…},
1090     star: <b>function</b> () {…},
1091     <span class="c">// etc…</span>
1092 };
1093 <b>var</b> paper<span class="s"> = </span>Raphael(<span class="d">10</span>, <span class="d">10</span>, <span class="d">630</span>, <span class="d">480</span>);
1094 <span class="c">// then use it</span>
1095 paper.arrow(<span class="d">10</span>, <span class="d">10</span>, <span class="d">30</span>, <span class="d">30</span>, <span class="d">5</span>).attr({fill: <i>"#f00"</i>});
1096 paper.mystuff.arrow();
1097 paper.mystuff.star();
1098 </code></pre>
1099 </div><h3 id="Raphael.getColor" class="dr-method">Raphael.getColor([value])<a href="#Raphael.getColor" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to source" href="raphael-src.html#L829">&#x27ad;</a></h3>
1100 <div class="dr-method"><p>On each call returns next colour in the spectrum. To reset it back to red call <a href="#Raphael.getColor.reset" class="dr-link">Raphael.getColor.reset</a>
1101 </p>
1102 <p class="header">Parameters
1103 </p>
1104 <dl class="dr-parameters"><dt class="dr-param optional">value</dt>
1105 <dd class="dr-optional">optional</dd>
1106 <dd class="dr-type"><em class="dr-type-number">number</em></dd>
1107 <dd class="dr-description">brightness, default is <code>0.75</code></dd>
1108 </dl>
1109 <p class="dr-returns"><strong class="dr-title">Returns:</strong> <em class="dr-type-string">string</em> <span class="dr-description">hex representation of the colour.</span></p>
1110 </div><h4 id="Raphael.getColor.reset" class="dr-method">Raphael.getColor.reset()<a href="#Raphael.getColor.reset" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to source" href="raphael-src.html#L846">&#x27ad;</a></h4>
1111 <div class="dr-method"><p>Resets spectrum position for <a href="#Raphael.getColor" class="dr-link">Raphael.getColor</a> back to red.
1112 </p>
1113 </div><h3 id="Raphael.getPointAtLength" class="dr-method">Raphael.getPointAtLength(path, length)<a href="#Raphael.getPointAtLength" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to source" href="raphael-src.html#L4698">&#x27ad;</a></h3>
1114 <div class="dr-method"><p>Return coordinates of the point located at the given length on the given path.
1115 </p>
1116 <p class="header">Parameters
1117 </p>
1118 <dl class="dr-parameters"><dt class="dr-param">path</dt>
1119 <dd class="dr-type"><em class="dr-type-string">string</em></dd>
1120 <dd class="dr-description">SVG path string</dd>
1121 <dt class="dr-param">length</dt>
1122 <dd class="dr-type"><em class="dr-type-number">number</em></dd>
1123 <dd class="dr-description">&#160;</dd>
1124 </dl>
1125 <p class="dr-returns"><strong class="dr-title">Returns:</strong> <em class="dr-type-object">object</em> <span class="dr-description">representation of the point:</span></p>
1126 <ol class="dr-json"><li>{<ol class="dr-json"><li><span class="dr-json-key">x:</span><span class="dr-type"><em class="dr-type-number">number</em></span><span class="dr-json-description">x coordinate</span>
1127 <li><span class="dr-json-key">y:</span><span class="dr-type"><em class="dr-type-number">number</em></span><span class="dr-json-description">y coordinate</span>
1128 <li><span class="dr-json-key">alpha:</span><span class="dr-type"><em class="dr-type-number">number</em></span><span class="dr-json-description">angle of derivative</span>
1129 </ol></li><li>}</li></ol>
1130 </div><h3 id="Raphael.getRGB" class="dr-method">Raphael.getRGB(colour)<a href="#Raphael.getRGB" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to source" href="raphael-src.html#L707">&#x27ad;</a></h3>
1131 <div class="dr-method"><p>Parses colour string as RGB object
1132 </p>
1133 <p class="header">Parameters
1134 </p>
1135 <dl class="dr-parameters"><dt class="dr-param">colour</dt>
1136 <dd class="dr-type"><em class="dr-type-string">string</em></dd>
1137 <dd class="dr-description">colour string in one of formats:</dd>
1138 </dl>
1139 <p class="dr-returns"><strong class="dr-title">Returns:</strong> <em class="dr-type-object">object</em> <span class="dr-description">RGB object in format:</span></p>
1140 <ol class="dr-json"><li>{<ol class="dr-json"><li><span class="dr-json-key">r</span><span class="dr-type"><em class="dr-type-number">number</em></span><span class="dr-json-description">red,</span>
1141 <li><span class="dr-json-key">g</span><span class="dr-type"><em class="dr-type-number">number</em></span><span class="dr-json-description">green,</span>
1142 <li><span class="dr-json-key">b</span><span class="dr-type"><em class="dr-type-number">number</em></span><span class="dr-json-description">blue</span>
1143 <li><span class="dr-json-key">hex</span><span class="dr-type"><em class="dr-type-string">string</em></span><span class="dr-json-description">color in HTML/CSS format: #••••••,</span>
1144 <li><span class="dr-json-key">error</span><span class="dr-type"><em class="dr-type-boolean">boolean</em></span><span class="dr-json-description">true if string can’t be parsed</span>
1145 </ol></li><li>}</li></ol>
1146 </div><h3 id="Raphael.getSubpath" class="dr-method">Raphael.getSubpath(path, from, to)<a href="#Raphael.getSubpath" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to source" href="raphael-src.html#L4713">&#x27ad;</a></h3>
1147 <div class="dr-method"><p>Return subpath of a given path from given length to given length.
1148 </p>
1149 <p class="header">Parameters
1150 </p>
1151 <dl class="dr-parameters"><dt class="dr-param">path</dt>
1152 <dd class="dr-type"><em class="dr-type-string">string</em></dd>
1153 <dd class="dr-description">SVG path string</dd>
1154 <dt class="dr-param">from</dt>
1155 <dd class="dr-type"><em class="dr-type-number">number</em></dd>
1156 <dd class="dr-description">position of the start of the segment</dd>
1157 <dt class="dr-param">to</dt>
1158 <dd class="dr-type"><em class="dr-type-number">number</em></dd>
1159 <dd class="dr-description">position of the end of the segment</dd>
1160 </dl>
1161 <p class="dr-returns"><strong class="dr-title">Returns:</strong> <em class="dr-type-string">string</em> <span class="dr-description">pathstring for the segment</span></p>
1162 </div><h3 id="Raphael.getTotalLength" class="dr-method">Raphael.getTotalLength(path)<a href="#Raphael.getTotalLength" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to source" href="raphael-src.html#L4679">&#x27ad;</a></h3>
1163 <div class="dr-method"><p>Returns length of the given path in pixels.
1164 </p>
1165 <p class="header">Parameters
1166 </p>
1167 <dl class="dr-parameters"><dt class="dr-param">path</dt>
1168 <dd class="dr-type"><em class="dr-type-string">string</em></dd>
1169 <dd class="dr-description">SVG path string.</dd>
1170 </dl>
1171 <p class="dr-returns"><strong class="dr-title">Returns:</strong> <em class="dr-type-number">number</em> <span class="dr-description">length.</span></p>
1172 </div><h3 id="Raphael.hsb" class="dr-method">Raphael.hsb(h, s, b)<a href="#Raphael.hsb" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to source" href="raphael-src.html#L789">&#x27ad;</a></h3>
1173 <div class="dr-method"><p>Converts HSB values to hex representation of the colour.
1174 </p>
1175 <p class="header">Parameters
1176 </p>
1177 <dl class="dr-parameters"><dt class="dr-param">h</dt>
1178 <dd class="dr-type"><em class="dr-type-number">number</em></dd>
1179 <dd class="dr-description">hue</dd>
1180 <dt class="dr-param">s</dt>
1181 <dd class="dr-type"><em class="dr-type-number">number</em></dd>
1182 <dd class="dr-description">saturation</dd>
1183 <dt class="dr-param">b</dt>
1184 <dd class="dr-type"><em class="dr-type-number">number</em></dd>
1185 <dd class="dr-description">value or brightness</dd>
1186 </dl>
1187 <p class="dr-returns"><strong class="dr-title">Returns:</strong> <em class="dr-type-string">string</em> <span class="dr-description">hex representation of the colour.</span></p>
1188 </div><h3 id="Raphael.hsb2rgb" class="dr-method">Raphael.hsb2rgb(h, s, v)<a href="#Raphael.hsb2rgb" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to source" href="raphael-src.html#L514">&#x27ad;</a></h3>
1189 <div class="dr-method"><p>Converts HSB values to RGB object.
1190 </p>
1191 <p class="header">Parameters
1192 </p>
1193 <dl class="dr-parameters"><dt class="dr-param">h</dt>
1194 <dd class="dr-type"><em class="dr-type-number">number</em></dd>
1195 <dd class="dr-description">hue</dd>
1196 <dt class="dr-param">s</dt>
1197 <dd class="dr-type"><em class="dr-type-number">number</em></dd>
1198 <dd class="dr-description">saturation</dd>
1199 <dt class="dr-param">v</dt>
1200 <dd class="dr-type"><em class="dr-type-number">number</em></dd>
1201 <dd class="dr-description">value or brightness</dd>
1202 </dl>
1203 <p class="dr-returns"><strong class="dr-title">Returns:</strong> <em class="dr-type-object">object</em> <span class="dr-description">RGB object in format:</span></p>
1204 <ol class="dr-json"><li>{<ol class="dr-json"><li><span class="dr-json-key">r</span><span class="dr-type"><em class="dr-type-number">number</em></span><span class="dr-json-description">red,</span>
1205 <li><span class="dr-json-key">g</span><span class="dr-type"><em class="dr-type-number">number</em></span><span class="dr-json-description">green,</span>
1206 <li><span class="dr-json-key">b</span><span class="dr-type"><em class="dr-type-number">number</em></span><span class="dr-json-description">blue,</span>
1207 <li><span class="dr-json-key">hex</span><span class="dr-type"><em class="dr-type-string">string</em></span><span class="dr-json-description">color in HTML/CSS format: #••••••</span>
1208 </ol></li><li>}</li></ol>
1209 </div><h3 id="Raphael.hsl" class="dr-method">Raphael.hsl(h, s, l)<a href="#Raphael.hsl" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to source" href="raphael-src.html#L803">&#x27ad;</a></h3>
1210 <div class="dr-method"><p>Converts HSL values to hex representation of the colour.
1211 </p>
1212 <p class="header">Parameters
1213 </p>
1214 <dl class="dr-parameters"><dt class="dr-param">h</dt>
1215 <dd class="dr-type"><em class="dr-type-number">number</em></dd>
1216 <dd class="dr-description">hue</dd>
1217 <dt class="dr-param">s</dt>
1218 <dd class="dr-type"><em class="dr-type-number">number</em></dd>
1219 <dd class="dr-description">saturation</dd>
1220 <dt class="dr-param">l</dt>
1221 <dd class="dr-type"><em class="dr-type-number">number</em></dd>
1222 <dd class="dr-description">luminosity</dd>
1223 </dl>
1224 <p class="dr-returns"><strong class="dr-title">Returns:</strong> <em class="dr-type-string">string</em> <span class="dr-description">hex representation of the colour.</span></p>
1225 </div><h3 id="Raphael.hsl2rgb" class="dr-method">Raphael.hsl2rgb(h, s, l)<a href="#Raphael.hsl2rgb" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to source" href="raphael-src.html#L551">&#x27ad;</a></h3>
1226 <div class="dr-method"><p>Converts HSL values to RGB object.
1227 </p>
1228 <p class="header">Parameters
1229 </p>
1230 <dl class="dr-parameters"><dt class="dr-param">h</dt>
1231 <dd class="dr-type"><em class="dr-type-number">number</em></dd>
1232 <dd class="dr-description">hue</dd>
1233 <dt class="dr-param">s</dt>
1234 <dd class="dr-type"><em class="dr-type-number">number</em></dd>
1235 <dd class="dr-description">saturation</dd>
1236 <dt class="dr-param">l</dt>
1237 <dd class="dr-type"><em class="dr-type-number">number</em></dd>
1238 <dd class="dr-description">luminosity</dd>
1239 </dl>
1240 <p class="dr-returns"><strong class="dr-title">Returns:</strong> <em class="dr-type-object">object</em> <span class="dr-description">RGB object in format:</span></p>
1241 <ol class="dr-json"><li>{<ol class="dr-json"><li><span class="dr-json-key">r</span><span class="dr-type"><em class="dr-type-number">number</em></span><span class="dr-json-description">red,</span>
1242 <li><span class="dr-json-key">g</span><span class="dr-type"><em class="dr-type-number">number</em></span><span class="dr-json-description">green,</span>
1243 <li><span class="dr-json-key">b</span><span class="dr-type"><em class="dr-type-number">number</em></span><span class="dr-json-description">blue,</span>
1244 <li><span class="dr-json-key">hex</span><span class="dr-type"><em class="dr-type-string">string</em></span><span class="dr-json-description">color in HTML/CSS format: #••••••</span>
1245 </ol></li><li>}</li></ol>
1246 </div><h3 id="Raphael.is" class="dr-method">Raphael.is(o, type)<a href="#Raphael.is" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to source" href="raphael-src.html#L299">&#x27ad;</a></h3>
1247 <div class="dr-method"><p>Handfull replacement for <code>typeof</code> operator.
1248 </p>
1249 <p class="header">Parameters
1250 </p>
1251 <dl class="dr-parameters"><dt class="dr-param">o</dt>
1252 <dd class="dr-type"><em class="dr-type-…">…</em></dd>
1253 <dd class="dr-description">any object or primitive</dd>
1254 <dt class="dr-param">type</dt>
1255 <dd class="dr-type"><em class="dr-type-string">string</em></dd>
1256 <dd class="dr-description">name of the type, i.e. “string”, “function”, “number”, etc.</dd>
1257 </dl>
1258 <p class="dr-returns"><strong class="dr-title">Returns:</strong> <em class="dr-type-boolean">boolean</em> <span class="dr-description">is given value is of given type</span></p>
1259 </div><h3 id="Raphael.parsePathString" class="dr-method">Raphael.parsePathString(pathString)<a href="#Raphael.parsePathString" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to source" href="raphael-src.html#L861">&#x27ad;</a></h3>
1260 <div class="dr-method"><p>Utility method
1261 Parses given path string into an array of arrays of path segments.
1262 </p>
1263 <p class="header">Parameters
1264 </p>
1265 <dl class="dr-parameters"><dt class="dr-param">pathString</dt>
1266 <dd class="dr-type"><em class="dr-type-string">string</em> <em class="dr-type-array">array</em></dd>
1267 <dd class="dr-description">path string or array of segments (in the last case it will be returned stright away)</dd>
1268 </dl>
1269 <p class="dr-returns"><strong class="dr-title">Returns:</strong> <em class="dr-type-array">array</em> <span class="dr-description">array of segments.</span></p>
1270 </div><h3 id="Raphael.parseTransformString" class="dr-method">Raphael.parseTransformString(TString)<a href="#Raphael.parseTransformString" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to source" href="raphael-src.html#L904">&#x27ad;</a></h3>
1271 <div class="dr-method"><p>Utility method
1272 Parses given path string into an array of transformations.
1273 </p>
1274 <p class="header">Parameters
1275 </p>
1276 <dl class="dr-parameters"><dt class="dr-param">TString</dt>
1277 <dd class="dr-type"><em class="dr-type-string">string</em> <em class="dr-type-array">array</em></dd>
1278 <dd class="dr-description">transform string or array of transformations (in the last case it will be returned stright away)</dd>
1279 </dl>
1280 <p class="dr-returns"><strong class="dr-title">Returns:</strong> <em class="dr-type-array">array</em> <span class="dr-description">array of transformations.</span></p>
1281 </div><h3 id="Raphael.path2curve" class="dr-method">Raphael.path2curve(pathString)<a href="#Raphael.path2curve" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to source" href="raphael-src.html#L1683">&#x27ad;</a></h3>
1282 <div class="dr-method"><p>Utility method
1283 Converts path to path where all segments are cubic bezier curves.
1284 </p>
1285 <p class="header">Parameters
1286 </p>
1287 <dl class="dr-parameters"><dt class="dr-param">pathString</dt>
1288 <dd class="dr-type"><em class="dr-type-string">string</em> <em class="dr-type-array">array</em></dd>
1289 <dd class="dr-description">path string or array of segments</dd>
1290 </dl>
1291 <p class="dr-returns"><strong class="dr-title">Returns:</strong> <em class="dr-type-array">array</em> <span class="dr-description">array of segments.</span></p>
1292 </div><h3 id="Raphael.pathToRelative" class="dr-method">Raphael.pathToRelative(pathString)<a href="#Raphael.pathToRelative" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to source" href="raphael-src.html#L1671">&#x27ad;</a></h3>
1293 <div class="dr-method"><p>Utility method
1294 Converts path to relative form
1295 </p>
1296 <p class="header">Parameters
1297 </p>
1298 <dl class="dr-parameters"><dt class="dr-param">pathString</dt>
1299 <dd class="dr-type"><em class="dr-type-string">string</em> <em class="dr-type-array">array</em></dd>
1300 <dd class="dr-description">path string or array of segments</dd>
1301 </dl>
1302 <p class="dr-returns"><strong class="dr-title">Returns:</strong> <em class="dr-type-array">array</em> <span class="dr-description">array of segments.</span></p>
1303 </div><h3 id="Raphael.rad" class="dr-method">Raphael.rad(deg)<a href="#Raphael.rad" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to source" href="raphael-src.html#L345">&#x27ad;</a></h3>
1304 <div class="dr-method"><p>Transform angle to radians
1305 </p>
1306 <p class="header">Parameters
1307 </p>
1308 <dl class="dr-parameters"><dt class="dr-param">deg</dt>
1309 <dd class="dr-type"><em class="dr-type-number">number</em></dd>
1310 <dd class="dr-description">angle in degrees</dd>
1311 </dl>
1312 <p class="dr-returns"><strong class="dr-title">Returns:</strong> <em class="dr-type-number">number</em> <span class="dr-description">angle in radians.</span></p>
1313 </div><h3 id="Raphael.rgb" class="dr-method">Raphael.rgb(r, g, b)<a href="#Raphael.rgb" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to source" href="raphael-src.html#L817">&#x27ad;</a></h3>
1314 <div class="dr-method"><p>Converts RGB values to hex representation of the colour.
1315 </p>
1316 <p class="header">Parameters
1317 </p>
1318 <dl class="dr-parameters"><dt class="dr-param">r</dt>
1319 <dd class="dr-type"><em class="dr-type-number">number</em></dd>
1320 <dd class="dr-description">red</dd>
1321 <dt class="dr-param">g</dt>
1322 <dd class="dr-type"><em class="dr-type-number">number</em></dd>
1323 <dd class="dr-description">green</dd>
1324 <dt class="dr-param">b</dt>
1325 <dd class="dr-type"><em class="dr-type-number">number</em></dd>
1326 <dd class="dr-description">blue</dd>
1327 </dl>
1328 <p class="dr-returns"><strong class="dr-title">Returns:</strong> <em class="dr-type-string">string</em> <span class="dr-description">hex representation of the colour.</span></p>
1329 </div><h3 id="Raphael.rgb2hsb" class="dr-method">Raphael.rgb2hsb(r, g, b)<a href="#Raphael.rgb2hsb" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to source" href="raphael-src.html#L591">&#x27ad;</a></h3>
1330 <div class="dr-method"><p>Converts RGB values to HSB object.
1331 </p>
1332 <p class="header">Parameters
1333 </p>
1334 <dl class="dr-parameters"><dt class="dr-param">r</dt>
1335 <dd class="dr-type"><em class="dr-type-number">number</em></dd>
1336 <dd class="dr-description">red</dd>
1337 <dt class="dr-param">g</dt>
1338 <dd class="dr-type"><em class="dr-type-number">number</em></dd>
1339 <dd class="dr-description">green</dd>
1340 <dt class="dr-param">b</dt>
1341 <dd class="dr-type"><em class="dr-type-number">number</em></dd>
1342 <dd class="dr-description">blue</dd>
1343 </dl>
1344 <p class="dr-returns"><strong class="dr-title">Returns:</strong> <em class="dr-type-object">object</em> <span class="dr-description">HSB object in format:</span></p>
1345 <ol class="dr-json"><li>{<ol class="dr-json"><li><span class="dr-json-key">h</span><span class="dr-type"><em class="dr-type-number">number</em></span><span class="dr-json-description">hue</span>
1346 <li><span class="dr-json-key">s</span><span class="dr-type"><em class="dr-type-number">number</em></span><span class="dr-json-description">saturation</span>
1347 <li><span class="dr-json-key">b</span><span class="dr-type"><em class="dr-type-number">number</em></span><span class="dr-json-description">brightness</span>
1348 </ol></li><li>}</li></ol>
1349 </div><h3 id="Raphael.rgb2hsl" class="dr-method">Raphael.rgb2hsl(r, g, b)<a href="#Raphael.rgb2hsl" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to source" href="raphael-src.html#L624">&#x27ad;</a></h3>
1350 <div class="dr-method"><p>Converts RGB values to HSL object.
1351 </p>
1352 <p class="header">Parameters
1353 </p>
1354 <dl class="dr-parameters"><dt class="dr-param">r</dt>
1355 <dd class="dr-type"><em class="dr-type-number">number</em></dd>
1356 <dd class="dr-description">red</dd>
1357 <dt class="dr-param">g</dt>
1358 <dd class="dr-type"><em class="dr-type-number">number</em></dd>
1359 <dd class="dr-description">green</dd>
1360 <dt class="dr-param">b</dt>
1361 <dd class="dr-type"><em class="dr-type-number">number</em></dd>
1362 <dd class="dr-description">blue</dd>
1363 </dl>
1364 <p class="dr-returns"><strong class="dr-title">Returns:</strong> <em class="dr-type-object">object</em> <span class="dr-description">HSL object in format:</span></p>
1365 <ol class="dr-json"><li>{<ol class="dr-json"><li><span class="dr-json-key">h</span><span class="dr-type"><em class="dr-type-number">number</em></span><span class="dr-json-description">hue</span>
1366 <li><span class="dr-json-key">s</span><span class="dr-type"><em class="dr-type-number">number</em></span><span class="dr-json-description">saturation</span>
1367 <li><span class="dr-json-key">l</span><span class="dr-type"><em class="dr-type-number">number</em></span><span class="dr-json-description">luminosity</span>
1368 </ol></li><li>}</li></ol>
1369 </div><h3 id="Raphael.setWindow" class="dr-method">Raphael.setWindow(newwin)<a href="#Raphael.setWindow" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to source" href="raphael-src.html#L409">&#x27ad;</a></h3>
1370 <div class="dr-method"><p>Used when you need to draw in <code>&lt;iframe></code>. Switched window to the iframe one.
1371 </p>
1372 <p class="header">Parameters
1373 </p>
1374 <dl class="dr-parameters"><dt class="dr-param">newwin</dt>
1375 <dd class="dr-type"><em class="dr-type-window">window</em></dd>
1376 <dd class="dr-description">new window object</dd>
1377 </dl>
1378 </div><h3 id="Raphael.snapTo" class="dr-method">Raphael.snapTo(values, value, [tolerance])<a href="#Raphael.snapTo" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to source" href="raphael-src.html#L371">&#x27ad;</a></h3>
1379 <div class="dr-method"><p>Snaps given value to given grid.
1380 </p>
1381 <p class="header">Parameters
1382 </p>
1383 <dl class="dr-parameters"><dt class="dr-param">values</dt>
1384 <dd class="dr-type"><em class="dr-type-array">array</em> <em class="dr-type-number">number</em></dd>
1385 <dd class="dr-description">given array of values or step of the grid</dd>
1386 <dt class="dr-param">value</dt>
1387 <dd class="dr-type"><em class="dr-type-number">number</em></dd>
1388 <dd class="dr-description">value to adjust</dd>
1389 <dt class="dr-param optional">tolerance</dt>
1390 <dd class="dr-optional">optional</dd>
1391 <dd class="dr-type"><em class="dr-type-number">number</em></dd>
1392 <dd class="dr-description">tolerance for snapping. Default is <code>10</code>.</dd>
1393 </dl>
1394 <p class="dr-returns"><strong class="dr-title">Returns:</strong> <em class="dr-type-number">number</em> <span class="dr-description">adjusted value.</span></p>
1395 </div><h3 id="Raphael.svg" class="dr-property">Raphael.svg<a href="#Raphael.svg" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to source" href="raphael-src.html#L226">&#x27ad;</a></h3>
1396 <div class="dr-property"><em class="dr-type dr-type-boolean">boolean</em><p><code>true</code> if browser supports SVG.
1397 </p>
1398 </div><h3 id="Raphael.type" class="dr-property">Raphael.type<a href="#Raphael.type" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to source" href="raphael-src.html#L208">&#x27ad;</a></h3>
1399 <div class="dr-property"><em class="dr-type dr-type-string">string</em><p>Can be “SVG”, “VML” or empty, depending on browser support.
1400 </p>
1401 </div><h3 id="Raphael.vml" class="dr-property">Raphael.vml<a href="#Raphael.vml" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to source" href="raphael-src.html#L232">&#x27ad;</a></h3>
1402 <div class="dr-property"><em class="dr-type dr-type-boolean">boolean</em><p><code>true</code> if browser supports VML.
1403 </p>
1404 </div><h2 id="Set" class="undefined">Set<a href="#Set" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to source" href="raphael-src.html#Lundefined">&#x27ad;</a></h2>
1405 <h3 id="Set.forEach" class="dr-method">Set.forEach(callback, thisArg)<a href="#Set.forEach" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to source" href="raphael-src.html#L5573">&#x27ad;</a></h3>
1406 <div class="dr-method"><p>Executes given function for each element in the set.
1407 </p>
1408 <p>If function returns <code>false</code> it will stop loop running.
1409 </p>
1410 <p class="header">Parameters
1411 </p>
1412 <dl class="dr-parameters"><dt class="dr-param">callback</dt>
1413 <dd class="dr-type"><em class="dr-type-function">function</em></dd>
1414 <dd class="dr-description">function to run</dd>
1415 <dt class="dr-param">thisArg</dt>
1416 <dd class="dr-type"><em class="dr-type-object">object</em></dd>
1417 <dd class="dr-description">context object for the callback</dd>
1418 </dl>
1419 <p class="dr-returns"><strong class="dr-title">Returns:</strong> <em class="dr-type-object">object</em> <span class="dr-description">Set object</span></p>
1420 </div><h3 id="Set.pop" class="dr-method">Set.pop()<a href="#Set.pop" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to source" href="raphael-src.html#L5555">&#x27ad;</a></h3>
1421 <div class="dr-method"><p>Removes last element and returns it.
1422 </p>
1423 <p class="dr-returns"><strong class="dr-title">Returns:</strong> <em class="dr-type-object">object</em> <span class="dr-description">element</span></p>
1424 </div><h3 id="Set.push" class="dr-method">Set.push()<a href="#Set.push" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to source" href="raphael-src.html#L5535">&#x27ad;</a></h3>
1425 <div class="dr-method"><p>Adds each argument to the current set.
1426 </p>
1427 <p class="dr-returns"><strong class="dr-title">Returns:</strong> <em class="dr-type-object">object</em> <span class="dr-description">original element</span></p>
1428 </div></div></div></body></html>