diff --git a/frontend/src/app/feature/game/coinflip/coinflip.component.css b/frontend/src/app/feature/game/coinflip/coinflip.component.css
new file mode 100644
index 0000000..ba7838c
--- /dev/null
+++ b/frontend/src/app/feature/game/coinflip/coinflip.component.css
@@ -0,0 +1,55 @@
+/* Custom CSS for 3D Transformations and Coin Flip (using animation classes) */
+@keyframes flipToHeads {
+ 0% {
+ transform: rotateY(0deg) rotateX(0deg);
+ }
+ 100% {
+ transform: rotateX(2880deg) rotateY(1440deg);
+ }
+}
+
+@keyframes flipToTails {
+ 0% {
+ transform: rotateY(0deg) rotateX(0deg); /* Start with no rotation */
+ }
+ 100% {
+ transform: rotateX(-2880deg) rotateY(1620deg); /* Example: Reverse X rotation, and land on tails */
+ }
+}
+
+.coin-container {
+ width: 150px; /* Set the size of the coin */
+ height: 150px;
+ perspective: 1000px; /* Adds 3D perspective */
+}
+
+.coin {
+ width: 100%;
+ height: 100%;
+ position: relative;
+ transform-style: preserve-3d; /* Crucial for 3D transformations */
+}
+
+.coin-side {
+ /* Common styles for both front and back */
+ width: 100%;
+ height: 100%;
+ position: absolute;
+ backface-visibility: hidden; /* Hide the back of both sides initially */
+ border-radius: 50%; /* Make it circular */
+}
+
+.back {
+ transform: rotateY(
+ 180deg
+ ); /* Rotate the back to face the opposite direction (Y-axis for horizontal flip) */
+}
+
+/* Classes to trigger the specific animation */
+.coin.animate-to-heads {
+ animation: flipToHeads 1s ease-in-out forwards; /* Apply the animation */
+}
+
+.coin.animate-to-tails {
+ animation: flipToTails 1s ease-in-out forwards; /* Apply the animation */
+}
diff --git a/frontend/src/app/feature/game/coinflip/coinflip.component.html b/frontend/src/app/feature/game/coinflip/coinflip.component.html
index 872800b..8d2c78a 100644
--- a/frontend/src/app/feature/game/coinflip/coinflip.component.html
+++ b/frontend/src/app/feature/game/coinflip/coinflip.component.html
@@ -2,15 +2,68 @@
-
+
+
+
+
+ Heads
+
+
+ Tails
+
+
+
+
+
+
+
+
-
+
+
Spiel Informationen
+
+
+
Aktuelle Wette:
+
0 ? 'text-accent-red' : 'text-text-secondary'">
+
+
+
+
+ @if (!gameInProgress()) {
+
+
+
+
+
+
+ }
+
+
+
+
diff --git a/frontend/src/app/feature/game/coinflip/coinflip.component.ts b/frontend/src/app/feature/game/coinflip/coinflip.component.ts
index f79f320..64bbeab 100644
--- a/frontend/src/app/feature/game/coinflip/coinflip.component.ts
+++ b/frontend/src/app/feature/game/coinflip/coinflip.component.ts
@@ -1,4 +1,7 @@
+import { CurrencyPipe } from '@angular/common';
+import { HttpClient } from '@angular/common/http';
import { ChangeDetectionStrategy, Component, inject, OnInit, signal } from '@angular/core';
+import { AnimatedNumberComponent } from '@blackjack/components/animated-number/animated-number.component';
import { GameInfoComponent } from '@blackjack/components/game-info/game-info.component';
import { AuthService } from '@service/auth.service';
import { AudioService } from '@shared/services/audio.service';
@@ -6,8 +9,9 @@ import { AudioService } from '@shared/services/audio.service';
@Component({
selector: 'app-coinflip',
standalone: true,
- imports: [GameInfoComponent],
+ imports: [AnimatedNumberComponent, CurrencyPipe],
templateUrl: './coinflip.component.html',
+ styleUrl: './coinflip.component.css',
changeDetection: ChangeDetectionStrategy.OnPush,
})
export default class CoinflipComponent implements OnInit {
@@ -18,9 +22,23 @@ export default class CoinflipComponent implements OnInit {
audioService = inject(AudioService);
authService = inject(AuthService);
+ private http = inject(HttpClient);
+
+ setBetAmount(amount: number) {
+ this.currentBet.update((current) => current * amount);
+ }
+
onNewGame(bet: number): void {
this.isActionInProgress.set(true);
this.audioService.playBetSound();
+ this.currentBet.set(bet);
+ }
+
+ betHeads() {
+ this.gameInProgress.set(true);
+ }
+ betTails() {
+ this.gameInProgress.set(true);
}
ngOnInit(): void {
diff --git a/frontend/src/app/feature/game/coinflip/models/coinflip.model.ts b/frontend/src/app/feature/game/coinflip/models/coinflip.model.ts
new file mode 100644
index 0000000..241fcf6
--- /dev/null
+++ b/frontend/src/app/feature/game/coinflip/models/coinflip.model.ts
@@ -0,0 +1,5 @@
+export interface CoinflipGame {
+ isWin: boolean;
+ payout: number;
+ coinSide: string;
+}