Skip to content

Commit 421f7ca

Browse files
authored
Merge pull request #4 from dielduarte/feature/export-BaseAnimation
Feature/export BaseAnimation
2 parents eaff351 + a80707b commit 421f7ca

File tree

3 files changed

+38
-2
lines changed

3 files changed

+38
-2
lines changed

README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,40 @@ Example:
6565

6666
See all examples [here](https://dielduarte.github.io/animate-css-styled-components/)
6767

68+
## How to create custom styled animations
69+
70+
You can import BaseAnimation component and create your custom animation
71+
72+
Example:
73+
74+
```
75+
import { BaseAnimation } from 'animate-css-styled-components';
76+
77+
//create your custom animation
78+
const SlideOutDownAnimation = keyframes`
79+
from {
80+
transform: translate3d(0, 0, 0);
81+
}
82+
83+
to {
84+
visibility: hidden;
85+
transform: translate3d(0, 100%, 0);
86+
}
87+
`;
88+
89+
//extend BaseAnimation component and create
90+
//your custom styled animation
91+
const SlideOutDown = styled(BaseAnimation)`
92+
animation-name: ${SlideOutDownAnimation};
93+
`;
94+
95+
//export your custom styled animation
96+
export default SlideOutDown;
97+
```
98+
99+
now your animation is a styled-component and you can use this like any other styled-component,
100+
passing the all BaseAnimation [props](https://github.com/dielduarte/animate-css-styled-components#props).
101+
68102
# WIP
69103
- tests with jest
70104
- `animate` component, wrapper for all animations with a only component.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "animate-css-styled-components",
3-
"version": "0.0.13",
3+
"version": "0.0.14",
44
"description": "port of animate.css for styled-components",
55
"main": "./lib/index.js",
66
"scripts": {

src/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import BaseAnimation from './BaseAnimation';
12
import Flash from './Attention/Flash';
23
import HeadShake from './Attention/HeadShake';
34
import Jello from './Attention/Jello';
@@ -164,5 +165,6 @@ export {
164165
ZoomOutDown,
165166
ZoomOutLeft,
166167
ZoomOutRight,
167-
ZoomOutUp
168+
ZoomOutUp,
169+
BaseAnimation
168170
};

0 commit comments

Comments
 (0)