Skip to content

Commit f977d8c

Browse files
committed
add docs
1 parent 0768f8a commit f977d8c

1 file changed

Lines changed: 85 additions & 0 deletions

File tree

Readme.md

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,90 @@
11
# React Keyframes
22

3+
A React component for creating frame-based animations.
4+
5+
## Example
6+
7+
The following example will render contents in `Frame` one at a time every 500 ms.
8+
9+
```js
10+
import { render } from 'react-dom';
11+
import { KeyFrames, Frame } from 'react-keyframes';
12+
13+
render(
14+
<Keyframes>
15+
<Frame duration={500}>This</Frame>
16+
<Frame duration={500}>This is</Frame>
17+
<Frame duration={500}>This is <em>animated</em>.</Frame>
18+
</Keyframes>,
19+
document.getElementById('container')
20+
);
21+
```
22+
23+
## Documentation
24+
25+
### Installation
26+
27+
```js
28+
$ npm install react-keyframes --save
29+
```
30+
31+
### API
32+
33+
#### KeyFrames
34+
**`<KeyFrames { component = 'span', delay = 0, onStart, onEnd } />`**
35+
36+
- Use `import { KeyFrames } from 'react-keyframes'` or `require('react-keyframes').KeyFrames`.
37+
- The `component` prop specifies what component `KeyFrames` renders as.
38+
- The `delay` prop specifies when the animation should start (millisecond).
39+
- The `onStart` function is invoked upon animation start
40+
- The `onEnd` function is invoked upon animation end
41+
- Any additional, user-defined properties will become properties of the rendered component.
42+
- It must have only `Frame` as children.
43+
- Example:
44+
45+
```js
46+
import { Component } from 'react';
47+
import { Keyframes, Frame } from 'react-keyframes';
48+
49+
class extends Component {
50+
render () {
51+
return <KeyFrames component="pre" delay={300} className="animation-test">
52+
<Frame>foo</Frame>
53+
<Frame>bar</Frame>
54+
</KeyFrames>;
55+
}
56+
}
57+
```
58+
59+
#### Frame
60+
61+
**`<Frame { duration = 0 } />`**
62+
63+
- Use `import { Frame } from 'react-keyframes'` or `require('react-keyframes').Frame`.
64+
- The `duration` prop specifies the length of time that a frame should show (millisecond).
65+
- Example:
66+
67+
```js
68+
import { Component } from 'react';
69+
import { Keyframes, Frame } from 'react-keyframes';
70+
71+
class extends Component {
72+
render () {
73+
return <KeyFrames>
74+
<Frame duration={100}>foo</Frame>
75+
<Frame duration={200}>bar</Frame>
76+
</KeyFrames>;
77+
}
78+
}
79+
```
80+
81+
### Contributing
82+
83+
- Run `gulp help` to see available tasks.
84+
- Before submitting a PR, please run `gulp lint` and `npm test`.
85+
- We use [`standard`](https://github.com/feross/standard) + semicolons.
86+
- Please [be welcoming](http://contributor-covenant.org/).
87+
388
## Credits
489

590
- Copyright © 2016 Zeit, Inc and project authors.

0 commit comments

Comments
 (0)