Skip to content

Commit 1d404b1

Browse files
committed
create documentation for how extend BaseAnimation
1 parent 59d7678 commit 1d404b1

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
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.

0 commit comments

Comments
 (0)