Skip to content
Open
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
46 changes: 28 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ yarn add animon
Add animon styles from a CDN:

```html
<link rel="stylesheet" href="https://unpkg.com/animon/dist/animon.css"/>
<link rel="stylesheet" href="https://unpkg.com/animon/dist/animon.css" />
```

## Usage
Expand All @@ -30,23 +30,26 @@ Add animon styles from a CDN:

```js
// From node_modules
import { animon } from 'animon';
import { animon } from "animon";
// OR from a CDN
import { animon } from 'https://unpkg.com/animon';
import { animon } from "https://unpkg.com/animon";

// Initialize it with default selector
animon();

// Or with a custom selector
animon('h1');
animon("h1");
```

#### As an IIFE

```html
<script type="text/javascript" src="https://unpkg.com/animon/dist/animon.iife.js"></script>
<script
type="text/javascript"
src="https://unpkg.com/animon/dist/animon.iife.js"
></script>
<script type="text/javascript">
Animon.animon();
Animon.animon();
</script>
```

Expand All @@ -73,28 +76,36 @@ This is the easing function that will be used on the element entrance:

There's a few effects available at the moment:

- fadeIn
- fadeInLeft (default)
- fadeInRight
- fadeInDown
- fadeInUp
- scaleUp
- scaleDown
- fadeIn
- fadeInLeft (default)
- fadeInRight
- fadeInDown
- fadeInUp
- scaleUp
- scaleDown

#### Data-delay

Delays the entrace by `x` milliseconds:

```html
<h1 class="animonItem" data-delay="800">
<h1 class="animonItem" data-delay="800"></h1>
```

#### Data-duration

The transition duration, it must be expressed as a CSS "transition-duration" value (120ms, 2s etc...).

```html
<h1 class="animonItem" data-duration="4s">
<h1 class="animonItem" data-duration="4s"></h1>
```

#### Data-run-once

Prevent animation from being run every time the element appears in the viewport.

```html
<h1 class="animonItem" data-run-once></h1>
```

### Custom effects
Expand All @@ -108,9 +119,8 @@ You may want to start with this:
.animonItem {
opacity: 0;
will-change: opacity, transform;
transition:
opacity 640ms 400ms cubic-bezier(0.5, 1, 0.89, 1),
transform 640ms 400ms cubic-bezier(0.5, 1, 0.89, 1);
transition: opacity 640ms 400ms cubic-bezier(0.5, 1, 0.89, 1), transform
640ms 400ms cubic-bezier(0.5, 1, 0.89, 1);
}
.animonItem.is-visible {
opacity: 1;
Expand Down
2 changes: 1 addition & 1 deletion dist/animon.cjs.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/animon.iife.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions dist/animon.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading