diff options
author | wout <wout@impinc.co.uk> | 2013-06-09 13:36:16 +0100 |
---|---|---|
committer | wout <wout@impinc.co.uk> | 2013-06-09 13:36:16 +0100 |
commit | 30564bf1d40ee2d0299b266fba95fabcec9dc78d (patch) | |
tree | 11521f943c681ba7d3d2b53922942cad2ebeca64 /README.md | |
parent | f370aa5518b19340785ce61d7b7b16ed0919e32e (diff) | |
download | svg.js-30564bf1d40ee2d0299b266fba95fabcec9dc78d.tar.gz svg.js-30564bf1d40ee2d0299b266fba95fabcec9dc78d.zip |
Added to() method in the SVG.FX
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -640,6 +640,19 @@ rect.animate(3000).move(100, 100).during(function(pos, morph) { }) ``` +### Controlling animations externally +Say you want to control the position of an animation with an external event than the `to()` method will proove very useful: + +```javascript +var animate = draw.rect(100, 100).move(50, 50).animate('=').move(200, 200) + +document.onmousemove = function(event) { + animate.to(event.clientX / 1000) +} +``` + +In order to be able use the `to()` method the duration of the animation should be set to `'='`. The value passed as the first argument of `to()` should be a number between `0` and `1`, `0` being the beginning of the animation and `1` being the end. Note that any values below `0` and above `1` will be normalized. + ### After animation callback Finally, you can add callback methods using `after()`: |