import { BaseEffect } from './base.js'; | |
export class GoldEffect extends BaseEffect { | |
constructor() { | |
super(); | |
this.strokeOptions = { | |
color: '#b8860b', | |
width: 2 | |
}; | |
} | |
async setupContext(ctx, options) { | |
ctx.font = `${options.fontSize}px "${options.font}"`; | |
ctx.textBaseline = 'top'; | |
// ゴールドグラデーションの作成 | |
const gradient = ctx.createLinearGradient(0, 0, 0, ctx.canvas.height); | |
gradient.addColorStop(0, '#ffd700'); | |
gradient.addColorStop(0.5, '#ffb700'); | |
gradient.addColorStop(1, '#ffd700'); | |
ctx.fillStyle = gradient; | |
} | |
} |