Skip to content

Feature/export BaseAnimation #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 12, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,40 @@ Example:

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

## How to create custom styled animations

You can import BaseAnimation component and create your custom animation

Example:

```
import { BaseAnimation } from 'animate-css-styled-components';

//create your custom animation
const SlideOutDownAnimation = keyframes`
from {
transform: translate3d(0, 0, 0);
}

to {
visibility: hidden;
transform: translate3d(0, 100%, 0);
}
`;

//extend BaseAnimation component and create
//your custom styled animation
const SlideOutDown = styled(BaseAnimation)`
animation-name: ${SlideOutDownAnimation};
`;

//export your custom styled animation
export default SlideOutDown;
```

now your animation is a styled-component and you can use this like any other styled-component,
passing the all BaseAnimation [props](https://github.com/dielduarte/animate-css-styled-components#props).

# WIP
- tests with jest
- `animate` component, wrapper for all animations with a only component.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "animate-css-styled-components",
"version": "0.0.13",
"version": "0.0.14",
"description": "port of animate.css for styled-components",
"main": "./lib/index.js",
"scripts": {
Expand Down
4 changes: 3 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import BaseAnimation from './BaseAnimation';
import Flash from './Attention/Flash';
import HeadShake from './Attention/HeadShake';
import Jello from './Attention/Jello';
Expand Down Expand Up @@ -164,5 +165,6 @@ export {
ZoomOutDown,
ZoomOutLeft,
ZoomOutRight,
ZoomOutUp
ZoomOutUp,
BaseAnimation
};