🕵️ SicherheitslückenHak5: Hackers Just Poisoned the Rust Supply Chain | Threat Wire(01.09.2026 um 14:00 Uhr)
🕵️ SicherheitslückenHak5: Hackers Found a Way Into Humanoid Robots | Threat Wire(04.09.2026 um 15:04 Uhr)
🔧 AI Nachrichten Bits und so #1021 (Passwort für Laufwerk)(31.08.2026 um 22:15 Uhr)
🔧 AI Nachrichten Bits und so #1022 (Wie Weißbier)(06.09.2026 um 20:39 Uhr)
🍏 iOS / Mac OSHue-App 6.0 ist da: das sind die Neuerungen(07.09.2026 um 17:21 Uhr)
🕵️ SicherheitslückenHak5: Hackers Just Poisoned the Rust Supply Chain | Threat Wire(01.09.2026 um 14:00 Uhr)
🕵️ SicherheitslückenHak5: Hackers Found a Way Into Humanoid Robots | Threat Wire(04.09.2026 um 15:04 Uhr)
🔧 AI Nachrichten Bits und so #1021 (Passwort für Laufwerk)(31.08.2026 um 22:15 Uhr)
🔧 AI Nachrichten Bits und so #1022 (Wie Weißbier)(06.09.2026 um 20:39 Uhr)
🍏 iOS / Mac OSHue-App 6.0 ist da: das sind die Neuerungen(07.09.2026 um 17:21 Uhr)

🔧 Programmierung 🕛 kürzlich 14 Min Lesezeit
0

Building a Modern Interactive Raffle Wheel with HTML, CSS, and JavaScript

↗ Quelle (dev.to)
🗣️ Stimme:
📑 Inhaltsübersicht

Introduction



In today's digital age, engaging your community with interactive tools is essential for fostering participation and excitement. Whether you're hosting a giveaway, conducting a poll, or organizing a competition, having a visually appealing and interactive raffle wheel can significantly enhance user experience. In this article, I'll walk you through the process of creating Modern Raffle 2024, an interactive raffle wheel built with HTML, CSS, and JavaScript. We'll cover everything from setting up the structure to adding animations and integrating social sharing features.






🚀 Technologies Used



To bring this project to life, I leveraged the following technologies:





  • HTML5: For structuring the webpage and creating interactive elements.


  • CSS3: To style the application with modern design principles, including glassmorphism, animations, and responsive layouts.


  • JavaScript: To add interactivity, handle user inputs, and manage the raffle wheel's logic and animations.


  • Canvas API: For drawing and animating the raffle wheel.


  • Font Awesome: To incorporate vector icons for a polished look.


  • Google Fonts: Utilized the Inter font for a clean and modern typography.


  • Buy Me a Coffee: Integrated a donation button to support the project.






🛠️ Project Structure



The project is organized into three main files:





  1. index.html: Contains the HTML structure of the application.


  2. styles.css: Holds all the CSS styles for layout and design.


  3. script.js: Includes the JavaScript code that powers the interactivity and animations.



Additionally, a footer section is incorporated to promote my website, LinkedIn, Twitter, and include a Buy Me a Coffee button for support.






📄 HTML (index.html)



The HTML structure sets up the main components of the raffle application, including input sections for participants and prizes, the raffle wheel, a modal for announcing winners, and a footer for promotions.



CODE




html

<!DOCTYPE html>










Modern Raffle 2024



<!-- Font Awesome for Icons -->



<!-- Google Fonts for Enhanced Typography -->









🎉 Modern Raffle 2024 🎉


CODE
    <div class="input-section">
<h2>Add Participants</h2>
<div class="input-group">
<input type="text" id="username" placeholder="Username">
<button id="addUserBtn"><i class="fas fa-user-plus"></i> Add</button>
</div>
<ul id="userList"></ul>
</div>

