mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-26 22:32:52 +02:00
Squish in pet
This commit is contained in:
@@ -43,14 +43,17 @@ module.exports = class PetCommand extends Command {
|
|||||||
encoder.setDelay(20);
|
encoder.setDelay(20);
|
||||||
encoder.setQuality(200);
|
encoder.setQuality(200);
|
||||||
encoder.setTransparent('#000000');
|
encoder.setTransparent('#000000');
|
||||||
|
let squish = 0;
|
||||||
for (let i = 0; i < frameCount; i++) {
|
for (let i = 0; i < frameCount; i++) {
|
||||||
const frameID = `frame_${i.toString().padStart(2, '0')}.png`;
|
const frameID = `frame_${i.toString().padStart(2, '0')}.png`;
|
||||||
const frame = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'pet', frameID));
|
const frame = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'pet', frameID));
|
||||||
const { x, y, width, height } = centerImagePart(data, 75, 75, 27, 38);
|
const { x, y, width, height } = centerImagePart(data, 75, 75, 27, 38);
|
||||||
ctx.drawImage(data, x, y, width, height);
|
ctx.drawImage(data, x, y + squish, width, height - squish);
|
||||||
ctx.drawImage(frame, 0, 0);
|
ctx.drawImage(frame, 0, 0);
|
||||||
encoder.addFrame(ctx);
|
encoder.addFrame(ctx);
|
||||||
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
||||||
|
if (i + 1 > frameCount / 2) squish -= 3;
|
||||||
|
else squish += 3;
|
||||||
}
|
}
|
||||||
encoder.finish();
|
encoder.finish();
|
||||||
const buffer = await streamToArray(stream);
|
const buffer = await streamToArray(stream);
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "xiao",
|
"name": "xiao",
|
||||||
"version": "124.5.3",
|
"version": "124.5.4",
|
||||||
"description": "Your personal server companion.",
|
"description": "Your personal server companion.",
|
||||||
"main": "Xiao.js",
|
"main": "Xiao.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
Reference in New Issue
Block a user