mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-11-17 14:19:40 +08:00
Only shake on powerlevel 2 or grater
This commit is contained in:
parent
5ce55d91e6
commit
86cbae594b
1 changed files with 13 additions and 8 deletions
|
|
@ -185,14 +185,19 @@ export function addPower(good) {
|
|||
return;
|
||||
|
||||
// Shake
|
||||
$("html").css("overflow", "hidden");
|
||||
const shake = [
|
||||
Math.round(shakeAmount - Math.random() * shakeAmount),
|
||||
Math.round(shakeAmount - Math.random() * shakeAmount),
|
||||
];
|
||||
$(document.body).css("transform", `translate(${shake[0]}px, ${shake[1]}px)`);
|
||||
if (ctx.resetTimeOut) clearTimeout(ctx.resetTimeOut);
|
||||
ctx.resetTimeOut = setTimeout(reset, 2000);
|
||||
if (Config.monkeyPowerLevel > 2) {
|
||||
$("html").css("overflow", "hidden");
|
||||
const shake = [
|
||||
Math.round(shakeAmount - Math.random() * shakeAmount),
|
||||
Math.round(shakeAmount - Math.random() * shakeAmount),
|
||||
];
|
||||
$(document.body).css(
|
||||
"transform",
|
||||
`translate(${shake[0]}px, ${shake[1]}px)`
|
||||
);
|
||||
if (ctx.resetTimeOut) clearTimeout(ctx.resetTimeOut);
|
||||
ctx.resetTimeOut = setTimeout(reset, 2000);
|
||||
}
|
||||
|
||||
// Sparks
|
||||
const offset = ctx.caret.offset();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue