dkforest

A forum and chat platform (onion)
git clone https://git.dasho.dev/n0tr1v/dkforest.git
Log | Files | Refs | LICENSE

commit 8f17f0103db0f191473cd34e70d8a10b47855e9e
parent c26c18541c7230d0615fe9c878366d299612ca8d
Author: n0tr1v <n0tr1v@protonmail.com>
Date:   Tue,  5 Dec 2023 01:52:35 -0500

cleanup

Diffstat:
Mpkg/web/handlers/poker.go | 19++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/pkg/web/handlers/poker.go b/pkg/web/handlers/poker.go @@ -18,6 +18,11 @@ import ( const NbPlayers = 6 const MaxUserCountdown = 10 const MinTimeAfterGame = 10 +const BackfacingDeg = "-180deg" +const BurnStackX = 400 +const BurnStackY = 30 +const DealerStackX = 250 +const DealerStackY = 30 type Poker struct { sync.Mutex @@ -187,8 +192,8 @@ func (g *PokerGame) Deal(roomID string) { ID: "card" + strconv.Itoa(idx), Name: "", Idx: idx, - Top: 30 + (pos * 2), - Left: 400 + (pos * 4), + Top: BurnStackY + (pos * 2), + Left: BurnStackX + (pos * 4), Burn: true, } PokerPubSub.Pub(myTopic, evt) @@ -589,7 +594,7 @@ body { position: absolute; top: 0; left: 0; - transform: translateX(250px) translateY(30px) rotateY(-180deg); + transform: translateX(` + strconv.Itoa(DealerStackX) + `px) translateY(` + strconv.Itoa(DealerStackY) + `px) rotateY(` + BackfacingDeg + `); transform-style: preserve-3d; backface-visibility: hidden; width:50px; @@ -627,7 +632,7 @@ body { width:100%; height:100%; backface-visibility: hidden; - transform: rotateY( -180deg ); + transform: rotateY(` + BackfacingDeg + `); background: #36c; background: linear-gradient(135deg, #f26c32 0%,#c146a1 50%,#a80077 51%,#f9703e 100%); @@ -697,7 +702,7 @@ body { transform += ` rotateZ(` + payload.Angle + `)` } if payload.Burn { - transform += ` rotateY(-180deg)` + transform += ` rotateY(` + BackfacingDeg + `)` } transform += ";" pokerEvtHtml := `<style> @@ -788,7 +793,7 @@ Loop: continue } else if evt, ok := payload.(PlayerFoldEvent); ok { - transition := `transition: 1s ease-in-out; transform: translateX(400px) translateY(30px) rotateY(-180deg);` + transition := `transition: 1s ease-in-out; transform: translateX(` + strconv.Itoa(BurnStackX) + `px) translateY(` + strconv.Itoa(BurnStackY) + `px) rotateY(` + BackfacingDeg + `);` html := `<style>#card` + strconv.Itoa(evt.Card1Idx) + ` { ` + transition + ` } #card` + strconv.Itoa(evt.Card2Idx) + ` { ` + transition + ` }</style>` send(html) @@ -798,7 +803,7 @@ Loop: } else if _, ok := payload.(ResetCardsEvent); ok { html := `<style>` for i := 1; i <= 52; i++ { - html += `#card` + strconv.Itoa(i) + ` { transition: 1s ease-in-out; transform: translateX(250px) translateY(30px) rotateY(-180deg); } + html += `#card` + strconv.Itoa(i) + ` { transition: 1s ease-in-out; transform: translateX(` + strconv.Itoa(DealerStackX) + `px) translateY(` + strconv.Itoa(DealerStackY) + `px) rotateY(` + BackfacingDeg + `); } #card` + strconv.Itoa(i) + ` .card .inner:before { content: ""; }` } html += `