<div class="input-section">
<h2>Select a Prize</h2>
<div class="input-group">
<input type="text" id="prize" placeholder="Prize Description">
<button id="setPrizeBtn"><i class="fas fa-gift"></i> Set Prize</button>
</div>
<p id="selectedPrize">Selected Prize: None</p>
</div>

<div class="wheel-container">
<div class="wheel-wrapper">
<canvas id="raffleWheel" width="500" height="500"></canvas>
<div class="pointer">
<i class="fas fa-arrow-down"></i>
</div>
</div>
<button id="spinBtn"><i class="fas fa-play"></i> Spin the Wheel</button>
</div>

<div id="winnerModal" class="modal">
<div class="modal-content">
<span class="close-button">&times;</span>
<h2>🎊 Congratulations! 🎊</h2>
<p id="winnerText"></p>
<button id="shareBtn"><i class="fab fa-twitter"></i> Share on Twitter</button>
</div>
</div>
</div>

<!-- Footer Section -->
<footer class="footer">
<div class="footer-container">
<div class="footer-links">
<a href="https://gladiatorsbattle.com" target="_blank" aria-label="Website">
<i class="fas fa-globe"></i> Website
</a>
<a href="https://www.linkedin.com/in/pierre-romain-lopez/" target="_blank" aria-label="LinkedIn">
<i class="fab fa-linkedin"></i> LinkedIn
</a>
<a href="https://x.com/GladiatorsBT" target="_blank" aria-label="Twitter">
<i class="fab fa-twitter"></i> Twitter
</a>
</div>
<div class="footer-donate">
<!-- Buy Me a Coffee Button -->
<script type="text/javascript" src="https://cdnjs.buymeacoffee.com/1.0.0/button.prod.min.js"
data-name="bmc-button"
data-slug="GladiatorsBattle"
data-color="#FFDD00"
data-emoji=""
data-font="Cookie"
data-text="Buy me a coffee"
data-outline-color="#000000"
data-font-color="#000000"
data-coffee-color="#ffffff">
</script>
</div>
</div>
</footer>

<script src="script.js"></script>



CODE

🎨 CSS (styles.css)
The CSS file is meticulously crafted to ensure a modern and premium look, incorporating glassmorphism, smooth animations, responsive design, and accessibility features. Below is the complete CSS with detailed explanations of enhancements and fixes.





/* Reset and Base Styles */




  • {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', sans-serif;
    }



body {

background: linear-gradient(135deg, #1e3c72, #2a5298);

color: #ffffff;

display: flex;

flex-direction: column; /* Stack children vertically /

justify-content: flex-start; /
Start from the top /

align-items: center;

min-height: 100vh;

/
Remove overflow hidden to allow footer visibility */

overflow-x: hidden;

}



/* Container Styles /

.container {

background: rgba(255, 255, 255, 0.05);

backdrop-filter: blur(10px);

padding: 40px;

border-radius: 20px;

text-align: center;

width: 90%;

max-width: 900px;

box-shadow: 0 8px 32px rgba(0, 0, 0, 0.37);

border: 1px solid rgba(255, 255, 255, 0.18);

animation: fadeIn 1s ease-in-out;

flex: 1; /
Allow container to grow and push footer down */

display: flex;

flex-direction: column;

align-items: center;

}



/* Fade-in Animation */

@keyframes fadeIn {

from { opacity: 0; transform: translateY(-20px); }

to { opacity: 1; transform: translateY(0); }

}



/* Heading Styles */

h1 {

margin-bottom: 30px;

font-size: 3rem;

font-weight: 700;

text-shadow: 3px 3px 6px rgba(0,0,0,0.3);

}



/* Input Sections */

.input-section {

margin-bottom: 40px;

width: 100%;

}



.input-section h2 {

margin-bottom: 15px;

font-size: 1.75rem;

font-weight: 600;

}



/* Input Groups */

