angular-icon-morphing
Version:
Angular library to animate icons with smooth morphing animation
2 lines • 1.98 kB
JavaScript
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core")):"function"==typeof define&&define.amd?define("angular-icon-morphing",["exports","@angular/core"],t):t((n=n||self)["angular-icon-morphing"]={},n.ng.core)}(this,(function(n,t){"use strict";var e=function(){};e.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new e},token:e,providedIn:"root"}),e.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],e.ctorParameters=function(){return[]};var o=function(){function n(){this.easing="linear",this.duration=250,this.containerId="ic-"+Math.floor(1e6*Math.random())}return n.prototype.ngOnInit=function(){},n.prototype.ngAfterContentInit=function(){this.startIcon.nativeElement.id="startIcon",this.endIcon.nativeElement.id="endIcon",this.iconContainer.nativeElement.id=this.containerId,this.svgMorpheus=new SVGMorpheus("#"+this.containerId+" svg",{iconId:"startIcon"})},n.prototype.ngOnChanges=function(n){n.active&&this.doTransition()},n.prototype.doTransition=function(){if(this.svgMorpheus){var n=this.active?"endIcon":"startIcon";this.svgMorpheus.to(n,{duration:this.duration,easing:this.easing,rotation:"none"},null)}},n}();o.decorators=[{type:t.Component,args:[{selector:"aim-icon",template:"<div #iconContainer>\r\n <ng-content></ng-content>\r\n</div>",styles:[".hidden{display:none}"]}]}],o.ctorParameters=function(){return[]},o.propDecorators={startIcon:[{type:t.ContentChild,args:["startIcon",{static:!0}]}],endIcon:[{type:t.ContentChild,args:["endIcon",{static:!0}]}],iconContainer:[{type:t.ViewChild,args:["iconContainer",{static:!0}]}],active:[{type:t.Input}],easing:[{type:t.Input}],duration:[{type:t.Input}]};var i=function(){};i.decorators=[{type:t.NgModule,args:[{declarations:[o],imports:[],exports:[o]}]}],n.AngularIconMorphingModule=i,n.AngularIconMorphingService=e,n.IconComponent=o,Object.defineProperty(n,"__esModule",{value:!0})}));
//# sourceMappingURL=angular-icon-morphing.umd.min.js.map