mirror of
https://github.com/randyjc/Rahoot.git
synced 2026-03-13 20:15:35 +01:00
Add Prepared Animation
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 2.8 MiB |
BIN
src/assets/background.webp
Normal file
BIN
src/assets/background.webp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 380 KiB |
@@ -1,6 +1,6 @@
|
|||||||
import Image from "next/image"
|
import Image from "next/image"
|
||||||
import Button from "@/components/Button"
|
import Button from "@/components/Button"
|
||||||
import background from "@/assets/2238431_1694.jpg"
|
import background from "@/assets/background.webp"
|
||||||
import { usePlayerContext } from "@/context/player"
|
import { usePlayerContext } from "@/context/player"
|
||||||
import { useSocketContext } from "@/context/socket"
|
import { useSocketContext } from "@/context/socket"
|
||||||
import { useState } from "react"
|
import { useState } from "react"
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ export default function Answers({
|
|||||||
<div className="max-w-7xl mx-auto mb-4 w-full flex justify-between gap-1 font-bold text-white text-lg md:text-xl px-2">
|
<div className="max-w-7xl mx-auto mb-4 w-full flex justify-between gap-1 font-bold text-white text-lg md:text-xl px-2">
|
||||||
<div className="bg-black/40 px-4 font-bold rounded-full flex flex-col items-center text-lg">
|
<div className="bg-black/40 px-4 font-bold rounded-full flex flex-col items-center text-lg">
|
||||||
<span className="text-sm translate-y-1">Time</span>
|
<span className="text-sm translate-y-1">Time</span>
|
||||||
<span>{cooldown}</span>
|
<span className="anim-timer">{cooldown}</span>
|
||||||
</div>
|
</div>
|
||||||
<div className="bg-black/40 px-4 font-bold rounded-full flex flex-col items-center text-lg">
|
<div className="bg-black/40 px-4 font-bold rounded-full flex flex-col items-center text-lg">
|
||||||
<span className="text-sm translate-y-1">Answers</span>
|
<span className="text-sm translate-y-1">Answers</span>
|
||||||
|
|||||||
31
src/components/game/states/Prepared.jsx
Normal file
31
src/components/game/states/Prepared.jsx
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
import Circle from "@/components/icons/Circle"
|
||||||
|
import CricleCheck from "@/components/icons/CricleCheck"
|
||||||
|
import CricleXmark from "@/components/icons/CricleXmark"
|
||||||
|
import Rhombus from "@/components/icons/Rhombus"
|
||||||
|
import Square from "@/components/icons/Square"
|
||||||
|
import Triangle from "@/components/icons/Triangle"
|
||||||
|
import { usePlayerContext } from "@/context/player"
|
||||||
|
import { useEffect } from "react"
|
||||||
|
/*{ data: { number, total, question } }*/
|
||||||
|
export default function Prepared() {
|
||||||
|
const { dispatch } = usePlayerContext()
|
||||||
|
|
||||||
|
return (
|
||||||
|
<section className="max-w-7xl mx-auto w-full flex-1 relative items-center justify-center flex flex-col anim-show">
|
||||||
|
<div className="anim-quizz bg-gray-700 p-5 gap-4 rounded-2xl w-80 h-[400px] grid grid-cols-2 shadow-[10px_10px_0_rgba(20,24,29,1)] ">
|
||||||
|
<div className="button flex justify-center items-center bg-red-500 w-full h-full aspect-square shadow-inset rounded-2xl">
|
||||||
|
<Triangle className="h-14" />
|
||||||
|
</div>
|
||||||
|
<div className="button flex justify-center items-center bg-blue-500 w-full h-full aspect-square shadow-inset rounded-2xl">
|
||||||
|
<Rhombus className="h-14" />
|
||||||
|
</div>
|
||||||
|
<div className="button flex justify-center items-center bg-yellow-500 w-full h-full aspect-square shadow-inset rounded-2xl">
|
||||||
|
<Square className="h-14" />
|
||||||
|
</div>
|
||||||
|
<div className="button flex justify-center items-center bg-green-500 w-full h-full aspect-square shadow-inset rounded-2xl">
|
||||||
|
<Circle className="h-14" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
import { useSocketContext } from "@/context/socket"
|
import { useRef } from "react"
|
||||||
import { useEffect, useRef } from "react"
|
|
||||||
|
|
||||||
export default function Question({ data: { question } }) {
|
export default function Question({ data: { question } }) {
|
||||||
const barRef = useRef(null)
|
const barRef = useRef(null)
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
export const WEBSOCKET_URL = "http://localhost:3000" ///"https://rahoot.ralex.app"
|
export const WEBSOCKET_URL = "http://localhost:5157" ///"https://rahoot.ralex.app"
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { io } from "socket.io-client"
|
|||||||
import { createContext, useContext, useState } from "react"
|
import { createContext, useContext, useState } from "react"
|
||||||
import { WEBSOCKET_URL } from "@/constants"
|
import { WEBSOCKET_URL } from "@/constants"
|
||||||
|
|
||||||
export const socket = io("http://localhost:5157", {
|
export const socket = io(WEBSOCKET_URL, {
|
||||||
path: "/ws/",
|
path: "/ws/",
|
||||||
//addTrailingSlash: false,
|
//addTrailingSlash: false,
|
||||||
transports: ["websocket"],
|
transports: ["websocket"],
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import Button from "@/components/Button"
|
|||||||
import GameWrapper from "@/components/game/GameWrapper"
|
import GameWrapper from "@/components/game/GameWrapper"
|
||||||
import Answers from "@/components/game/states/Answers"
|
import Answers from "@/components/game/states/Answers"
|
||||||
import Leaderboard from "@/components/game/states/Leaderboard"
|
import Leaderboard from "@/components/game/states/Leaderboard"
|
||||||
|
import Prepared from "@/components/game/states/Prepared"
|
||||||
import Question from "@/components/game/states/Question"
|
import Question from "@/components/game/states/Question"
|
||||||
import Start from "@/components/game/states/Start"
|
import Start from "@/components/game/states/Start"
|
||||||
import Wait from "@/components/game/states/Wait"
|
import Wait from "@/components/game/states/Wait"
|
||||||
@@ -90,12 +91,15 @@ export default function Manager() {
|
|||||||
<Button onClick={handleCreate}>Create Room</Button>
|
<Button onClick={handleCreate}>Create Room</Button>
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
|
<>
|
||||||
<GameWrapper textNext={nextText} onNext={handleSkip} manager>
|
<GameWrapper textNext={nextText} onNext={handleSkip} manager>
|
||||||
{gameStateComponent[state.status.name] &&
|
<Prepared />
|
||||||
|
{/*gameStateComponent[state.status.name] &&
|
||||||
createElement(gameStateComponent[state.status.name], {
|
createElement(gameStateComponent[state.status.name], {
|
||||||
data: state.status.data,
|
data: state.status.data,
|
||||||
})}
|
})*/}
|
||||||
</GameWrapper>
|
</GameWrapper>
|
||||||
|
</>
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -36,6 +36,20 @@
|
|||||||
animation: show 0.5s ease-out;
|
animation: show 0.5s ease-out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.anim-timer {
|
||||||
|
animation: timer 1s ease-out infinite;
|
||||||
|
}
|
||||||
|
|
||||||
|
.anim-quizz {
|
||||||
|
animation: quizz 1s ease-out;
|
||||||
|
transform: perspective(1200px) rotateY(-15deg) rotateX(15deg)
|
||||||
|
translateZ(100px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.anim-quizz .button {
|
||||||
|
animation: quizzButton 1s ease-out;
|
||||||
|
}
|
||||||
|
|
||||||
@keyframes show {
|
@keyframes show {
|
||||||
0% {
|
0% {
|
||||||
transform: scale(0);
|
transform: scale(0);
|
||||||
@@ -59,3 +73,38 @@
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@keyframes timer {
|
||||||
|
0% {
|
||||||
|
transform: scale(1);
|
||||||
|
}
|
||||||
|
30% {
|
||||||
|
transform: scale(1.4) rotate(-6deg);
|
||||||
|
}
|
||||||
|
60% {
|
||||||
|
transform: scale(0.8) rotate(6deg);
|
||||||
|
}
|
||||||
|
80% {
|
||||||
|
transform: scale(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes quizz {
|
||||||
|
0% {
|
||||||
|
transform: scale(0) perspective(1200px) rotateY(-35deg) rotateX(15deg)
|
||||||
|
translateZ(100px);
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
transform: scale(1) perspective(1200px) rotateY(-15deg) rotateX(15deg)
|
||||||
|
translateZ(100px);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes quizzButton {
|
||||||
|
0% {
|
||||||
|
transform: scale(0);
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
transform: scale(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user