This commit is contained in:
Dragon Fire
2024-03-23 21:12:22 -04:00
parent 110c30ba67
commit 1257e5ac73
+6 -2
View File
@@ -45,10 +45,14 @@ module.exports = class AnimeEyesCommand extends Command {
for (const face of faces) {
const eyeWidth = face.box.width / 5;
const eyeHeight = face.box.height / 5;
const leftEyeX = leftEyeData.x - (eyeWidth / 2);
const leftEyeY = leftEyeData.y - (eyeHeight / 2);
const rightEyeX = rightEyeData.x - (eyeWidth / 2);
const rightEyeY = rightEyeData.y - (eyeHeight / 2);
const leftEyeData = face.keypoints.find(landmark => landmark.name === 'leftEye');
ctx.drawImage(rightEye, leftEyeData.x - eyeWidth, leftEyeData.y - eyeHeight, eyeWidth, eyeHeight);
ctx.drawImage(rightEye, leftEyeX, leftEyeY, eyeWidth, eyeHeight);
const rightEyeData = face.keypoints.find(landmark => landmark.name === 'rightEye');
ctx.drawImage(leftEye, rightEyeData.x - eyeWidth, rightEyeData.y - eyeHeight, eyeWidth, eyeHeight);
ctx.drawImage(leftEye, rightEyeX, rightEyeY, eyeWidth, eyeHeight);
}
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'anime-eyes.png' }] });
}