Coding
Coding
DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<script src="https://cdnjs.cloudflare.com/ajax/libs/howler/2.2.3/howler.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r128/three.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/particles.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/aos.js"></script>
<style>
:root {
--primary-color: #4A0E4E;
--secondary-color: #00B9AE;
--tertiary-color: #E6E6FA;
--background-color: #1a1a2e;
--text-color: #ffffff;
body {
background-color: var(--background-color);
color: var(--text-color);
body.dark-mode {
--background-color: #f0f0f0;
--text-color: #1a1a2e;
.neumorphic {
background: var(--background-color);
border-radius: 15px;
body.dark-mode .neumorphic {
.glassmorphism {
backdrop-filter: blur(10px);
border-radius: 15px;
}
.btn-primary {
background-color: var(--primary-color);
color: var(--text-color);
.btn-primary:hover {
background-color: var(--secondary-color);
transform: translateY(-3px);
#particles-js {
position: absolute;
width: 100%;
height: 100%;
z-index: -1;
.hero-image {
@keyframes float {
0% { transform: translateY(0px); }
50% { transform: translateY(-20px); }
.music-visualizer {
width: 100%;
height: 200px;
margin-top: 2rem;
.playlist {
max-height: 300px;
overflow-y: auto;
.playlist-item {
cursor: pointer;
.playlist-item:hover {
.playlist-item.active {
background-color: var(--secondary-color);
color: var(--background-color);
.progress-bar {
width: 100%;
height: 5px;
border-radius: 5px;
overflow: hidden;
.progress {
width: 0%;
height: 100%;
background-color: var(--secondary-color);
</style>
</head>
<div id="particles-js"></div>
Harmonia
</h1>
<div class="space-x-4">
</div>
</nav>
</header>
<p class="text-xl mb-8">Immerse yourself in a world of music with Harmonia. Stream, create,
and share your perfect soundtrack.</p>
</button>
</div>
</div>
</section>
<p>Discover new music tailored to your taste with our AI-powered recommendation
engine.</p>
</div>
</div>
<p>Attend virtual concerts and exclusive live performances from your favorite artists.</p>
</div>
</section>
<div class="mt-6">
<div class="progress-bar">
</div>
<div>
</button>
▶️
</button>
</button>
</div>
<span id="duration">0:00</span>
</div>
</div>
</section>
</div>
<div class="playlist-item p-2 rounded" data-src="https://example.com/path/to/song2.mp3">
</div>
</div>
</div>
</section>
</main>
</div>
</footer>
<script>
// Particles.js configuration
particlesJS("particles-js", {
particles: {
line_linked: { enable: true, distance: 150, color: "#ffffff", opacity: 0.4, width: 1 },
move: { enable: true, speed: 6, direction: "none", random: false, straight: false, out_mode:
"out", bounce: false }
},
interactivity: {
detect_on: "canvas",
events: { onhover: { enable: true, mode: "repulse" }, onclick: { enable: true, mode: "push" },
resize: true },
},
retina_detect: true
});
AOS.init();
// Music Visualizer
renderer.setSize(visualizer.clientWidth, visualizer.clientHeight);
visualizer.appendChild(renderer.domElement);
const geometry = new THREE.BoxGeometry(1, 1, 1);
scene.add(cube);
camera.position.z = 5;
function animate() {
requestAnimationFrame(animate);
cube.rotation.x += 0.01;
cube.rotation.y += 0.01;
renderer.render(scene, camera);
animate();
let currentTrack = 0;
let sound;
let isPlaying = false;
playPauseBtn.addEventListener('click', togglePlayPause);
prevTrackBtn.addEventListener('click', playPreviousTrack);
nextTrackBtn.addEventListener('click', playNextTrack);
function togglePlayPause() {
if (!sound) {
playTrack(currentTrack);
} else if (isPlaying) {
sound.pause();
playPauseBtn.textContent = '▶️';
} else {
sound.play();
playPauseBtn.textContent = '';
isPlaying = !isPlaying;
function playTrack(index) {
if (sound) {
sound.unload();
src: [track.dataset.src],
autoplay: false,
loop: false,
volume: 0.5,
onplay: function() {
requestAnimationFrame(updateProgress);
playPauseBtn.textContent = '';
isPlaying = true;
},
onpause: function() {
playPauseBtn.textContent = '▶️';
isPlaying = false;
},
onend: function() {
playNextTrack();
},
onload: function() {
durationEl.textContent = formatTime(sound.duration());
});
tracks.forEach((t, i) => {
t.classList.toggle('active', i === index);
});
sound.play();
function playPreviousTrack() {
playTrack(currentTrack);
function playNextTrack() {
playTrack(currentTrack);
function updateProgress() {
progressBar.style.width = `${progress}%`;
currentTimeEl.textContent = formatTime(sound.seek());
requestAnimationFrame(updateProgress);
}
function formatTime(seconds) {
playlist.addEventListener('click', function(e) {
if (trackItem) {
currentTrack = Array.from(playlist.children).indexOf(trackItem);
playTrack(currentTrack);
});
darkModeToggle.addEventListener('click', toggleDarkMode);
function toggleDarkMode() {
document.body.classList.toggle('dark-mode');
</script>
</body>
</html>