.input-group {

display: flex;

justify-content: center;

align-items: center;

gap: 10px;

margin-bottom: 15px;

}



.input-group input {

padding: 12px 20px;

width: 60%;

border: none;

border-radius: 30px;

background: rgba(255, 255, 255, 0.1);

color: #ffffff;

font-size: 1rem;

outline: none;

transition: background 0.3s ease, box-shadow 0.3s ease;

}



.input-group input::placeholder {

color: #dddddd;

}



.input-group input:focus {

background: rgba(255, 255, 255, 0.2);

box-shadow: 0 0 10px rgba(255, 127, 80, 0.5);

}



.input-group button {

padding: 12px 25px;

border: none;

border-radius: 30px;

background-color: #ff7f50;

color: #fff;

font-size: 1rem;

font-weight: 600;

cursor: pointer;

display: flex;

align-items: center;

gap: 8px;

transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;

}



.input-group button:hover {

background-color: #ff5722;

transform: translateY(-2px);

box-shadow: 0 4px 10px rgba(0,0,0,0.3);

}



/* User List */





userList {


CODE
list-style: none;
max-height: 120px;
overflow-y: auto;
text-align: left;
padding: 0 20%;
width: 100%;

}





userList li {


CODE
padding: 8px 0;
border-bottom: 1px solid rgba(255, 255, 255, 0.2);
font-size: 1rem;

}



/* Selected Prize */





selectedPrize {


CODE
font-size: 1.2rem;
font-weight: 500;
margin-top: 10px;

}



/* Wheel Container */

.wheel-container {

position: relative;

margin-bottom: 40px;

width: 100%;

display: flex;

flex-direction: column;

align-items: center;

}



.wheel-wrapper {

position: relative;

width: 100%;

max-width: 500px;

margin: 0 auto 20px;

}



/* Canvas Styles */

canvas {

width: 100%;

height: auto;

border-radius: 50%;

box-shadow: 0 0 20px rgba(0,0,0,0.5);

background: #000;

transition: transform 4s cubic-bezier(0.33, 1, 0.68, 1);

}



/* Pointer Styles */

.pointer {

position: absolute;

top: -20px;

left: 50%;

transform: translateX(-50%);

font-size: 2rem;

color: #ffeb3b;

animation: bounce 2s infinite;

}



@keyframes bounce {

0%, 100% { transform: translateX(-50%) translateY(0); }

50% { transform: translateX(-50%) translateY(-10px); }

}



/* Spin Button */





spinBtn {


CODE
padding: 15px 35px;
border: none;
border-radius: 50px;
background-color: #32cd32;
color: #fff;
font-size: 1.25rem;
font-weight: 600;
cursor: pointer;
box-shadow: 0 6px 20px rgba(0,0,0,0.3);
transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
display: flex;
align-items: center;
gap: 10px;
margin: 0 auto;

}





spinBtn:hover {


CODE
background-color: #28a428;
transform: translateY(-3px);
box-shadow: 0 8px 25px rgba(0,0,0,0.4);

}





spinBtn:active {


CODE
transform: translateY(0);
box-shadow: 0 4px 15px rgba(0,0,0,0.2);

}



/* Modal Styles */

.modal {

display: none;

position: fixed;

z-index: 100;

left: 0;

top: 0;

width: 100%;

height: 100%;

overflow: auto;

background-color: rgba(0,0,0,0.8);

animation: fadeInModal 0.5s ease;

}



@keyframes fadeInModal {

from { opacity: 0; }

to { opacity: 1; }

}



.modal-content {

background-color: rgba(30, 30, 30, 0.95);

margin: 10% auto;

padding: 30px;

border-radius: 15px;

width: 90%;

max-width: 600px;

text-align: center;

box-shadow: 0 8px 25px rgba(0,0,0,0.5);

position: relative;

animation: slideDown 0.5s ease;

}



@keyframes slideDown {

from { transform: translateY(-50px); opacity: 0; }

to { transform: translateY(0); opacity: 1; }

}



