summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwout <wout@impinc.co.uk>2012-12-30 11:20:41 +0100
committerwout <wout@impinc.co.uk>2012-12-30 11:20:41 +0100
commit44be0ceecb2ba43ab45d7fefa299179ae76303fa (patch)
tree00bdc9085c891d667e248f89e674870f2dc15c84
parent68367e494fcab754ae4833e64804a824032cf31c (diff)
downloadsvg.js-44be0ceecb2ba43ab45d7fefa299179ae76303fa.tar.gz
svg.js-44be0ceecb2ba43ab45d7fefa299179ae76303fa.zip
Updated REAME
-rw-r--r--README.md13
1 files changed, 9 insertions, 4 deletions
diff --git a/README.md b/README.md
index 272cce9..8977c1a 100644
--- a/README.md
+++ b/README.md
@@ -389,6 +389,7 @@ _This functionality requires the gradient.js module which is included in the def
## Extending functionality
Svg.js has a modular structure. It is very easy to add you own methods at different levels. Let's say we want to add a method to all shape types then we would add our method to SVG.Shape:
+
```javascript
SVG.extend(SVG.Shape, {
@@ -398,23 +399,27 @@ SVG.extend(SVG.Shape, {
});
```
-Now all shapes will have the paintRed method available. Say we want to have the paintRed method on a circle apply a slightly different color:
+
+Now all shapes will have the paintRed method available. Say we want to have the paintRed method on an ellipse apply a slightly different color:
+
```javascript
-SVG.extend(SVG.Circle, {
+SVG.extend(SVG.Ellipse, {
paintRed: function() {
return this.fill({ color: 'orangered' });
}
});
+
```
-The complete inheritance stack for `SVG.Circle` is:
+The complete inheritance stack for `SVG.Ellipse` is:
-_SVG.Circle < SVG.Shape < SVG.Element_
+_SVG.Ellipse < SVG.Shape < SVG.Element_
The SVG document can be extended by using:
```javascript
+
SVG.extend(SVG.Doc, {
paintAllPink: function() {