|
import { BaseEffect } from './base.js'; |
|
|
|
export class MultilineNeonEffect extends BaseEffect { |
|
constructor() { |
|
super(); |
|
this.glowOptions = { |
|
color: '#00ffff', |
|
blur: 25, |
|
iterations: 25 |
|
}; |
|
this.strokeOptions = { |
|
color: '#ffffff', |
|
width: 0.5 |
|
}; |
|
} |
|
|
|
async setupContext(ctx, options) { |
|
ctx.font = `${options.fontSize}px "${options.font}"`; |
|
ctx.textBaseline = 'top'; |
|
ctx.fillStyle = '#00ffff'; |
|
} |
|
|
|
async applySpecialEffect(ctx, canvas, options) { |
|
|
|
ctx.globalCompositeOperation = 'lighter'; |
|
ctx.shadowBlur = 10; |
|
ctx.shadowColor = '#00ffff'; |
|
ctx.globalAlpha = 0.3; |
|
|
|
|
|
await this.renderMainText(ctx); |
|
|
|
|
|
ctx.globalCompositeOperation = 'source-over'; |
|
ctx.shadowBlur = 0; |
|
ctx.globalAlpha = 1.0; |
|
} |
|
} |