Make anime eyes smaller

This commit is contained in:
Dragon Fire
2021-03-07 14:47:21 -05:00
parent 6a13f01068
commit 32fa24b0d3
+8 -8
View File
@@ -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' }] });