This commit is contained in:
Dragon Fire
2021-01-29 21:20:45 -05:00
parent b21cfbd8d0
commit f7390fe57d
2 changed files with 5 additions and 5 deletions
+3 -3
View File
@@ -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
View File
@@ -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;
}