UNPKG

ng-cw-v12

Version:

Angular UI Component Library

68 lines (63 loc) 4.31 kB
import * as i0 from '@angular/core'; import { Component, Input, NgModule } from '@angular/core'; class AnimatedGradientTextComponent { constructor() { /** 文本内容 */ this.ncText = ''; /** 动画速度,值越大,动画速度越快 */ this.ncSpeed = 1; /** 渐变颜色数组 */ this.ncColors = ['#ffaa40', '#9c40ff']; /** 渐变方向 */ this.ncDirection = 'horizontal'; } ngOnInit() { } get gradientColors() { if (!this.ncColors || this.ncColors.length <= 1) { return '#ffaa40, #9c40ff, #ffaa40'; } // 将数组展开,最后一项添加第一项以形成循环 return [...this.ncColors, this.ncColors[0]].join(', '); } } AnimatedGradientTextComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: AnimatedGradientTextComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); AnimatedGradientTextComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.5", type: AnimatedGradientTextComponent, selector: "nc-animated-gradient-text", inputs: { ncText: "ncText", ncSpeed: "ncSpeed", ncColors: "ncColors", ncDirection: "ncDirection" }, ngImport: i0, template: "<span style=\"--gradient-colors: {{gradientColors}}; --bg-size: {{ncSpeed * 300}}%;\" \r\n class=\"nc-animate-gradient-text {{ncDirection}}\">\r\n {{ncText}}\r\n</span>", styles: [".nc-animate-gradient-text{display:inline;background-clip:text;-webkit-background-clip:text;color:transparent}.nc-animate-gradient-text.horizontal{background-image:linear-gradient(to right,var(--gradient-colors));background-size:var(--bg-size) 100%;animation:gradient-horizontal 8s ease infinite}.nc-animate-gradient-text.vertical{background-image:linear-gradient(to bottom,var(--gradient-colors));background-size:100% var(--bg-size);animation:gradient-vertical 8s ease infinite}@keyframes gradient-horizontal{0%{background-position:0% 50%}50%{background-position:100% 50%}to{background-position:0% 50%}}@keyframes gradient-vertical{0%{background-position:50% 0}50%{background-position:50% 100%}to{background-position:50% 0}}\n"] }); i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: AnimatedGradientTextComponent, decorators: [{ type: Component, args: [{ selector: 'nc-animated-gradient-text', templateUrl: './animated-gradient-text.component.html', styleUrls: ['./animated-gradient-text.component.less'] }] }], ctorParameters: function () { return []; }, propDecorators: { ncText: [{ type: Input }], ncSpeed: [{ type: Input }], ncColors: [{ type: Input }], ncDirection: [{ type: Input }] } }); class NcAnimatedGradientTextModule { } NcAnimatedGradientTextModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: NcAnimatedGradientTextModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); NcAnimatedGradientTextModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: NcAnimatedGradientTextModule, declarations: [AnimatedGradientTextComponent], exports: [AnimatedGradientTextComponent] }); NcAnimatedGradientTextModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: NcAnimatedGradientTextModule, imports: [[]] }); i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: NcAnimatedGradientTextModule, decorators: [{ type: NgModule, args: [{ declarations: [ AnimatedGradientTextComponent ], imports: [], exports: [ AnimatedGradientTextComponent ] }] }] }); /** * Generated bundle index. Do not edit. */ export { AnimatedGradientTextComponent, NcAnimatedGradientTextModule }; //# sourceMappingURL=ng-cw-v12-animated-gradient-text.js.map