mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-11 15:57:50 +02:00
Make anime eyes smaller
This commit is contained in:
@@ -54,20 +54,20 @@ module.exports = class AnimeEyesCommand extends Command {
|
|||||||
const leftHeight = leftEye.height * leftRatio;
|
const leftHeight = leftEye.height * leftRatio;
|
||||||
ctx.drawImage(
|
ctx.drawImage(
|
||||||
leftEye,
|
leftEye,
|
||||||
landmarks.left_eye_left_corner.x - (leftWidth / 2),
|
landmarks.left_eye_left_corner.x - (leftWidth * 0.25),
|
||||||
landmarks.left_eye_left_corner.y - (leftHeight / 2) - (leftHeight / 2),
|
landmarks.left_eye_left_corner.y - (leftHeight / 2) - (leftHeight * 0.25),
|
||||||
leftWidth * 2,
|
leftWidth * 1.5,
|
||||||
leftHeight * 2
|
leftHeight * 1.5
|
||||||
);
|
);
|
||||||
const rightWidth = landmarks.right_eye_right_corner.x - landmarks.right_eye_left_corner.x;
|
const rightWidth = landmarks.right_eye_right_corner.x - landmarks.right_eye_left_corner.x;
|
||||||
const rightRatio = rightWidth / rightEye.width;
|
const rightRatio = rightWidth / rightEye.width;
|
||||||
const rightHeight = rightEye.height * rightRatio;
|
const rightHeight = rightEye.height * rightRatio;
|
||||||
ctx.drawImage(
|
ctx.drawImage(
|
||||||
rightEye,
|
rightEye,
|
||||||
landmarks.right_eye_left_corner.x - (rightWidth / 2),
|
landmarks.right_eye_left_corner.x - (rightWidth * 0.25),
|
||||||
landmarks.right_eye_left_corner.y - (rightHeight / 2) - (rightHeight / 2),
|
landmarks.right_eye_left_corner.y - (rightHeight / 2) - (rightHeight * 0.25),
|
||||||
rightWidth * 2,
|
rightWidth * 1.5,
|
||||||
rightHeight * 2
|
rightHeight * 1.5
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'anime-eyes.png' }] });
|
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'anime-eyes.png' }] });
|
||||||
|
|||||||
Reference in New Issue
Block a user