From 7a2188bd2f9136fb2f8fcfd851c978ec9a65618d Mon Sep 17 00:00:00 2001 From: wout Date: Mon, 11 Feb 2013 16:54:58 +0100 Subject: Added ability to store data() as raw values --- README.md | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'README.md') 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 -- cgit v1.2.3