aboutsummaryrefslogtreecommitdiffhomepage
path: root/public/bluebey-studio/src/faceArt.js
diff options
context:
space:
mode:
Diffstat (limited to 'public/bluebey-studio/src/faceArt.js')
-rw-r--r--public/bluebey-studio/src/faceArt.js19
1 files changed, 10 insertions, 9 deletions
diff --git a/public/bluebey-studio/src/faceArt.js b/public/bluebey-studio/src/faceArt.js
index 6a870fa..fab975a 100644
--- a/public/bluebey-studio/src/faceArt.js
+++ b/public/bluebey-studio/src/faceArt.js
@@ -867,11 +867,11 @@ function drawHeadCover(ctx, spec, limits) {
const halfSpan = width / 2;
const boundary = (x) => {
const t = clamp((x - cx) / halfSpan, -1, 1);
- // まえがみ: falls towards the cheeks with a needle pulled down at the centre.
+ // まえがみ: 富士額 / M字 (a widow's peak).
if (shape === 'fringe') {
- const sweep = 420 * t * t;
- const needle = 500 * Math.max(0, 1 - Math.abs(t) * 6);
- return base - 100 + sweep + needle;
+ const m = (1 + Math.cos(2 * Math.PI * t)) / 2;
+ const peak = Math.max(0, 1 - Math.abs(t) * 3);
+ return base + 300 * m + 160 * peak;
}
// はちわれ: the same V upside down - a widow's peak.
if (shape === 'fringe-up') return base - 320 * Math.max(0, 1 - Math.abs(t) * 1.5);
@@ -958,12 +958,13 @@ export function drawHeadCoverWrap(ctx, spec, layout) {
const cx = layout.offsetX + span * 0.5 + clamp(spec.offsetX ?? 0, -600, 600);
const vBound = (x) => {
const t = clamp((x - cx) / half, -1, 1);
- // まえがみ: the hair falls towards the cheeks on both sides (a strong
- // concave sweep) with a narrow needle pulled down at the centre of the head.
+ // まえがみ: 富士額 / M字 (a widow's peak). The hairline comes down at the
+ // centre (the peak) and at the temples, with the corners between receded -
+ // the three peaks and two valleys of an "M". `t` is -1..1 across the front.
if (shape === 'fringe') {
- const sweep = 0.30 * t * t;
- const needle = 0.42 * Math.max(0, 1 - Math.abs(t) * 6);
- return base + sweep + needle;
+ const m = (1 + Math.cos(2 * Math.PI * t)) / 2; // peaks at t = 0, +-1
+ const peak = Math.max(0, 1 - Math.abs(t) * 3); // sharper central point
+ return base + 0.26 * m + 0.12 * peak;
}
// はちわれ: the same V upside down - a widow's peak.
if (shape === 'fringe-up') return base - 0.18 * Math.max(0, 1 - Math.abs(t) * 1.5);