Add files via upload

This commit is contained in:
Aldess 2023-11-24 07:43:27 +01:00 committed by GitHub
commit 56ad8bce7d
2 changed files with 221 additions and 149 deletions

View file

@ -1,35 +1,47 @@
<!-- index.html --> <!-- index.html -->
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Collaborative Pixel Art</title> <title>Collaborative Pixel Art</title>
<link rel="stylesheet" href="styles.css"> <link rel="stylesheet" href="styles.css">
</head> </head>
<body> <body onload="
<div class="header"> document.getElementById('intro').classList.add('fadeout')
<h1>Collaborative Pixel Art</h1> setTimeout(() => {
<div id="pixel-count"></div> <!-- Element to display pixel count --> document.getElementById('intro').style.display = 'none'
</div> }, 800);
<div class="container"> ">
<div id="canvas"> <div id="intro" class="intro">
<!-- Canvas will be generated dynamically --> <h2>Collaborative Pixel Art</h2>
</div> </div>
<div class="header">
<div class="color-selector"> <h1>Collaborative Pixel Art</h1>
<div class="color-option" style="background-color: #000000;"></div> <div id="pixel-count">En cours de chargement...</div> <!-- Element to display pixel count -->
<div class="color-option" style="background-color: #FF0000;"></div> </div>
<div class="color-option" style="background-color: #00FF00;"></div> <div class="container">
<div class="color-option" style="background-color: #0000FF;"></div> <div id="canvas">
<div class="color-option" style="background-color: #FFFF00;"></div> <!-- Canvas will be generated dynamically -->
<div class="color-option" style="background-color: #FF00FF;"></div> </div>
<div class="color-option" style="background-color: #00FFFF;"></div>
<div class="color-option" style="background-color: #FFFFFF;"></div> <div class="color-selector">
</div> <div class="color-option" style="background-color: #5454ff;"></div>
</div> <div class="color-option" style="background-color: #00bbff;"></div>
<div class="color-option" style="background-color: #2e7d44;"></div>
<script src="/socket.io/socket.io.js"></script> <div class="color-option" style="background-color: #5ee834;"></div>
<script src="script.js"></script> <div class="color-option" style="background-color: #ffe600;"></div>
</body> <div class="color-option" style="background-color: #ff9900;"></div>
</html> <div class="color-option" style="background-color: #FF0000;"></div>
<div class="color-option" style="background-color: #ff89ff;"></div>
<div class="color-option" style="background-color: #a04cf9;"></div>
<div class="color-option" style="background-color: #808080;"></div>
<div class="color-option" style="background-color: #FFFFFF;"></div>
<div class="color-option" style="background-color: #000000;"></div>
</div>
</div>
<script src="/socket.io/socket.io.js"></script>
<script src="script.js"></script>
</body>
</html>

View file

