X-Git-Url: http://git.roojs.org/?p=raphael;a=blobdiff_plain;f=reference.html;h=51a85cdb697fe302fd72ebc7b496445a3d3339b1;hp=72226340fa1ba12244fc17f7ab30fa99782f4f7c;hb=300aa589f5a0ba7fce667cd62c7cdda0bd5ad904;hpb=c2180d09d490967447245fcb86f3936f2c6a5b40 diff --git a/reference.html b/reference.html index 7222634..51a85cd 100644 --- a/reference.html +++ b/reference.html @@ -1,7 +1,7 @@
Creates a copy of existing animation object with given delay.
Parameters @@ -15,7 +15,7 @@ circle1.animate(anim); // run the given animation immediately circle2.animate(anim.delay(500)); // run the given animation after 500 ms -
Creates a copy of existing animation object with given repetition.
Parameters
@@ -26,7 +26,7 @@ circle2.animate(anim.delay(500)); // run
Returns: object new altered Animation object
Creates and starts animation for given element.
Parameters
@@ -53,7 +53,7 @@ circle2.animate(anim.delay(500)); // run
Returns: object original element
Acts similar to Element.animate, but ensure that given animation runs in sync with another given element.
Parameters @@ -196,7 +196,7 @@ at 0.25, 0.75. Focus point coordinates are in 0..1 range. Radial gradients can o
hsl(240deg, 1, .5)
â or, if you want to go fancy, âhsl(240°, 1, .5)
âAdds event handler for click for the element.
Parameters @@ -206,9 +206,9 @@ at 0.25, 0.75. Focus point coordinates are in 0..1 range. Radial gradients can o
Returns: object Element
-Returns: object clone of a given element
-Adds or retrieves given value asociated with given key. See also Element.removeData
@@ -237,7 +237,7 @@ See also Element.removeData }); } -Adds event handler for double click for the element.
Parameters @@ -247,7 +247,7 @@ See also Element.removeData
Returns: object Element
-Adds event handlers for drag of the element.
Parameters @@ -297,7 +297,7 @@ See also Element.removeData
Returns: object Element
-Return bounding box for a given element
Parameters @@ -312,7 +312,7 @@ See also Element.removeData
Return coordinates of the point located at the given length on the given path. Only works for element of âpathâ type.
Parameters @@ -326,7 +326,7 @@ See also Element.removeData
Return subpath of a given element from given length to given length. Only works for element of âpathâ type.
Parameters @@ -339,11 +339,11 @@ See also Element.removeData
Returns: string pathstring for the segment
-Returns length of the path in pixels. Only works for element of âpathâ type.
Returns: number length.
-Return set of elements that create glow-like effect around given element. See Paper.set.
Note: Glow is not connected to the element. If you change element attributes it wonât adjust itself. @@ -367,7 +367,7 @@ See also Element.removeData
Makes element invisible. See Element.show.
Returns: object Element
-Adds event handlers for hover for the element.
Parameters
@@ -400,7 +400,7 @@ because all events are fired in format <module>.<action>.<id>
Inserts current object before the given one.
Returns: object Element
-Adds event handler for mousedown for the element.
Parameters
@@ -410,7 +410,7 @@ because all events are fired in format Returns: object Element<module>.<action>.<id>handler for the event
Adds event handler for mousemove for the element.
Parameters
@@ -420,7 +420,7 @@ because all events are fired in format Returns: object Element<module>.<action>.<id>handler for the event
Adds event handler for mouseout for the element.
Parameters
@@ -430,7 +430,7 @@ because all events are fired in format Returns: object Element<module>.<action>.<id>handler for the event
Adds event handler for mouseover for the element.
Parameters
@@ -440,7 +440,7 @@ because all events are fired in format Returns: object Element<module>.<action>.<id>handler for the event
Adds event handler for mouseup for the element.
Parameters @@ -465,7 +465,7 @@ c.node.onclick = function () { c.attr("fill", "red"); }; -
Shortcut for assigning event handler for drag.over.<id>
event, where id is id of the element (see Element.id).
Parameters @@ -485,7 +485,7 @@ c.node.onclick = function () { .attr({stroke: "red"}); } -
Stops animation of the element with ability to resume it later on.
Parameters @@ -513,7 +513,7 @@ c.node.onclick = function () {
Removes element form the paper.
-Removes value associated with an element by given key. If key is not provided, removes all the data of the element.
@@ -525,7 +525,7 @@ If key is not provided, removes all the data of the element.Returns: object Element
-Resumes animation if it was paused with Element.pause method.
Parameters @@ -581,7 +581,7 @@ transformations of the element.
If cx & cy arenât specified centre of the shape is used instead.
Returns: object Element
-Sets the status of animation of the element in milliseconds. Similar to Element.status method.
Parameters @@ -602,7 +602,7 @@ transformations of the element.
Makes element visible. See Element.hide.
Returns: object Element
-Gets or sets the status of animation of the element.
Parameters @@ -626,7 +626,7 @@ transformations of the element.
or
Returns: object original element if value
is specified
Stops animation of the element.
Parameters @@ -645,7 +645,7 @@ transformations of the element.
Moves the element so it is the closest to the viewerâs eyes, on top of other elements.
Returns: object Element
-Adds event handler for touchcancel for the element.
Parameters @@ -655,7 +655,7 @@ transformations of the element.
Returns: object Element
-Adds event handler for touchend for the element.
Parameters @@ -665,7 +665,7 @@ transformations of the element.
Returns: object Element
-Adds event handler for touchmove for the element.
Parameters @@ -675,7 +675,7 @@ transformations of the element.
Returns: object Element
-Adds event handler for touchstart for the element.
Parameters @@ -743,7 +743,7 @@ console.log(el.transform());
Returns: object Element
-Removes event handler for click for the element.
Parameters @@ -753,7 +753,7 @@ console.log(el.transform());
Returns: object Element
-Removes event handler for double click for the element.
Parameters @@ -763,10 +763,10 @@ console.log(el.transform());
Returns: object Element
-Removes all drag event handlers from given element.
-Removes event handlers for hover for the element.
Parameters @@ -779,7 +779,7 @@ console.log(el.transform());
Returns: object Element
-Removes event handler for mousedown for the element.
Parameters @@ -789,7 +789,7 @@ console.log(el.transform());
Returns: object Element
-Removes event handler for mousemove for the element.
Parameters @@ -799,7 +799,7 @@ console.log(el.transform());
Returns: object Element
-Removes event handler for mouseout for the element.
Parameters @@ -809,7 +809,7 @@ console.log(el.transform());
Returns: object Element
-Removes event handler for mouseover for the element.
Parameters @@ -819,7 +819,7 @@ console.log(el.transform());
Returns: object Element
-Removes event handler for mouseup for the element.
Parameters @@ -829,7 +829,7 @@ console.log(el.transform());
Returns: object Element
-Removes event handler for touchcancel for the element.
Parameters @@ -839,7 +839,7 @@ console.log(el.transform());
Returns: object Element
-Removes event handler for touchend for the element.
Parameters @@ -849,7 +849,7 @@ console.log(el.transform());
Returns: object Element
-Removes event handler for touchmove for the element.
Parameters @@ -859,7 +859,7 @@ console.log(el.transform());
Returns: object Element
-Removes event handler for touchstart for the element.
Parameters @@ -870,7 +870,7 @@ console.log(el.transform());
Returns: object Element
Adds given matrix to existing one.
Parameters @@ -897,15 +897,15 @@ console.log(el.transform());
Returns copy of the matrix
Returns: object Matrix
-Returns inverted version of the matrix
Returns: object Matrix
-Rotates the matrix
Parameters @@ -920,7 +920,7 @@ console.log(el.transform());
Scales the matrix
Parameters @@ -941,7 +941,7 @@ console.log(el.transform());
Splits matrix into primitive transformations
Returns: object in format:
@@ -953,11 +953,11 @@ console.log(el.transform());Return transform string that represents given matrix
Returns: string transform string
-Translate the matrix
Parameters @@ -969,7 +969,7 @@ console.log(el.transform());
Return x coordinate for given point after transformation described by the matrix. See also Matrix.y
Parameters @@ -982,7 +982,7 @@ console.log(el.transform());
Returns: number x
-Return y coordinate for given point after transformation described by the matrix. See also Matrix.x
Parameters @@ -996,8 +996,8 @@ console.log(el.transform());
Returns: number y
Imports elements in JSON array in format {type: type, <attributes>}) +
Imports elements in JSON array in format {type: type, <attributes>}
Parameters
@@ -1025,13 +1025,13 @@ console.log(el.transform()); } ]); -Points to the bottom element on the paper
Shortcut for Paper.customAttributes
-Draws a circle.
Parameters @@ -1079,7 +1079,7 @@ paper.customAttributes.hsb = function (h, s, b) { c.attr({hsb: "0.5 .8 1"}); c.animate({hsb: [1, 0, 0.5]}, 1e3); -
Draws an ellipse.
Parameters
@@ -1102,7 +1102,7 @@ c.animate({hsb: [1, 0,
-var c = paper.ellipse(50, 50, 40, 20);
Executes given function for each element on the paper
If callback function returns Returns: object Paper objectfalse
it will stop loop running.
@@ -1117,7 +1117,7 @@ c.animate({hsb: [1, 0, context object for the callback
Returns you element by its internal ID.
Parameters
@@ -1127,7 +1127,7 @@ c.animate({hsb: [1, 0, id
Returns: object Raphaël element object
Returns you topmost element under given point.
Returns: object Raphaël element object
@@ -1144,7 +1144,7 @@ c.animate({hsb: [1, 0,paper.getElementByPoint(mouseX, mouseY).attr({stroke: "#f00"});
-Finds font object in the registered fonts by given parameters. You could specify only one word from the font name, like âMyriadâ for âMyriad Proâ.
Parameters
@@ -1170,7 +1170,7 @@ c.animate({hsb: [1, 0,
-paper.print(100, 100, "Test string", paper.getFont("Times", 800), 30);
Embeds an image into the surface.
Parameters
@@ -1196,7 +1196,7 @@ c.animate({hsb: [1, 0,
-var c = paper.image("apple.png", 10, 10, 80, 80);
Creates a path element by given path data string.
Parameters @@ -1234,7 +1234,7 @@ c.animate({hsb: [1, 0, // draw a diagonal line: // move to 10,10, line to 90,90 -
Creates set of shapes to represent given font at given position with given size. Result of the method is set object (see Paper.set) which contains each letter as separate path object.
@@ -1272,10 +1272,10 @@ Result of the method is set object (see Pap // following line will paint first letter in red txt[0].attr({fill: "#f00"}); -Points to the Raphael object/function
-Draws a rectangle.
@@ -1314,12 +1314,12 @@ txt[0].attr({fill: "#f00"}); on other elements after reflow it could shift half pixel which cause for lines to lost their crispness. This method fixes the issue. -There is an inconvenient rendering bug in Safari (WebKit): sometimes the rendering should be forced. This method should help with dealing with this bug.
-Creates array-like object to keep and operate several elements at once. Warning: it doesnât create any elements for itself in the page, it just groups existing elements. Sets act as pseudo elements â all methods available to an element can be used on a set. @@ -1334,11 +1334,11 @@ st.push( ); st.attr({fill: "red"}); // changes the fill of both circles -
See Paper.setStart. This method finishes catching and returns resulting set.
Returns: object set
-If you need to change dimensions of the canvas call this method
Parameters @@ -1359,7 +1359,7 @@ st.push( ); st.attr({fill: "red"}); -
Creates Paper.set. All elements that will be created after calling this method and before calling Paper.setFinish will be added to the set.
@@ -1371,7 +1371,7 @@ paper.circle(30, 10, = paper.setFinish(); st.attr({fill: "red"}); // changes the fill of both circles -Sets the view box of the paper. Practically it gives you ability to zoom and pan whole paper surface by specifying new boundaries.
@@ -1393,7 +1393,7 @@ specifying new boundaries.true
if you want graphics to fit into new boundary boxDraws a text string. If you need line breaks, put â\nâ in the string.
Parameters @@ -1413,7 +1413,7 @@ specifying new boundaries.
var t = paper.text(50, 50, "Raphaël\nkicks\nbutt!");
-Points to the topmost element on the paper
Returns angle between two or three points
Parameters @@ -1526,7 +1526,7 @@ from this instance will be bound to this canvas.
Returns: number angle in degrees.
-Creates an animation object that can be passed to the Element.animate or Element.animateWith methods. See also Animation.delay and Animation.repeat methods.
@@ -1548,7 +1548,7 @@ See also Animation.delay and callback function. Will be called at the end of animation.Returns: object Animation
-Parses the color string and returns object with all values for the given color.
Parameters
@@ -1568,10 +1568,10 @@ See also Animation.delay and vnumbervalue (brightness),
Returns RFC4122, version 4 ID
-Transform angle to degrees
Parameters
@@ -1581,7 +1581,7 @@ See also Animation.delay and angle in radians
Returns: number angle in degrees.
Object that contains easing formulas for animation. You could extend it with your own. By default it has following list of easing:
See also Easing demo.
-You can add your own method to elements. This is usefull when you want to hack default functionality or want to wrap some common transformation or attributes in one method. In difference to canvas methods, you can redefine element method at any time. Expending element methods wouldnât affect set. @@ -1608,7 +1608,7 @@ you can redefine element method at any time. Expending element methods wouldnâ // then use it paper.circle(100, 100, 20).red(); -
Utility method Find dot coordinates on the given cubic bezier curve at the given t.
@@ -1655,12 +1655,13 @@ Find dot coordinates on the given cubic bezier curve at the given t.You can add your own method to the canvas. For example if you want to draw a pie chart,
you can create your own pie chart function and ship it as a Raphaël plugin. To do this
-you need to extend the Raphael.fn
object. Please note that you can create your own namespaces
-inside the fn
object â methods will be run in the context of canvas anyway. You should alter
-the fn
object before a Raphaël instance is created, otherwise it will take no effect.
+you need to extend the Raphael.fn
object. You should modify the fn
object before a
+Raphaël instance is created, otherwise it will take no effect. Please note that the
+ability for namespaced plugins was removed in Raphael 2.0. It is up to the plugin to
+ensure any namespacing ensures proper context.
Usage
@@ -1679,7 +1680,7 @@ paper.arrow(10, 10,Simple format function. Replaces construction of type â{<number>}
â to the corresponding argument.
Parameters @@ -1699,9 +1700,9 @@ paper.mystuff.star(); width = 40, height = 50; // this will draw a rectangular shape equivalent to "M10,20h40v50h-40z" -paper.path(Raphael.format("M{1},{2}h{3}v{4}h{5}z", x, y, width, height, -width)); +paper.path(Raphael.format("M{0},{1}h{2}v{3}h{4}z", x, y, width, height, -width)); -
A little bit more advanced format function than Raphael.format. Replaces construction of type â{<name>}
â to the corresponding argument.
Parameters @@ -1727,7 +1728,7 @@ paper.path(Raphael.format("M{x},{y}h{dim.width}v{dim.height}h{dim['negative w } })); -
On each call returns next colour in the spectrum. To reset it back to red call Raphael.getColor.reset
Parameters
@@ -1738,10 +1739,10 @@ paper.path(Raphael.format("M{x},{y}h{dim.width}v{dim.height}h{dim['negative w
0.75
Returns: string hex representation of the colour.
-Resets spectrum position for Raphael.getColor back to red.
-Return coordinates of the point located at the given length on the given path.
Parameters
@@ -1758,7 +1759,7 @@ paper.path(Raphael.format("M{x},{y}h{dim.width}v{dim.height}h{dim['negative w
Parses colour string as RGB object
Parameters
@@ -1785,7 +1786,7 @@ paper.path(Raphael.format("M{x},{y}h{dim.width}v{dim.height}h{dim['negative w
Return subpath of a given path from given length to given length.
Parameters
@@ -1801,7 +1802,7 @@ paper.path(Raphael.format("M{x},{y}h{dim.width}v{dim.height}h{dim['negative w
Returns: string pathstring for the segment
-Returns length of the given path in pixels.
Parameters
@@ -1811,7 +1812,7 @@ paper.path(Raphael.format("M{x},{y}h{dim.width}v{dim.height}h{dim['negative w
Returns: number length.
-Converts HSB values to hex representation of the colour.
Parameters
@@ -1827,7 +1828,7 @@ paper.path(Raphael.format("M{x},{y}h{dim.width}v{dim.height}h{dim['negative w
Returns: string hex representation of the colour.
-Converts HSB values to RGB object.
Parameters
@@ -1848,7 +1849,7 @@ paper.path(Raphael.format("M{x},{y}h{dim.width}v{dim.height}h{dim['negative w
Converts HSL values to hex representation of the colour.
Parameters
@@ -1864,7 +1865,7 @@ paper.path(Raphael.format("M{x},{y}h{dim.width}v{dim.height}h{dim['negative w
Returns: string hex representation of the colour.
-Converts HSL values to RGB object.
Parameters
@@ -1885,7 +1886,7 @@ paper.path(Raphael.format("M{x},{y}h{dim.width}v{dim.height}h{dim['negative w
Handfull replacement for typeof
operator.
Parameters
@@ -1898,7 +1899,7 @@ paper.path(Raphael.format("M{x},{y}h{dim.width}v{dim.height}h{dim['negative w
Returns: boolean is given value is of given type
-Utility method Returns matrix based on given parameters.
@@ -1924,7 +1925,7 @@ Returns matrix based on given parameters.Returns: object Matrix
-If you want to leave no trace of Raphaël (Well, Raphaël creates only one global variable Raphael
, but anyway.) You can use ninja
method.
Beware, that in this case plugins could stop working, because they are depending on global variable existance.
Utility method Parses given path string into an array of arrays of path segments.
@@ -1947,7 +1948,7 @@ Parses given path string into an array of arrays of path segments.Returns: array array of segments.
-Utility method Parses given path string into an array of transformations.
@@ -1958,7 +1959,7 @@ Parses given path string into an array of transformations.Returns: array array of transformations.
-Utility method Converts path to a new path where all segments are cubic bezier curves.
@@ -1969,7 +1970,7 @@ Converts path to a new path where all segments are cubic bezier curves.Returns: array array of segments.
-Utility method Converts path to relative form
@@ -1980,7 +1981,7 @@ Converts path to relative formReturns: array array of segments.
-Transform angle to radians
Parameters @@ -1990,7 +1991,7 @@ Converts path to relative form
Returns: number angle in radians.
-Adds given font to the registered set of fonts for Raphaël. Should be used as an internal call from within Cufónâs font file. Returns original parameter, so it could be used with chaining.
@@ -2006,7 +2007,7 @@ Returns original parameter, so it could be used with chaining.Cufon.registerFont(Raphael.registerFont({â¦}));
-Converts RGB values to hex representation of the colour.
Parameters @@ -2022,7 +2023,7 @@ Returns original parameter, so it could be used with chaining.
Returns: string hex representation of the colour.
-Converts RGB values to HSB object.
Parameters @@ -2042,7 +2043,7 @@ Returns original parameter, so it could be used with chaining.
Converts RGB values to HSL object.
Parameters @@ -2062,7 +2063,7 @@ Returns original parameter, so it could be used with chaining.
Used when you need to draw in <iframe>
. Switched window to the iframe one.
Parameters @@ -2071,7 +2072,7 @@ Returns original parameter, so it could be used with chaining.
Snaps given value to given grid.
Parameters @@ -2088,7 +2089,7 @@ Returns original parameter, so it could be used with chaining.
10
.Returns: number adjusted value.
-You can add your own method to elements and sets. It is wise to add a set method for each element method you added, so you will be able to call the same method on sets too. See also Raphael.el. @@ -2116,10 +2117,10 @@ paper.set(paper.circle(100, 100, <
true
if browser supports VML.
Removeds all elements from the set
-Removes given element from the set
Parameters @@ -2129,7 +2130,7 @@ paper.set(paper.circle(100, 100, <
Returns: boolean true
if object was found & removed from the set
Executes given function for each element in the set.
If function returns false
it will stop loop running.
@@ -2144,15 +2145,15 @@ paper.set(paper.circle(100, 100, <
Returns: object Set object
-Removes last element and returns it.
Returns: object element
-Adds each argument to the current set.
Returns: object original element
-Removes given element from the set
Parameters