エフェクトを調整
Browse files- effects/base.js +23 -1
- effects/gold.js +1 -6
- effects/gradient.js +2 -0
- effects/metallic.js +2 -2
- effects/multiline-neon.js +3 -3
- effects/neon.js +4 -10
- postprocess/hue.js +2 -2
effects/base.js
CHANGED
|
@@ -243,6 +243,7 @@ export class BaseEffect {
|
|
| 243 |
ctx.shadowOffsetX = 0;
|
| 244 |
ctx.shadowOffsetY = 0;
|
| 245 |
|
|
|
|
| 246 |
for (let j = 0; j < iterations; j++) {
|
| 247 |
ctx.shadowBlur = blur - (blur * j / iterations);
|
| 248 |
ctx.fillStyle = `rgba(${this.hexToRgb(color)}, ${1/iterations})`;
|
|
@@ -261,8 +262,29 @@ export class BaseEffect {
|
|
| 261 |
}
|
| 262 |
}
|
| 263 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 264 |
|
| 265 |
-
//
|
|
|
|
|
|
|
| 266 |
ctx.shadowBlur = 0;
|
| 267 |
ctx.shadowColor = 'transparent';
|
| 268 |
}
|
|
|
|
| 243 |
ctx.shadowOffsetX = 0;
|
| 244 |
ctx.shadowOffsetY = 0;
|
| 245 |
|
| 246 |
+
// 内側のグロー
|
| 247 |
for (let j = 0; j < iterations; j++) {
|
| 248 |
ctx.shadowBlur = blur - (blur * j / iterations);
|
| 249 |
ctx.fillStyle = `rgba(${this.hexToRgb(color)}, ${1/iterations})`;
|
|
|
|
| 262 |
}
|
| 263 |
}
|
| 264 |
}
|
| 265 |
+
|
| 266 |
+
// 外側の広いグロー
|
| 267 |
+
ctx.globalCompositeOperation = 'lighter';
|
| 268 |
+
ctx.shadowBlur = blur * 1.5;
|
| 269 |
+
ctx.globalAlpha = 0.3;
|
| 270 |
+
|
| 271 |
+
for (const lineCoords of this.coordinates) {
|
| 272 |
+
for (const coord of lineCoords) {
|
| 273 |
+
ctx.save();
|
| 274 |
+
if (coord.rotate) {
|
| 275 |
+
ctx.translate(coord.x, coord.y);
|
| 276 |
+
ctx.rotate(Math.PI/2);
|
| 277 |
+
ctx.fillText(coord.char, -coord.width/2, 0);
|
| 278 |
+
} else {
|
| 279 |
+
ctx.fillText(coord.char, coord.x, coord.y);
|
| 280 |
+
}
|
| 281 |
+
ctx.restore();
|
| 282 |
+
}
|
| 283 |
+
}
|
| 284 |
|
| 285 |
+
// 設定を元に戻す
|
| 286 |
+
ctx.globalCompositeOperation = 'source-over';
|
| 287 |
+
ctx.globalAlpha = 1.0;
|
| 288 |
ctx.shadowBlur = 0;
|
| 289 |
ctx.shadowColor = 'transparent';
|
| 290 |
}
|
effects/gold.js
CHANGED
|
@@ -3,14 +3,9 @@ import { BaseEffect } from './base.js';
|
|
| 3 |
export class GoldEffect extends BaseEffect {
|
| 4 |
constructor() {
|
| 5 |
super();
|
| 6 |
-
this.glowOptions = {
|
| 7 |
-
color: '#ffd700',
|
| 8 |
-
blur: 15,
|
| 9 |
-
iterations: 10
|
| 10 |
-
};
|
| 11 |
this.strokeOptions = {
|
| 12 |
color: '#b8860b',
|
| 13 |
-
width:
|
| 14 |
};
|
| 15 |
}
|
| 16 |
|
|
|
|
| 3 |
export class GoldEffect extends BaseEffect {
|
| 4 |
constructor() {
|
| 5 |
super();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
this.strokeOptions = {
|
| 7 |
color: '#b8860b',
|
| 8 |
+
width: 10
|
| 9 |
};
|
| 10 |
}
|
| 11 |
|
effects/gradient.js
CHANGED
|
@@ -12,7 +12,9 @@ export class GradientEffect extends BaseEffect {
|
|
| 12 |
// グラデーションの作成
|
| 13 |
const gradient = ctx.createLinearGradient(0, 0, ctx.canvas.width, ctx.canvas.height);
|
| 14 |
gradient.addColorStop(0, '#ff0000');
|
|
|
|
| 15 |
gradient.addColorStop(0.5, '#00ff00');
|
|
|
|
| 16 |
gradient.addColorStop(1, '#0000ff');
|
| 17 |
ctx.fillStyle = gradient;
|
| 18 |
}
|
|
|
|
| 12 |
// グラデーションの作成
|
| 13 |
const gradient = ctx.createLinearGradient(0, 0, ctx.canvas.width, ctx.canvas.height);
|
| 14 |
gradient.addColorStop(0, '#ff0000');
|
| 15 |
+
gradient.addColorStop(0.25, '#ffff00');
|
| 16 |
gradient.addColorStop(0.5, '#00ff00');
|
| 17 |
+
gradient.addColorStop(0.75, '#00ffff');
|
| 18 |
gradient.addColorStop(1, '#0000ff');
|
| 19 |
ctx.fillStyle = gradient;
|
| 20 |
}
|
effects/metallic.js
CHANGED
|
@@ -9,8 +9,8 @@ export class MetallicEffect extends BaseEffect {
|
|
| 9 |
iterations: 10
|
| 10 |
};
|
| 11 |
this.strokeOptions = {
|
| 12 |
-
color: '#
|
| 13 |
-
width:
|
| 14 |
};
|
| 15 |
}
|
| 16 |
|
|
|
|
| 9 |
iterations: 10
|
| 10 |
};
|
| 11 |
this.strokeOptions = {
|
| 12 |
+
color: '#4a4a4a',
|
| 13 |
+
width: 5
|
| 14 |
};
|
| 15 |
}
|
| 16 |
|
effects/multiline-neon.js
CHANGED
|
@@ -5,12 +5,12 @@ export class MultilineNeonEffect extends BaseEffect {
|
|
| 5 |
super();
|
| 6 |
this.glowOptions = {
|
| 7 |
color: '#00ffff',
|
| 8 |
-
blur:
|
| 9 |
-
iterations:
|
| 10 |
};
|
| 11 |
this.strokeOptions = {
|
| 12 |
color: '#ffffff',
|
| 13 |
-
width:
|
| 14 |
};
|
| 15 |
}
|
| 16 |
|
|
|
|
| 5 |
super();
|
| 6 |
this.glowOptions = {
|
| 7 |
color: '#00ffff',
|
| 8 |
+
blur: 90,
|
| 9 |
+
iterations: 6
|
| 10 |
};
|
| 11 |
this.strokeOptions = {
|
| 12 |
color: '#ffffff',
|
| 13 |
+
width: 4
|
| 14 |
};
|
| 15 |
}
|
| 16 |
|
effects/neon.js
CHANGED
|
@@ -3,22 +3,16 @@ import { BaseEffect } from './base.js';
|
|
| 3 |
export class NeonEffect extends BaseEffect {
|
| 4 |
constructor() {
|
| 5 |
super();
|
| 6 |
-
// グローエフェクトの設定
|
| 7 |
this.glowOptions = {
|
| 8 |
-
color: '#ff69b4',
|
| 9 |
-
blur:
|
| 10 |
-
iterations:
|
| 11 |
-
};
|
| 12 |
-
// 縁取りの設定
|
| 13 |
-
this.strokeOptions = {
|
| 14 |
-
color: '#ffffff',
|
| 15 |
-
width: 0.5
|
| 16 |
};
|
| 17 |
}
|
| 18 |
|
| 19 |
async setupContext(ctx, options) {
|
| 20 |
ctx.font = `${options.fontSize}px "${options.font}"`;
|
|
|
|
| 21 |
ctx.textBaseline = 'top';
|
| 22 |
-
ctx.fillStyle = '#ff69b4'; // メインのテキストカラー
|
| 23 |
}
|
| 24 |
}
|
|
|
|
| 3 |
export class NeonEffect extends BaseEffect {
|
| 4 |
constructor() {
|
| 5 |
super();
|
|
|
|
| 6 |
this.glowOptions = {
|
| 7 |
+
color: '#ff69b4', // ネオンピンク
|
| 8 |
+
blur: 90,
|
| 9 |
+
iterations: 12
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
};
|
| 11 |
}
|
| 12 |
|
| 13 |
async setupContext(ctx, options) {
|
| 14 |
ctx.font = `${options.fontSize}px "${options.font}"`;
|
| 15 |
+
ctx.fillStyle = '#ff69b4';
|
| 16 |
ctx.textBaseline = 'top';
|
|
|
|
| 17 |
}
|
| 18 |
}
|
postprocess/hue.js
CHANGED
|
@@ -12,8 +12,8 @@ export class HuePostProcess extends BasePostProcess {
|
|
| 12 |
template: `
|
| 13 |
<div class="mb-2">
|
| 14 |
<label class="form-label">色相の変更</label>
|
| 15 |
-
<input type="range" class="form-range" min="0" max="359" value="
|
| 16 |
-
<div class="range-value"><span id="hueRotateValue">
|
| 17 |
</div>
|
| 18 |
`
|
| 19 |
};
|
|
|
|
| 12 |
template: `
|
| 13 |
<div class="mb-2">
|
| 14 |
<label class="form-label">色相の変更</label>
|
| 15 |
+
<input type="range" class="form-range" min="0" max="359" value="180" id="hueRotate">
|
| 16 |
+
<div class="range-value"><span id="hueRotateValue">180</span>°</div>
|
| 17 |
</div>
|
| 18 |
`
|
| 19 |
};
|