@ -1,114 +1,174 @@
/* styles.css */ /* styles.css */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');
/* General styling for the body and page layout */ /* General styling for the body and page layout */
body { body {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
height: 100vh; height: 100vh;
margin: 0; margin: 0;
font-family: Arial, sans-serif; /* Set font family for the entire page */ font-family: 'Poppins', sans-serif; /* Set font family for the entire page */
background-color: #f0f0f0; /* Light gray background color */ background-color: var(--bg); /* Light gray background color */
} }
.intro {
/* Styling for the header section */ position: absolute;
.header { z-index: 2;
margin-bottom: 20px; /* Add spacing at the bottom of the header */ background-color: #000;
color: #333; /* Dark text color */ width: 100%;
font-size: 24px; /* Larger font size for the header */ height: 100vh;
font-weight: bold; /* Make the header text bold */ display: flex;
text-align: center; /* Center-align the text within the header */ justify-content: center;
} align-items: center;
flex-direction: column;
/* Styling for the pixel count display */ }
#pixel-count { .fadeout {
font-size: 16px; animation-name: fadeout;
color: #666; animation-duration: 1s;
text-align: center;
margin-top: 10px; /* Add spacing above the pixel count */ }
} @keyframes fadeout {
from {
/* Styling for the main container that wraps canvas and color selector */ opacity: 1;
.container { }
display: flex; to {
flex-wrap: wrap; /* Allow the container to wrap on smaller screens */ opacity: 0;
justify-content: center; /* Center the content horizontally */ }
align-items: center; /* Center the content vertically */ }
background-color: #fff; /* White background color */ @keyframes fadeIn {
border-radius: 8px; /* Rounded corners for the container */ from {
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); /* Subtle shadow effect */ opacity: 0;
padding: 20px; /* Add padding inside the container */ transform: translateX(-50%);
max-width: 800px; /* Set a maximum width for the container */ }
} to {
opacity: 1;
/* Styling for the canvas where pixels will be placed */ transform: translateX(0);
#canvas { }
width: 500px; }
height: 500px; .intro h2{
display: grid; font-size: 35px;
grid-template-columns: repeat(50, 10px); /* Create 50 columns of 10px each */ font-weight: 600;
grid-template-rows: repeat(50, 10px); /* Create 50 rows of 10px each */ text-align: center;
gap: 0; /* Remove any gap between pixels */ color: #fff;
} animation-name: fadeIn;
animation-duration: .8s;
/* Styling for individual pixels */ }
.pixel {
width: 10px; /* Styling for the header section */
height: 10px; .header {
display: inline-block; margin-bottom: 20px;
border: 1px solid #ccc; /* Add a 1px border around each pixel */ }
} :root {
--bg: #f0f0f0;
/* Styling for the color selector section */ --text-color: #333;
.color-selector { --text-color2: #666;
display: flex; }
flex-direction: column; /* Color options arranged vertically */ /* thème sombre */
align-items: center; /* Center color options horizontally */ @media (prefers-color-scheme: dark){
margin-left: 20px; /* Add some space to the left of the color selector */ :root {
} --bg: #171717;
--text-color: #fff;
/* Styling for individual color options */ --text-color2: #eee;
.color-option { }
width: 30px; .navbar .time, i, .brandname, .matiere {
height: 30px; filter: drop-shadow(1px 1px 2px rgb(0 0 0 / 0.4));
border-radius: 50%; /* Make the color options circular */ }
margin: 5px; /* Add spacing between color options */ }
cursor: pointer; /* Show pointer cursor on hover */ h1 {
border: 2px solid #ccc; /* Add a 2px border around each color option */ color: var(--text-color);
/* Color options will have their background color set dynamically */ font-size: 30px;
} font-weight: 600;
text-align: center;
/* Styling for the currently selected color option */ }
.color-option.selected { /* Styling for the pixel count display */
border-color: #000; /* Change the border color for the selected color */ #pixel-count {
} font-size: 16px;
color: var(--text-color2);
/* Responsive design for phone-friendly UI */ text-align: center;
@media (max-width: 768px) { margin-top: 10px; /* Add spacing above the pixel count */
.container { }
flex-direction: column; /* Stack canvas and color selector vertically */
} /* Styling for the main container that wraps canvas and color selector */
.container {
#canvas { display: flex;
width: 90%; /* Adjust canvas width to fit smaller screens */ flex-wrap: wrap; /* Allow the container to wrap on smaller screens */
height: auto; /* Allow canvas height to adapt based on content */ justify-content: center; /* Center the content horizontally */
margin: 20px 0; /* Add some spacing around the canvas */ align-items: center; /* Center the content vertically */
} background-color: #fffffff3; /* White background color */
border-radius: 15px; /* Rounded corners for the container */
.color-selector { box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); /* Subtle shadow effect */
flex-direction: row; /* Arrange color options horizontally */ padding: 20px; /* Add padding inside the container */
justify-content: center; /* Center color options horizontally */ max-width: 800px; /* Set a maximum width for the container */
margin: 0; /* Remove any margin on smaller screens */ }
margin-top: 20px; /* Add some spacing above the color selector */
} /* Styling for the canvas where pixels will be placed */
#canvas {
.color-option { width: 500px;
margin: 5px 8px; /* Adjust spacing between color options */ height: 500px;
} display: grid;
grid-template-columns: repeat(50, 10px); /* Create 50 columns of 10px each */
/* Adjust pixel count styles for phone-friendly UI */ grid-template-rows: repeat(50, 10px); /* Create 50 rows of 10px each */
#pixel-count { gap: 0; /* Remove any gap between pixels */
font-size: 14px; }
}
} /* Styling for individual pixels */
.pixel {
width: 10px;
height: 10px;
display: inline-block;
border: 1px solid #ccc; /* Add a 1px border around each pixel */
}
/* Styling for the color selector section */
.color-selector {
display: flex;
flex-direction: column; /* Color options arranged vertically */
align-items: center; /* Center color options horizontally */
margin-left: 20px; /* Add some space to the left of the color selector */
}
/* Styling for individual color options */
.color-option {
width: 30px;
height: 30px;
border-radius: 50%; /* Make the color options circular */
margin: 5px; /* Add spacing between color options */
cursor: pointer; /* Show pointer cursor on hover */
border: 2px solid #ccc; /* Add a 2px border around each color option */
/* Color options will have their background color set dynamically */
}
/* Styling for the currently selected color option */
.color-option.selected {
border-color: #000; /* Change the border color for the selected color */
}
/* Responsive design for phone-friendly UI */
@media (max-width: 768px) {
.container {
flex-direction: column; /* Stack canvas and color selector vertically */
}
#canvas {
width: 90%; /* Adjust canvas width to fit smaller screens */
height: auto; /* Allow canvas height to adapt based on content */
margin: 20px 0; /* Add some spacing around the canvas */
}
.color-selector {
flex-direction: row; /* Arrange color options horizontally */
justify-content: center; /* Center color options horizontally */
margin: 0; /* Remove any margin on smaller screens */
margin-top: 20px; /* Add some spacing above the color selector */
}
.color-option {
margin: 5px 8px; /* Adjust spacing between color options */
}
/* Adjust pixel count styles for phone-friendly UI */
#pixel-count {
font-size: 14px;
}
}