2021-01-23 04:11:11 +08:00
|
|
|
# font-awesome-animation
|
2021-01-22 03:25:01 +08:00
|
|
|
|
2014-01-22 06:03:43 +08:00
|
|
|
> Simple animations using some CSS3 I found on the web.
|
2021-01-23 04:11:11 +08:00
|
|
|
> Best used on glyphicons like [FontAwesome][]
|
|
|
|
|
|
|
|
![build](https://github.com/l-lin/font-awesome-animation/workflows/build/badge.svg)
|
|
|
|
[![npm](https://img.shields.io/npm/v/font-awesome-animation.svg)][npm-link]
|
|
|
|
[![npm](https://img.shields.io/npm/dm/font-awesome-animation.svg)][npm-link]
|
|
|
|
[![jsdelivr](https://data.jsdelivr.com/v1/package/npm/font-awesome-animation/badge?style=rounded)][cdn-link]
|
2014-01-22 06:03:43 +08:00
|
|
|
|
2021-01-22 03:25:01 +08:00
|
|
|
## Getting started
|
2014-01-22 06:03:43 +08:00
|
|
|
|
2021-01-23 04:11:11 +08:00
|
|
|
Install from NPM:
|
2020-04-01 04:12:54 +08:00
|
|
|
|
|
|
|
```bash
|
2021-01-22 03:25:01 +08:00
|
|
|
npm install font-awesome-animation
|
2014-01-22 06:03:43 +08:00
|
|
|
```
|
|
|
|
|
2021-01-23 04:11:11 +08:00
|
|
|
Or with a CDN:
|
|
|
|
|
|
|
|
[https://www.jsdelivr.com/package/npm/font-awesome-animation][cdn-link]
|
|
|
|
|
|
|
|
Include CSS file in your index.html file:
|
2020-04-01 04:12:54 +08:00
|
|
|
|
2014-01-22 06:03:43 +08:00
|
|
|
```html
|
|
|
|
<link rel="stylesheet" href="font-awesome-animation.min.css">
|
|
|
|
```
|
|
|
|
|
2021-01-22 03:25:01 +08:00
|
|
|
## Usage
|
2021-01-23 04:52:01 +08:00
|
|
|
### On DOM load
|
2021-01-22 03:25:01 +08:00
|
|
|
|
2021-01-23 04:52:01 +08:00
|
|
|
Add the desired CSS class `faa-xxx` along with `animated` to the icon (or any element of your DOM):
|
|
|
|
|
|
|
|
```html
|
|
|
|
<i class="fa fa-wrench faa-wrench animated"></i>
|
|
|
|
```
|
|
|
|
|
2021-01-24 19:20:20 +08:00
|
|
|
<i class="fa fa-wrench faa-wrench animated" style="font-size: 3em;"></i>
|
|
|
|
|
2021-01-23 04:52:01 +08:00
|
|
|
### On hover
|
|
|
|
|
|
|
|
Instead of using `animated`, use the `animated-hover` CSS class:
|
|
|
|
|
|
|
|
```html
|
|
|
|
<i class="fa fa-wrench faa-wrench animated-hover"></i>
|
|
|
|
```
|
|
|
|
|
2021-01-24 19:20:20 +08:00
|
|
|
<i class="fa fa-wrench faa-wrench animated-hover" style="font-size: 3em;"></i>
|
|
|
|
|
2021-01-23 04:52:01 +08:00
|
|
|
### On parent element hover
|
|
|
|
|
|
|
|
For parent hover, add the CSS class `faa-parent` and `animated-hover` on the parent element:
|
|
|
|
|
|
|
|
```html
|
|
|
|
<a href="#" class="faa-parent animated-hover">
|
2021-01-24 19:20:20 +08:00
|
|
|
<i class="fa fa-wrench faa-wrench" style="font-size: 3em;"></i> hover mouse here
|
2021-01-23 04:52:01 +08:00
|
|
|
</a>
|
|
|
|
```
|
|
|
|
|
2021-01-24 19:20:20 +08:00
|
|
|
<a href="#" class="faa-parent animated-hover">
|
|
|
|
<i class="fa fa-wrench faa-wrench" style="font-size: 3em;"></i> hover mouse here
|
|
|
|
</a>
|
|
|
|
|
|
|
|
### Animation speed
|
|
|
|
|
2021-01-23 04:52:01 +08:00
|
|
|
You can regulate the speed of the animation by adding the CSS class `faa-fast` or `faa-slow`:
|
|
|
|
|
|
|
|
```html
|
|
|
|
<i class="fa fa-wrench faa-wrench animated faa-fast"></i>
|
|
|
|
<i class="fa fa-wrench faa-wrench animated faa-slow"></i>
|
|
|
|
```
|
2014-01-22 06:03:43 +08:00
|
|
|
|
2021-01-24 19:20:20 +08:00
|
|
|
<i class="fa fa-wrench faa-wrench animated faa-fast" style="font-size: 3em;"></i> fast
|
|
|
|
<i class="fa fa-wrench faa-wrench animated faa-slow" style="font-size: 3em;"></i> slow
|
|
|
|
|
2021-01-23 17:22:24 +08:00
|
|
|
## Animation list
|
|
|
|
|
2021-01-24 19:27:11 +08:00
|
|
|
Check the [Github page](https://l-lin.github.io/font-awesome-animation/#animation-list) to view the
|
|
|
|
previews.
|
|
|
|
|
2021-01-23 17:22:24 +08:00
|
|
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/css/font-awesome.min.css">
|
2021-01-24 19:40:18 +08:00
|
|
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/font-awesome-animation@1.1.1/css/font-awesome-animation.min.css">
|
2021-01-24 19:20:20 +08:00
|
|
|
<!--link rel="stylesheet" href="http://localhost:8080/css/font-awesome-animation.css"-->
|
|
|
|
|
|
|
|
| Animation | Preview | Fast | Slow |
|
|
|
|
|-----------|---------|------|------|
|
|
|
|
|`faa-wrench`|<i class="fa fa-wrench faa-wrench animated" style="font-size: 2em"></i>|<i class="fa fa-wrench faa-wrench animated faa-fast" style="font-size: 2em"></i>|<i class="fa fa-wrench faa-wrench animated faa-slow" style="font-size: 2em"></i>|
|
|
|
|
|`faa-ring`|<i class="fa fa-bell faa-ring animated" style="font-size: 2em"></i>|<i class="fa fa-bell faa-ring animated faa-fast" style="font-size: 2em"></i>|<i class="fa fa-bell faa-ring animated faa-slow" style="font-size: 2em"></i>|
|
|
|
|
|`faa-horizontal`|<i class="fa fa-envelope faa-horizontal animated" style="font-size:2em"></i>|<i class="fa fa-envelope faa-horizontal animated faa-fast" style="font-size: 2em"></i>|<i class="fa fa-envelope faa-horizontal animated faa-slow" style="font-size: 2em"></i>|
|
|
|
|
|`faa-horizontal faa-reverse`|<i class="fa fa-envelope faa-horizontal animated faa-reverse" style="font-size: 2em"></i>|<i class="fa fa-envelope faa-horizontal animated faa-reverse faa-fast" style="font-size: 2em"></i>|<i class="fa fa-envelope faa-horizontal animated faa-reverse faa-slow" style="font-size: 2em"></i>|
|
|
|
|
|`faa-vertical`|<i class="fa fa-thumbs-o-up faa-vertical animated" style="font-size: 2em"></i>|<i class="fa fa-thumbs-o-up faa-vertical animated faa-fast" style="font-size: 2em"></i>|<i class="fa fa-thumbs-o-up faa-vertical animated faa-slow" style="font-size: 2em"></i>|
|
|
|
|
|`faa-flash`|<i class="fa fa-warning faa-flash animated" style="font-size: 2em"></i>|<i class="fa fa-warning faa-flash animated faa-fast" style="font-size: 2em"></i>|<i class="fa fa-warning faa-flash animated faa-slow" style="font-size: 2em"></i>|
|
|
|
|
|`faa-bounce`|<i class="fa fa-thumbs-o-up faa-bounce animated" style="font-size: 2em"></i>|<i class="fa fa-thumbs-o-up faa-bounce animated faa-fast" style="font-size: 2em"></i>|<i class="fa fa-thumbs-o-up faa-bounce animated faa-slow" style="font-size: 2em"></i>|
|
|
|
|
|`faa-bounce faa-reverse`|<i class="fa fa-thumbs-o-down faa-bounce faa-reverse animated" style="font-size: 2em"></i>|<i class="fa fa-thumbs-o-down faa-bounce faa-reverse animated faa-fast" style="font-size: 2em"></i>|<i class="fa fa-thumbs-o-down faa-bounce faa-reverse animated faa-slow" style="font-size: 2em"></i>|
|
|
|
|
|`faa-spin`|<i class="fa fa-spinner faa-spin animated" style="font-size: 2em"></i>|<i class="fa fa-spinner faa-spin animated faa-fast" style="font-size: 2em"></i>|<i class="fa fa-spinner faa-spin animated faa-slow" style="font-size: 2em"></i>|
|
|
|
|
|`faa-spin faa-reverse`|<i class="fa fa-spinner faa-spin faa-reverse animated" style="font-size: 2em"></i>|<i class="fa fa-spinner faa-spin faa-reverse animated faa-fast" style="font-size: 2em"></i>|<i class="fa fa-spinner faa-spin faa-reverse animated faa-slow" style="font-size: 2em"></i>|
|
|
|
|
|`faa-float`|<i class="fa fa-plane faa-float animated" style="font-size: 2em"></i>|<i class="fa fa-plane faa-float animated faa-fast" style="font-size: 2em"></i>|<i class="fa fa-plane faa-float animated faa-slow" style="font-size: 2em"></i>|
|
|
|
|
|`faa-pulse`|<i class="fa fa-heart faa-pulse animated" style="font-size: 2em"></i>|<i class="fa fa-heart faa-pulse animated faa-fast" style="font-size: 2em"></i>|<i class="fa fa-heart faa-pulse animated faa-slow" style="font-size: 2em"></i>|
|
|
|
|
|`faa-shake`|<i class="fa fa-envelope faa-shake animated" style="font-size: 2em"></i>|<i class="fa fa-envelope faa-shake animated faa-fast" style="font-size: 2em"></i>|<i class="fa fa-envelope faa-shake animated faa-slow" style="font-size: 2em"></i>|
|
|
|
|
|`faa-tada`|<i class="fa fa-trophy faa-tada animated" style="font-size: 2em"></i>|<i class="fa fa-trophy faa-tada animated faa-fast" style="font-size: 2em"></i>|<i class="fa fa-trophy faa-tada animated faa-slow" style="font-size: 2em"></i>|
|
|
|
|
|`faa-passing`|<i class="fa fa-space-shuttle faa-passing animated" style="font-size: 2em"></i>|<i class="fa fa-space-shuttle faa-passing animated faa-fast" style="font-size: 2em"></i>|<i class="fa fa-space-shuttle faa-passing animated faa-slow" style="font-size: 2em"></i>|
|
|
|
|
|`faa-passing faa-reverse`|<i class="fa fa-space-shuttle faa-passing faa-reverse animated" style="font-size: 2em"></i>|<i class="fa fa-space-shuttle faa-passing faa-reverse animated faa-fast" style="font-size: 2em"></i>|<i class="fa fa-space-shuttle faa-passing faa-reverse animated faa-slow" style="font-size: 2em"></i>|
|
|
|
|
|`faa-burst`|<i class="fa fa-circle-o faa-burst animated" style="font-size: 2em"></i>|<i class="fa fa-circle-o faa-burst animated faa-fast" style="font-size: 2em"></i>|<i class="fa fa-circle-o faa-burst animated faa-slow" style="font-size: 2em"></i>|
|
|
|
|
|`faa-falling`|<i class="fa fa-star-o faa-falling animated" style="font-size: 2em"></i>|<i class="fa fa-star-o faa-falling animated faa-fast" style="font-size: 2em"></i>|<i class="fa fa-star-o faa-falling animated faa-slow" style="font-size: 2em"></i>|
|
|
|
|
|`faa-falling faa-reverse`|<i class="fa fa-star-o faa-falling faa-reverse animated" style="font-size: 2em"></i>|<i class="fa fa-star-o faa-falling faa-reverse animated faa-fast" style="font-size: 2em"></i>|<i class="fa fa-star-o faa-falling faa-reverse animated faa-slow" style="font-size: 2em"></i>|
|
|
|
|
|`faa-rising`|<i class="fa fa-star-o faa-rising animated" style="font-size: 2em"></i>|<i class="fa fa-star-o faa-rising animated faa-fast" style="font-size: 2em"></i>|<i class="fa fa-star-o faa-rising animated faa-slow" style="font-size: 2em"></i>|
|
2021-01-23 17:22:24 +08:00
|
|
|
|
2021-01-22 03:25:01 +08:00
|
|
|
## Development
|
2021-01-23 21:13:00 +08:00
|
|
|
### Build
|
2021-01-22 03:25:01 +08:00
|
|
|
|
2020-04-01 04:12:54 +08:00
|
|
|
```bash
|
2021-01-22 03:25:01 +08:00
|
|
|
# install dependencies
|
2020-04-01 04:12:54 +08:00
|
|
|
npm install
|
|
|
|
|
2021-01-22 03:25:01 +08:00
|
|
|
# generate prefixes and minified CSS files
|
|
|
|
npm run build
|
2014-04-17 05:54:21 +08:00
|
|
|
```
|
|
|
|
|
2021-01-23 21:13:00 +08:00
|
|
|
### Local preview
|
|
|
|
|
2021-01-23 21:07:47 +08:00
|
|
|
To test in local, you can use:
|
|
|
|
|
|
|
|
- [http-server][]: server local http server to the `css/` folder
|
|
|
|
- any markdown preview to serve this README.md as a webpage (e.g. [markdown-preview.nvim][])
|
|
|
|
|
2021-01-23 21:13:00 +08:00
|
|
|
### Release
|
|
|
|
|
|
|
|
```sh
|
|
|
|
# this will create a new version and push to remote repository
|
|
|
|
npm version [<newversion> | major | minor | patch]
|
|
|
|
```
|
|
|
|
|
|
|
|
Then go to the [release page](https://github.com/l-lin/font-awesome-animation/releases) and manually
|
|
|
|
create a new release. There is an automatic [Github action](./.github/workflows/publish.yml) that
|
|
|
|
publishes automatically to NPM repository.
|
|
|
|
|
2021-01-22 03:25:01 +08:00
|
|
|
## License
|
|
|
|
|
|
|
|
[MIT License](LICENSE)
|
2020-04-01 04:12:54 +08:00
|
|
|
|
2021-01-23 21:07:47 +08:00
|
|
|
[cdn-link]: https://www.jsdelivr.com/package/npm/font-awesome-animation
|
2021-01-23 04:11:11 +08:00
|
|
|
[FontAwesome]: https://fontawesome.com/
|
2021-01-23 21:07:47 +08:00
|
|
|
[http-server]: https://www.npmjs.com/package/http-server
|
|
|
|
[markdown-preview.nvim]: https://github.com/iamcco/markdown-preview.nvim
|
2021-01-23 04:11:11 +08:00
|
|
|
[npm-link]: https://www.npmjs.com/package/font-awesome-animation
|
|
|
|
|