From c13b6979e35396f2cfbc2a1965a54517d3e6c23e Mon Sep 17 00:00:00 2001 From: zhaofuyun Date: Wed, 14 Mar 2018 23:00:32 +0800 Subject: [PATCH] docs: update readme --- readme.md | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/readme.md b/readme.md index 92e83f7..93cd2ff 100644 --- a/readme.md +++ b/readme.md @@ -1,7 +1,21 @@ -# animation +# Animation -A lightweight JavaScript animation library. -You could use like this [demo](https://holyzfy.github.io/animation/demo.html). +A lightweight JavaScript animation library. You could use like this [demo](https://holyzfy.github.io/animation/demo.html). + +## Demo + +```js +animation.parallel('#elem-1', 'div.elem-2', document.querySelector('.elem-3')) + .then(function () { + return animation.series(document.querySelectorAll('.demo-xxx')); + }) + .then(function () { + return animation.race('#demo-4', '#demo-5'); + }) + .then(function () { + alert('done'); + }); +``` ## API @@ -24,7 +38,7 @@ Returns a promise that resolves as soon as one of the animations of the `targets #### Parameters -The `targets` property defines the elements to animate. +The `targets` property defines the elements to animate, you can use the flowing types: - CSS Selectors - DOM Element