Rock Paper Scissors Game
This component demonstrates a classic Rock Paper Scissors game built using pure front-end technologies, featuring:
- Interactive user vs CPU gameplay
- Animated hand-shake effect before result
- Dynamic image switching
- Clean and responsive UI
- Simple yet effective game logic
Code
CSS code
Explanation of the Code
HTML & CSS
Structured layout using semantic containers.
Google Font Poppins for a clean, modern look.
Flexbox used for alignment and spacing.
Game UI
Separate areas for results, player hand, and CPU hand.
Option buttons with icons and labels.
Active state highlights selected option.
Animations
Hand shake animation before result display.
CSS keyframes create realistic movement.
Disabled interaction during animation phase.
Javascript Code
JavaScript Logic
Handles user input and CPU random selection.
Maps outcomes using a simple object-based logic table.
Updates images and result text dynamically.
Gameplay Flow
User selects Rock, Paper, or Scissors
Animation starts (Wait...)
CPU randomly chooses
Winner is calculated and displayed
Responsive Behavior
Automatically adapts to different screen sizes.
No external libraries required.
Lightweight and beginner-friendly project.
