import { Meta, Story, Canvas } from '@storybook/addon-docs';
import { Button } from '@devseed-ui/button';
import { DevseedUiThemeProvider } from '@devseed-ui/theme-provider';

import { shake, rotateCW, rotateCCW, reveal } from '.';
import { Animate } from './story-animate';

<Meta title="Components/Animation" />

# Animation

The animation package provides simple animations to be used in styled components.

```
yarn add @devseed-ui/animation
```

```js
import {
  shake,
  rotateCW,
  rotateCCW,
  reveal
} from '@devseed-ui/animation'
```

## Example

```jsx
const Shaker = styled.div`
  width: 3rem;
  height: 3rem;
  background-color: teal;

  animation: ${shake} 0.5 linear 1s;
  animation-iteration-count: infinite;
`;

<Shaker />
```

## Showcase

<Canvas>
  <Story name='Showcase'>
    <Animate title="Shake" animation={shake} duration="0.5s" easing="linear" />
    <Animate
      title="Rotate CW"
      animation={rotateCW}
      duration="1s"
      easing="linear"
    />
    <Animate
      title="Rotate CCW"
      animation={rotateCCW}
      duration="1s"
      easing="linear"
    />
    <Animate title="Reveal" animation={reveal} duration="0.64s" easing="ease" />
  </Story>
</Canvas>
