angular-icon-morphing
Version:
Angular library to animate icons with smooth morphing animation
100 lines (70 loc) • 2.03 kB
Markdown
Angular library to animate icons with smooth morphing animation
[](https://angular-icon-morphing.stackblitz.io)
[](https://github.com/rvillain/angular-icon-morphing)
Install npm package
```
npm install --save-dev angular-icon-morphing
```
Add Morpheus library to angular.json scripts
```
{
...
"projects": {
...
"architect": {
"build": {
...
"options": {
...
"scripts": [
"node_modules/svg-morpheus/compile/minified/svg-morpheus.js"
]
},
...
}
}
}
}
```
Import Module
```
...
import { AngularIconMorphingModule } from 'angular-icon-morphing';
@NgModule({
declarations: [
AppComponent,
IconComponent
],
imports: [
BrowserModule,
FormsModule,
AngularIconMorphingModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
```
Use aim-icon component to animate yout svg Icon
```
<aim-icon [active]="isActive">
<svg width="24" height="24">
<g
<g
</svg>
</aim-icon>
```
aim-icon component can be used with some parameters
| Parameter | Description | Default value |
| :---: | :--- | :---: |
| active |boolean triggering animation when its value changes | false |
| easing |string corresponding to animation type. [See complete list of possibilities on live demo stackblitz](https://angular-icon-morphing.stackblitz.io) | linear |
| duration |duration of animation in ms | 250 |
* [SVG-Morpheus](https://github.com/alexk111/SVG-Morpheus/) - The JS library used
* **Rémy Villain** - [rvillain](https://github.com/rvillain)