mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-12 15:57:43 +02:00
Use octree with optimizer
This commit is contained in:
@@ -63,7 +63,7 @@ module.exports = class EjectCommand extends Command {
|
||||
imposter = bool()(random);
|
||||
}
|
||||
const text = `${user.username} was${imposter ? ' ' : ' not '}An Imposter.`;
|
||||
const encoder = new GIFEncoder(320, 180);
|
||||
const encoder = new GIFEncoder(320, 180, 'octree', true);
|
||||
const canvas = createCanvas(320, 180);
|
||||
const ctx = canvas.getContext('2d');
|
||||
ctx.textAlign = 'center';
|
||||
|
||||
@@ -45,7 +45,7 @@ module.exports = class FireCommand extends Command {
|
||||
await reactIfAble(msg, msg.author, LOADING_EMOJI_ID, '💬');
|
||||
const { body } = await request.get(avatarURL);
|
||||
const avatar = await loadImage(body);
|
||||
const encoder = new GIFEncoder(avatar.width, avatar.height);
|
||||
const encoder = new GIFEncoder(avatar.width, avatar.height, 'octree', true);
|
||||
const canvas = createCanvas(avatar.width, avatar.height);
|
||||
const ctx = canvas.getContext('2d');
|
||||
encoder.start();
|
||||
|
||||
@@ -51,7 +51,7 @@ module.exports = class MatrixCommand extends Command {
|
||||
await reactIfAble(msg, msg.author, LOADING_EMOJI_ID, '💬');
|
||||
const { body } = await request.get(avatarURL);
|
||||
const avatar = await loadImage(body);
|
||||
const encoder = new GIFEncoder(avatar.width, avatar.height);
|
||||
const encoder = new GIFEncoder(avatar.width, avatar.height, 'octree', true);
|
||||
const canvas = createCanvas(avatar.width, avatar.height);
|
||||
const ctx = canvas.getContext('2d');
|
||||
encoder.start();
|
||||
|
||||
@@ -45,7 +45,7 @@ module.exports = class TriggeredCommand extends Command {
|
||||
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'triggered.png'));
|
||||
const { body } = await request.get(avatarURL);
|
||||
const avatar = await loadImage(body);
|
||||
const encoder = new GIFEncoder(base.width, base.width);
|
||||
const encoder = new GIFEncoder(base.width, base.width, 'octree', true);
|
||||
const canvas = createCanvas(base.width, base.width);
|
||||
const ctx = canvas.getContext('2d');
|
||||
ctx.fillStyle = 'white';
|
||||
|
||||
Reference in New Issue
Block a user