summaryrefslogtreecommitdiffstats
path: root/README.md
diff options
context:
space:
mode:
authorwout <wout@impinc.co.uk>2013-02-11 16:54:58 +0100
committerwout <wout@impinc.co.uk>2013-02-11 16:54:58 +0100
commit7a2188bd2f9136fb2f8fcfd851c978ec9a65618d (patch)
tree93aac094c66e0845b54ba3ae19220eb73941c966 /README.md
parent11fab70a8066e5c7bb0be881b6abb6f90a5c47b0 (diff)
downloadsvg.js-7a2188bd2f9136fb2f8fcfd851c978ec9a65618d.tar.gz
svg.js-7a2188bd2f9136fb2f8fcfd851c978ec9a65618d.zip
Added ability to store data() as raw values
Diffstat (limited to 'README.md')
-rw-r--r--README.md21
1 files changed, 17 insertions, 4 deletions
diff --git a/README.md b/README.md
index e3cc6f0..20bceab 100644
--- a/README.md
+++ b/README.md
@@ -333,18 +333,18 @@ If you include the sugar.js module, `rotate()` and `skew()` will be available as
rect.animate().rotate(45).skew(25, 0);
```
-Animations can be stopped in to ways.
+Animations can be stopped in two ways.
By calling the `stop()` method:
```javascript
-var rectfx = rect.animate().move(200, 200);
+rect.animate().move(200, 200);
-rectfx.stop();
+rect.stop();
```
Or by invoking another animation:
```javascript
-var rectfx = rect.animate().move(200, 200);
+rect.animate().move(200, 200);
rect.animate().center(200, 200);
```
@@ -390,6 +390,13 @@ Like fill, a single hex string will work as well:
rect.stroke('#f06');
```
+### Opacity
+To set the overall opacity of an element:
+
+```javascript
+rect.opacity(0.5);
+```
+
### Rotate
The `rotate()` method will automatically rotate elements according to the center of the element:
@@ -691,6 +698,12 @@ Removing the data altogether:
rect.data('key', null);
```
+Your values will always be stored as JSON and in some cases this might not be desirable. If you want to store the value as-is, just pass true as the third argument:
+
+```javascript
+rect.data('key', 'value', true);
+```
+
## Extending functionality