mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
Fix
This commit is contained in:
@@ -392,14 +392,14 @@ module.exports = class CarRaceCommand extends Command {
|
||||
const ctx = canvas.getContext('2d');
|
||||
ctx.drawImage(bg, 0, 0);
|
||||
const oppoCarX = oppoData.spaces < 7 ? -155 + (77 * oppoData.spaces) : bg.width - 155;
|
||||
if (turnWin && turnWin.id === oppoData.user.id) {
|
||||
if (turnWin) {
|
||||
motionBlur(ctx, oppoData.car, oppoCarX, 208, oppoData.car.width, oppoData.car.height);
|
||||
} else {
|
||||
ctx.drawImage(oppoData.car, oppoCarX, 208);
|
||||
}
|
||||
const userCarX = userData.spaces < 7 ? -155 + (77 * userData.spaces) : bg.width - 155;
|
||||
if (turnWin && turnWin.id === userData.user.id) {
|
||||
motionBlur(ctx, userData.car, userCarX, 208, userData.car.width, userData.car.height);
|
||||
if (turnWin) {
|
||||
motionBlur(ctx, userData.car, userCarX, 254, userData.car.width, userData.car.height);
|
||||
} else {
|
||||
ctx.drawImage(userData.car, userCarX, 254);
|
||||
}
|
||||
|
||||
+2
-2
@@ -127,8 +127,8 @@ module.exports = class CanvasUtil {
|
||||
|
||||
static motionBlur(ctx, image, x, y, width, height) {
|
||||
ctx.drawImage(image, x, y, width, height);
|
||||
ctx.globalAlpha = 0.1;
|
||||
for (let i = 0; i < 10; ++i) ctx.drawImage(image, x + i, y, width, height);
|
||||
ctx.globalAlpha = 0.2;
|
||||
for (let i = 0; i < 10; i += 2) ctx.drawImage(image, x + i, y, width, height);
|
||||
ctx.globalAlpha = 1;
|
||||
return ctx;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user