VueJS directive for animate font awesome icons.
yarn fa-animate
or
npm install fa-animate
import faAnimate from 'fa-animate';
<script>
export default {
...
directives: {
faAnimate,
},
...
}
</script>
import Vue from 'vue'
import App from './App.vue'
import faAnimate from 'fa-animate/dist/fa-animate.common.js';
Vue.use(faAnimate);
new Vue({
el: '#app',
render: h => h(App)
})
</script>
<template>
<div>
<font-awesome-icon icon="bomb" id="test-icon" v-fa-animate="animateOptions" />
</div>
</template>
<script>
import { library } from "@fortawesome/fontawesome-svg-core";
import { faBomb } from "@fortawesome/free-solid-svg-icons/faBomb";
import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome";
library.add(faBomb);
export default {
components: {
FontAwesomeIcon
},
data() {
return {
animateOptions: {
type: "delayed",
duration: 200
}
};
}
};
</script>
You can passed options for directive:
Name | Type | Description | Default |
---|---|---|---|
stroke |
string | Stroke color | 'currentColor' |
fill |
string | Fill color | 'transparent' |
strokeWidth |
integer | Stroke width | 1 |
All Vivus options are available. Version 0.1 not suported callback function
A big thanks to:
- Vivus for the SVG animation library!
- Font Awesome for the awesome SVG icons!
- innovato for good idea!