.close-button {

color: #bbb;

position: absolute;

top: 15px;

right: 20px;

font-size: 28px;

font-weight: bold;

cursor: pointer;

transition: color 0.3s ease;

}



.close-button:hover,

.close-button:focus {

color: #fff;

}



.modal-content h2 {

margin-bottom: 20px;

font-size: 2rem;

font-weight: 700;

}



.modal-content p {

font-size: 1.25rem;

margin-bottom: 25px;

}





shareBtn {


CODE
padding: 12px 25px;
background-color: #1DA1F2;
border: none;
border-radius: 30px;
color: #fff;
font-size: 1rem;
font-weight: 600;
cursor: pointer;
display: flex;
align-items: center;
gap: 8px;
transition: background-color 0.3s ease, transform 0.2s ease;

}





shareBtn:hover {


CODE
background-color: #0d95e8;
transform: translateY(-2px);

}



/* Footer Styles /

.footer {

background: rgba(255, 255, 255, 0.05);

backdrop-filter: blur(10px);

padding: 20px 0;

border-top: 1px solid rgba(255, 255, 255, 0.2);

width: 100%;

/
Ensure footer stays below content */

flex-shrink: 0;

}



.footer-container {

display: flex;

flex-direction: column;

align-items: center;

justify-content: center;

max-width: 900px;

margin: 0 auto;

padding: 0 20px;

}



.footer-links {

display: flex;

gap: 20px;

margin-bottom: 15px;

}



.footer-links a {

color: #ffffff;

font-size: 1rem;

text-decoration: none;

display: flex;

align-items: center;

gap: 8px;

transition: color 0.3s ease, transform 0.2s ease;

}



.footer-links a:hover {

color: #ff7f50;

transform: translateY(-2px);

}



.footer-links a i {

font-size: 1.2rem;

}



.footer-donate {

margin-top: 10px;

}



/* Responsive Design for Footer */

);

const twitterUrl = https://twitter.com/intent/tweet?text=${text}&url=${url};

window.open(twitterUrl, '_blank');

}



// Initial Wheel Setup

initializeWheel();





CODE



🧩 Step-by-Step Development

1. Setting Up the HTML Structure
I began by outlining the basic structure of the application in index.html. This includes:

- Header: Displays the title of the raffle.
- Input Sections: Two main sections for adding participants and selecting a prize.
- Raffle Wheel: A canvas element where the wheel is drawn and animated.
- Modal: A popup that announces the winner.
- Footer: Promotes my website, LinkedIn, Twitter, and includes a Buy Me a Coffee button.

2. Styling with CSS

Using styles.css, I implemented a modern and sleek design:

- Glassmorphism: Achieved with semi-transparent backgrounds and backdrop-filter for a frosted glass effect.
- Animations: Added fadeIn for the container and bounce for the pointer to enhance interactivity.
- Responsive Design: Ensured that the layout adapts gracefully across various screen sizes using Flexbox and media queries.
- Accessibility: Incorporated focus states and high-contrast colors for better usability.

3. Adding Interactivity with JavaScript

In script.js, the core functionalities were implemented:

- Adding Participants: Users can input and add unique usernames to the raffle.
- Setting Prizes: Define the prize that participants can win.
- Drawing the Raffle Wheel: Utilized the Canvas API to draw a wheel divided into segments, each representing a participant.
- Spinning the Wheel: Implemented smooth spinning animations with easing functions to determine the winner.
- Announcing the Winner: Displayed the winner in a modal with an option to share the result on Twitter.

4. Integrating the Footer for Promotion

The footer serves as a promotional tool, connecting users to my online presence and providing a means to support the project financially:

- Social Links: Direct links to my website, LinkedIn, and Twitter profiles.
- Buy Me a Coffee: Encourages users to support my work through donations.
- 🧱 Challenges Faced and Solutions

