top/slightly-improve-stalker-performance #213
|
@ -2,6 +2,8 @@ img.cursor-stalker {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
height: 28px;
|
height: 28px;
|
||||||
width: 28px;
|
width: 28px;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
background-size: 100% auto;
|
background-size: 100% auto;
|
||||||
z-index: 1000000000;
|
z-index: 1000000000;
|
||||||
|
|
|
@ -64,8 +64,9 @@ function stalker(i) {
|
||||||
function placestalker(stalker, x, y) {
|
function placestalker(stalker, x, y) {
|
||||||
stalker.x = x;
|
stalker.x = x;
|
||||||
stalker.y = y;
|
stalker.y = y;
|
||||||
stalker.img.style.left = stalker.x + "px";
|
const left = stalker.x + "px";
|
||||||
stalker.img.style.top = stalker.y + "px";
|
const top = stalker.y + "px";
|
||||||
|
stalker.img.style.transform = `translate(${left}, ${top})`
|
||||||
}
|
}
|
||||||
|
|
||||||
function makeCircle() {
|
function makeCircle() {
|
||||||
|
@ -73,10 +74,9 @@ function makeCircle() {
|
||||||
current -= rotation;
|
current -= rotation;
|
||||||
for (let i = count - 1; i > -1; --i) {
|
for (let i = count - 1; i > -1; --i) {
|
||||||
stalker = stalkers[i];
|
stalker = stalkers[i];
|
||||||
stalker.img.style.top =
|
const top = Math.round(stalker.y + a * Math.sin((current + i) / spacing) - 15) + "px";
|
||||||
Math.round(stalker.y + a * Math.sin((current + i) / spacing) - 15) + "px";
|
const left = Math.round(stalker.x + a * Math.cos((current + i) / spacing)) + "px";
|
||||||
stalker.img.style.left =
|
stalker.img.style.transform = `translate(${left}, ${top})`
|
||||||
Math.round(stalker.x + a * Math.cos((current + i) / spacing)) + "px";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -185,7 +185,7 @@ function updateCardsetBackgrounds(state, complete = false) {
|
||||||
}
|
}
|
||||||
if(complete){
|
if(complete){
|
||||||
const wager = state.has_player_split ? state?.wager?.amount * 2 : state?.wager?.amount;
|
const wager = state.has_player_split ? state?.wager?.amount * 2 : state?.wager?.amount;
|
||||||
let dealerShows = state.payout > wager ? 'WON': 'LOST';
|
let dealerShows = state.payout < wager ? 'WON': 'LOST';
|
||||||
if(state.payout === wager) dealerShows = 'PUSHED'
|
if(state.payout === wager) dealerShows = 'PUSHED'
|
||||||
cardsets[0]?.classList.add(`blackjack-cardset__${dealerShows}`)
|
cardsets[0]?.classList.add(`blackjack-cardset__${dealerShows}`)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue