aboutsummaryrefslogtreecommitdiffhomepage
path: root/public/bluebey-studio/src/faceArt.js
diff options
context:
space:
mode:
authorYasutake Yohei <61961825+yasutakeyohei@users.noreply.github.com>2026-10-05 13:57:10 +0900
committerYasutake Yohei <61961825+yasutakeyohei@users.noreply.github.com>2026-10-05 13:57:10 +0900
commit4808fc1cd44737200cfd51747a628585185f1f9f (patch)
treedc0d26ec07e119acff78cb67064801fbd8b03a7d /public/bluebey-studio/src/faceArt.js
parentab24d13d2ccce7dad9488d29f85295fecd4e7ad3 (diff)
bluebey-studio: 線の数を目の形に統合し、閉じ目でも目線を効かせる
目の形をふつう/1線/2線/3線/3の目/わらう/ハートにまとめ、線の数メニューを廃止。線・3の目・わらうでも目線で形が動くようにした。
Diffstat (limited to 'public/bluebey-studio/src/faceArt.js')
-rw-r--r--public/bluebey-studio/src/faceArt.js24
1 files changed, 15 insertions, 9 deletions
diff --git a/public/bluebey-studio/src/faceArt.js b/public/bluebey-studio/src/faceArt.js
index 9ed6c83..3eb106f 100644
--- a/public/bluebey-studio/src/faceArt.js
+++ b/public/bluebey-studio/src/faceArt.js
@@ -1399,12 +1399,27 @@ export function drawEyes(ctx, p) {
ctx.restore();
};
+ // Where the pupil is looking. Every eye shape shares it: a shut eye's line, a
+ // 3 or an arch shift with the gaze too, not just the round eyeball.
+ const eyeTravel = isHeart ? heartTravel * lookMax : travel * lookMax;
+ let dx = clamp(spec.lookX ?? 0, -1, 1) * eyeTravel;
+ let dy = -clamp(spec.lookY ?? 0, -1, 1) * eyeTravel;
+ const dist = Math.hypot(dx, dy);
+ if (dist > eyeTravel && dist > 0) {
+ dx = (dx / dist) * eyeTravel;
+ dy = (dy / dist) * eyeTravel;
+ }
+
if (open <= 0.02 || open <= lowerLid + 0.02) {
// A shut eye can still be given a white backing (the "白目" switch), which
// reads as a line drawn across an eyeball rather than a bare line. This also
// catches a lower lid raised past the upper one, which reads as shut too.
if (!line && showWhite) fillCircle(ctx, eye.cx, eye.cy, eye.r, white);
+ // 目線 moves the drawn shape as well, so a shut eye can glance sideways.
+ ctx.save();
+ ctx.translate(dx, dy);
drawShutEye(ctx, eye, spec, lineStyle, shapeScale, shapeHalfLimit);
+ ctx.restore();
// The glasses sit over the shut-eye artwork too, but under the tear below.
drawGlasses(ctx, eye, line, style, limits);
drawTear();
@@ -1418,15 +1433,6 @@ export function drawEyes(ctx, p) {
// iris. While the lid is partly closed the clip is still needed.
if (!isHeart || open < 0.999) clipEye(ctx, eye, open, isHeart ? 0 : lowerLid, lidFlat, lidTilt * eye.towardNose);
- const eyeTravel = isHeart ? heartTravel * lookMax : travel * lookMax;
- let dx = clamp(spec.lookX ?? 0, -1, 1) * eyeTravel;
- let dy = -clamp(spec.lookY ?? 0, -1, 1) * eyeTravel;
- const dist = Math.hypot(dx, dy);
- if (dist > eyeTravel && dist > 0) {
- dx = (dx / dist) * eyeTravel;
- dy = (dy / dist) * eyeTravel;
- }
-
// The white of the eye (see `showWhite` above).
if (!line && showWhite) fillCircle(ctx, eye.cx, eye.cy, eye.r, white);
const irisX = eye.cx + dx;