1. Creating a Dynamic and Interactive Raffle Wheel

Challenge: Drawing and animating a responsive raffle wheel where each segment corresponds to a participant.

Solution: Leveraged the Canvas API to programmatically draw segments based on the number of participants. Each segment is assigned a distinct color for visual differentiation. JavaScript handles the rotation logic, ensuring smooth animations and accurately determining the winning segment based on the final angle.

2. Ensuring Smooth Animations and Performance

Challenge: Maintaining fluid animations, especially on devices with limited processing power.

Solution: Optimized JavaScript code to minimize computational overhead during animations. Utilized requestAnimationFrame for synchronized and efficient rendering of animation frames. Additionally, kept the canvas size reasonable and optimized the drawing functions to enhance performance.

3. Maintaining Accessibility and Usability

Challenge: Making the application accessible to users with different needs and ensuring an intuitive user experience.

Solution: Incorporated focus states for all interactive elements, ensuring keyboard navigability. Chose high-contrast color schemes to enhance readability. Structured the HTML semantically to assist screen readers in conveying information effectively.

📈 Results and Feedback
Since launching Modern Raffle 2024, the feedback has been overwhelmingly positive. Users appreciate the intuitive interface, the visually appealing design, and the seamless interactivity of the raffle wheel. The ability to share results on Twitter has also helped increase the visibility of giveaways, attracting more participants and fostering a sense of community engagement.

🔗 Useful Links

View the Project in Action: Modern Raffle 2024 on https://codepen.io/HanGPIIIErr/pen/eYqqEeW
Website: https://gladiatorsbattle.com
LinkedIn: https://www.linkedin.com/in/pierre-romain-lopez/
Twitter: https://x.com/GladiatorsBT
Buy Me a Coffee: https://www.buymeacoffee.com/GladiatorsBattle

🎉 Conclusion

Creating Modern Raffle 2024 was an enriching experience that combined modern web design principles with interactive functionalities. By leveraging HTML, CSS, and JavaScript, I developed a tool that not only serves its primary purpose of managing raffles but also engages users with its sleek design and smooth interactivity.

I encourage you to explore the project on CodePen, try it out for your own giveaways, and customize it to fit your specific needs. Whether you're a developer looking to enhance your portfolio or a community manager aiming to boost engagement, this raffle wheel is a versatile and effective solution.

Feel free to connect with me on my Website, LinkedIn, Twitter, or support my work through Buy Me a Coffee.

Happy Coding and Best of Luck with Your Raffles! 🎮✨
Vollständiger Original-Bericht
Ausführliche Details, Code-Beispiele & Hersteller-Stellungnahme auf dev.to.
↗ Original-Artikel auf dev.to lesen
Wie bewertest du diesen Beitrag?
1 Klick Feedback
Teilen mit Netzwerk & Team:

Community-Analysen & Experten-Meinungen 0

Verfasse deine eigene Analyse, teile Workarounds oder diskutiere diesen Vorfall im Blog.
Noch keine Community-Analyse verfasst. Markiere einen Textabschnitt oder klicke oben auf Eigene Analyse verfassen“!
Community Pulse: Relevanz-Einschätzung
1 Klick Experten-Votum
🔴 Akute Relevanz 0%
🟡 In Evaluierung 0%
🟢 Keine Auswirkung 0%
Spannende Innovation 0%
Verwandte Story-Cluster & Quellen (Vektor-KI)
Port 8095 Engine
1 Quelle
Hackers Just Poisoned the Rust Supply Chain | Threat Wire
1 Quelle
Hackers Found a Way Into Humanoid Robots | Threat Wire
1 Quelle
Bits und so #1021 (Passwort für Laufwerk)
Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten Building a Modern Interactive Raffle Wheel with HTML, CSS, and JavaScript

Thematisch verwandte Begriffe: Building, Modern, Interactive, Raffle · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...