diff --git a/public/media/hearts.gif b/public/media/hearts.gif new file mode 100644 index 0000000..4dbe5e7 Binary files /dev/null and b/public/media/hearts.gif differ diff --git a/public/media/shine.gif b/public/media/shine.gif new file mode 100644 index 0000000..01523c5 Binary files /dev/null and b/public/media/shine.gif differ diff --git a/public/script/reproduction.js b/public/script/reproduction.js index 587438a..1eb69ea 100644 --- a/public/script/reproduction.js +++ b/public/script/reproduction.js @@ -1,10 +1,9 @@ document.addEventListener('DOMContentLoaded', () => { const left = document.querySelector('.left-emoji'); const right = document.querySelector('.right-emoji'); - const winnerText = document.getElementById('winner-text'); + const childText = document.getElementById('child-text'); + const heartGif = document.getElementById('heart-gif'); - const winnerSide = window.winnerSide; - const loserSide = window.loserSide; function insertEmojiOrImage(el) { const value = el.dataset.content; @@ -24,31 +23,30 @@ document.addEventListener('DOMContentLoaded', () => { left.classList.add('slide-in-left'); right.classList.add('slide-in-right'); - setTimeout(() => { - left.style.left = '100px'; - right.style.left = '300px'; - - left.classList.add('fight-animation'); - right.classList.add('fight-animation'); - - setTimeout(() => { - left.classList.remove('fight-animation'); - right.classList.remove('fight-animation'); - - const loser = loserSide === 'left' ? left : right; - loser.classList.add('loser-fly-up'); - const winner = winnerSide === 'left' ? left : right; - winner.classList.add('winner-center', 'winner-crown'); - let name = winner.dataset.content; - //check if name is an image URL or an emoji - if (/^https?:\/\//.test(name)) { - winnerText.innerHTML = `a gagné ! 🎉`; - } - else { - winnerText.textContent = `${name} a gagné ! 🎉`; + setTimeout(() => { + + + if (/^https?:\/\//.test(child_emoji)) { + emojiHtml = ` +
+ +
`; + } else { + emojiHtml = ` + ${child_emoji}`; } - winnerText.style.display = 'block'; - }, 1500); + + childText.innerHTML = ` +
+ ${emojiHtml} + +
`; + childText.classList.add('growing-animation'); + childText.style.display = 'block'; + heartGif.style.display = 'block'; + heartGif.classList.add('fade-in'); + + }, 3000); }); diff --git a/public/style/reproduction.css b/public/style/reproduction.css index 0031041..f24658d 100644 --- a/public/style/reproduction.css +++ b/public/style/reproduction.css @@ -43,12 +43,14 @@ body { @keyframes slideInLeft { to { left: 200px; + opacity:0; } } @keyframes slideInRight { to { left: 200px; + opacity:0; } } @@ -60,9 +62,6 @@ body { animation: slideInRight 3s forwards; } -.fight-animation { - animation: fightShake 0.5s 3; -} @keyframes Fade { to { @@ -70,18 +69,86 @@ body { } } -.fadingAnimation { +.fading-animation { animation: Fade 3s forwards; } -@keyframes moveToCenter { +@keyframes growing { to { - left: 50%; - transform: translate(-50%, -50%); + transform: scale(5); } } -.loving-animation { - animation: moveToCenter 1s forwards; +.growing-animation { + animation: growing 5s forwards; +} + +#child-text { + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + display: flex; + justify-content: center; + align-items: center; + text-align: center; + flex-direction: column; +} + +.emoji-wrapper { + display: flex; + flex-direction: column; + align-items: center; +} + +.emoji-glow-text { + position: relative; + display: inline-block; + font-size: 5rem; } + +.emoji-glow-text::before { + content: attr(data-emoji); + position: absolute; + top: 0; + left: 0; + filter: blur(1px) brightness(10); + opacity: 0.9; + z-index: -1; +} + +.emoji-glow-img { + position: relative; + display: inline-block; +} + +.emoji-glow-img::before { + content: ""; + position: absolute; + top: 0; + left: 0; + filter: blur(1px) brightness(10); + opacity: 0.9; + z-index: -1; +} + +.birth-text{ + font-size: 2rem; + text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5); + margin-top: 20px; +} + +#heart-gif{ + position: absolute; + display:none; + background-image: url("../media/hearts.gif"); + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + width: 30vw; + height: 50vh; + background-repeat: no-repeat; + background-size: 100% 100%; + z-index: -1; +} \ No newline at end of file diff --git a/src/Controller/ReproductionController.php b/src/Controller/ReproductionController.php index 54f776c..8f6dc0a 100644 --- a/src/Controller/ReproductionController.php +++ b/src/Controller/ReproductionController.php @@ -13,10 +13,13 @@ class ReproductionController extends AbstractController { $leftEmoji = '🐶'; // Emoji de gauche $rightEmoji = '🐱'; // Emoji de droite - + $childEmoji = 'https://emojik.vercel.app/s/%F0%9F%90%88_%F0%9F%90%95'; // Emoji enfant + // $childEmoji = '🐱'; + return $this->render('reproduction/index.html.twig', [ 'left_emoji' => $leftEmoji, 'right_emoji' => $rightEmoji, + 'child_emoji' => $childEmoji ]); } } diff --git a/templates/reproduction/index.html.twig b/templates/reproduction/index.html.twig index 3491fe9..78d91f3 100644 --- a/templates/reproduction/index.html.twig +++ b/templates/reproduction/index.html.twig @@ -1,22 +1,24 @@ - - - - - -Emoji Reproduction - - - + + + + + + Emoji Reproduction + + + -
-
-
-
+
+
+
+
+
+
+ -
+ - - - - - + +