Liveweave: Generative AI Web Editor & HTML/CSS/JS Playground
Initializing
Liveweave
Web
expand_more
home
Home
Palette
Color Explorer
arrow_outward
Polyline
Graphics Editor
arrow_outward
frame_source
Python Playground
arrow_outward
build
Tools
expand_more
restart_alt
Load "Hello Weaver!"
post_add
Generate Lorem ipsum...
code
Format HTML
code_blocks
Format CSS
data_object
Format JavaScript
library_add
Library
expand_more
A
Algolia JS
Animate CSS
Apex Charts JS
B
Bulma CSS
Bootstrap
C
Chart JS
Chartist
Create JS
D
D3
Dojo
F
Foundation
Fullpage JS
G
Granim JS
Google Charts
H
Halfmoon
J
jQuery
M
Materialize
Moment JS
Masonry JS
Milligram CSS
P
Pure CSS
Primer CSS
Popper JS
Pattern CSS
Picnic CSS
R
React JS
Raphael JS
Raisin CSS
S
Semantic UI
Skeleton CSS
Spectre CSS
Tachyons CSS
T
Tailwind
Three JS
U
UI Kit
Vis JS
W
Water CSS
download
Download
expand_more
developer_mode
Download as HTML
folder_zip
Download as .ZIP
cloud_upload
Fork
account_circle
Login
settings
Settings
expand_more
Editor font
14
px
A
A
Line number
Mini map
Word wrap
sync_alt
Reset Settings
smart_display
Run
left_panel_close
AI Assistant
dashboard
All
HTML
CSS
JS
visibility
Preview
bolt
Live Preview
terminal
JS Console
<div class="player-shell"> <div class="player-card"> <div class="player-topbar"> <div> <span class="eyebrow">NOW PLAYING</span> <h1>Midnight Drive</h1> </div> <button class="icon-btn" id="favoriteBtn" aria-label="Favorite"> ♡ </button> </div> <div class="album-wrap"> <div class="album-glow"></div> <div class="album-art" id="albumArt"> <div class="album-inner"> <div class="album-title">NEON</div> <div class="album-subtitle">CITY</div> </div> </div> </div> <div class="track-meta"> <div> <h2 id="trackTitle">Midnight Drive</h2> <p id="artistName">Nova Skyline</p> </div> <div class="equalizer" id="equalizer"> <span></span> <span></span> <span></span> <span></span> </div> </div> <div class="progress-area"> <input id="seekBar" type="range" min="0" max="100" value="28" > <div class="time-row"> <span id="currentTime">1:08</span> <span id="duration">4:02</span> </div> </div> <div class="controls"> <button class="icon-btn small" id="shuffleBtn" aria-label="Shuffle"> ⤨ </button> <button class="icon-btn medium" id="prevBtn" aria-label="Previous"> ◀ </button> <button class="play-btn" id="playBtn" aria-label="Play"> ▶ </button> <button class="icon-btn medium" id="nextBtn" aria-label="Next"> ▶ </button> <button class="icon-btn small" id="repeatBtn" aria-label="Repeat"> ↻ </button> </div> <div class="volume-row"> <span>?</span> <input id="volumeBar" type="range" min="0" max="100" value="72" > </div> <div class="playlist"> <div class="playlist-title"> Up next </div> <button class="track active" data-index="0"> <div class="track-number">01</div> <div class="track-info"> <strong>Midnight Drive</strong> <span>Nova Skyline</span> </div> <span class="track-length">4:02</span> </button> <button class="track" data-index="1"> <div class="track-number">02</div> <div class="track-info"> <strong>Electric Rain</strong> <span>Glass Avenue</span> </div> <span class="track-length">3:47</span> </button> <button class="track" data-index="2"> <div class="track-number">03</div> <div class="track-info"> <strong>After Hours</strong> <span>Signal Bloom</span> </div> <span class="track-length">4:18</span> </button> <audio id="audioPlayer" preload="metadata"></audio> </div> </div> </div>
* { box-sizing: border-box; } :root { --bg: #05070d; --card: rgba(12, 16, 28, 0.78); --border: rgba(255, 255, 255, 0.10); --text: #f8fafc; --muted: rgba(255, 255, 255, 0.52); --accent: #7c5cff; --accent-2: #20d6ff; } html, body { margin: 0; min-height: 100%; font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; } body { background: radial-gradient(circle at 20% 20%, rgba(124, 92, 255, .25), transparent 35%), radial-gradient(circle at 80% 70%, rgba(32, 214, 255, .18), transparent 32%), linear-gradient(145deg, #05070d, #0b1020 65%, #060812); color: var(--text); } button, input { font: inherit; } .player-shell { min-height: 100vh; display: grid; place-items: center; padding: 30px; } .player-card { width: min(420px, 94vw); padding: 24px; border: 1px solid var(--border); border-radius: 28px; background: var(--card); backdrop-filter: blur(22px); box-shadow: 0 40px 100px rgba(0, 0, 0, .55), inset 0 1px 0 rgba(255,255,255,.04); } .player-topbar { display: flex; align-items: flex-start; justify-content: space-between; } .eyebrow { font-size: 10px; font-weight: 700; letter-spacing: 2px; color: var(--muted); } .player-topbar h1 { margin: 5px 0 0; font-size: 15px; font-weight: 600; } .icon-btn { border: 1px solid var(--border); border-radius: 50%; background: rgba(255,255,255,.05); color: white; cursor: pointer; transition: transform .2s, background .2s, border-color .2s; } .icon-btn:hover { transform: translateY(-2px); background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.18); } .icon-btn { width: 38px; height: 38px; } .icon-btn.small { width: 34px; height: 34px; font-size: 14px; } .icon-btn.medium { width: 44px; height: 44px; } .icon-btn.active { color: #9c8cff; border-color: rgba(124,92,255,.6); } .album-wrap { position: relative; width: 280px; height: 280px; margin: 28px auto 26px; } .album-glow { position: absolute; inset: 15%; border-radius: 50%; background: linear-gradient(135deg, #815fff, #22d3ee); filter: blur(55px); opacity: .55; } .album-art { position: relative; width: 100%; height: 100%; border-radius: 26px; overflow: hidden; background: radial-gradient(circle at 70% 25%, rgba(255,255,255,.25), transparent 20%), linear-gradient(145deg, #1f123c, #42176d 38%, #136985 75%, #07111f); box-shadow: 0 30px 60px rgba(0,0,0,.45); transition: transform .4s ease; } .album-art.playing { animation: floatArt 4s ease-in-out infinite; } @keyframes floatArt { 0%, 100% { transform: translateY(0) rotate(-1deg); } 50% { transform: translateY(-6px) rotate(1deg); } } .album-inner { width: 100%; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; padding: 26px; } .album-title { font-size: 44px; font-weight: 800; letter-spacing: -3px; } .album-subtitle { margin-top: -6px; font-size: 15px; letter-spacing: 7px; opacity: .65; } .track-meta { display: flex; align-items: center; justify-content: space-between; } .track-meta h2 { margin: 0; font-size: 21px; } .track-meta p { margin: 5px 0 0; color: var(--muted); font-size: 13px; } .equalizer { display: flex; align-items: flex-end; gap: 3px; height: 25px; } .equalizer span { width: 3px; height: 7px; border-radius: 4px; background: linear-gradient(to top, var(--accent), var(--accent-2)); animation: equalize .6s ease-in-out infinite alternate; animation-play-state: paused; } .equalizer span:nth-child(2) { animation-delay: .2s; } .equalizer span:nth-child(3) { animation-delay: .4s; } .equalizer span:nth-child(4) { animation-delay: .1s; } .equalizer.playing span { animation-play-state: running; } @keyframes equalize { from { height: 5px; } to { height: 24px; } } .progress-area { margin-top: 24px; } input[type="range"] { width: 100%; height: 4px; appearance: none; border-radius: 999px; background: linear-gradient( to right, var(--accent) 0%, var(--accent-2) 28%, rgba(255,255,255,.12) 28%, rgba(255,255,255,.12) 100% ); cursor: pointer; } input[type="range"]::-webkit-slider-thumb { appearance: none; width: 13px; height: 13px; border-radius: 50%; background: white; box-shadow: 0 0 0 4px rgba(124,92,255,.22); } .time-row { display: flex; justify-content: space-between; margin-top: 7px; color: var(--muted); font-size: 10px; } .controls { display: flex; align-items: center; justify-content: center; gap: 18px; margin: 24px 0; } .play-btn { width: 62px; height: 62px; border: 0; border-radius: 50%; background: linear-gradient(135deg, #ffffff, #dfe5ff); color: #0a0d15; font-size: 20px; cursor: pointer; box-shadow: 0 10px 30px rgba(124,92,255,.35); transition: transform .2s, box-shadow .2s; } .play-btn:hover { transform: scale(1.06); box-shadow: 0 14px 35px rgba(124,92,255,.48); } .volume-row { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: rgba(255,255,255,.03); } .volume-row input { flex: 1; } .playlist { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); } .playlist-title { margin-bottom: 9px; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: 1.3px; text-transform: uppercase; } .track { width: 100%; display: grid; grid-template-columns: 32px 1fr auto; align-items: center; gap: 10px; padding: 11px 10px; border: 0; border-radius: 12px; background: transparent; color: white; cursor: pointer; text-align: left; transition: background .18s, transform .18s; } .track:hover { background: rgba(255,255,255,.05); } .track.active { background: rgba(124,92,255,.12); } .track-number { color: rgba(255,255,255,.35); font-size: 11px; } .track-info { display: flex; flex-direction: column; } .track-info strong { font-size: 12px; } .track-info span { margin-top: 3px; color: var(--muted); font-size: 10px; } .track-length { color: var(--muted); font-size: 10px; } @media (max-width: 500px) { .player-card { padding: 20px; } .album-wrap { width: 235px; height: 235px; } }
const audio = document.getElementById("audioPlayer"); const playButton = document.getElementById("playBtn"); const albumArt = document.getElementById("albumArt"); const equalizer = document.getElementById("equalizer"); const seekBar = document.getElementById("seekBar"); const volumeBar = document.getElementById("volumeBar"); const favoriteBtn = document.getElementById("favoriteBtn"); const shuffleBtn = document.getElementById("shuffleBtn"); const repeatBtn = document.getElementById("repeatBtn"); const title = document.getElementById("trackTitle"); const artist = document.getElementById("artistName"); const currentTime = document.getElementById("currentTime"); const duration = document.getElementById("duration"); const tracks = document.querySelectorAll(".track"); /* REAL AUDIO PLAYLIST */ const playlist = [ { title: "SoundHelix Song 1", artist: "SoundHelix", src: "https://www.soundhelix.com/examples/mp3/SoundHelix-Song-1.mp3" }, { title: "SoundHelix Song 2", artist: "SoundHelix", src: "https://www.soundhelix.com/examples/mp3/SoundHelix-Song-2.mp3" }, { title: "SoundHelix Song 3", artist: "SoundHelix", src: "https://www.soundhelix.com/examples/mp3/SoundHelix-Song-3.mp3" } ]; let currentTrack = 0; /* LOAD TRACK */ function loadTrack(index) { currentTrack = index; const track = playlist[index]; audio.src = track.src; title.textContent = track.title; artist.textContent = track.artist; seekBar.value = 0; currentTime.textContent = "0:00"; tracks.forEach( function(item) { item.classList.remove( "active" ); } ); if (tracks[index]) { tracks[index] .classList.add( "active" ); } } /* PLAY */ function playTrack() { audio.play(); playButton.textContent = "❚❚"; albumArt.classList.add( "playing" ); equalizer.classList.add( "playing" ); } /* PAUSE */ function pauseTrack() { audio.pause(); playButton.textContent = "▶"; albumArt.classList.remove( "playing" ); equalizer.classList.remove( "playing" ); } /* PLAY BUTTON */ playButton.addEventListener( "click", function() { if (audio.paused) { playTrack(); } else { pauseTrack(); } } ); /* NEXT */ document .getElementById("nextBtn") .addEventListener( "click", function() { if ( shuffleBtn.classList.contains( "active" ) ) { currentTrack = Math.floor( Math.random() * playlist.length ); } else { currentTrack++; if ( currentTrack >= playlist.length ) { currentTrack = 0; } } loadTrack( currentTrack ); playTrack(); } ); /* PREVIOUS */ document .getElementById("prevBtn") .addEventListener( "click", function() { currentTrack--; if (currentTrack < 0) { currentTrack = playlist.length - 1; } loadTrack( currentTrack ); playTrack(); } ); /* PLAYLIST CLICK */ tracks.forEach( function(track) { track.addEventListener( "click", function() { const index = Number( track.dataset.index ); loadTrack( index ); playTrack(); } ); } ); /* AUDIO TIME UPDATE */ audio.addEventListener( "timeupdate", function() { if (!audio.duration) { return; } const percent = ( audio.currentTime / audio.duration ) * 100; seekBar.value = percent; updateRange( seekBar ); currentTime.textContent = formatTime( audio.currentTime ); } ); /* TRACK DURATION */ audio.addEventListener( "loadedmetadata", function() { duration.textContent = formatTime( audio.duration ); } ); /* SEEK */ seekBar.addEventListener( "input", function() { if (!audio.duration) { return; } const time = ( seekBar.value / 100 ) * audio.duration; audio.currentTime = time; updateRange( seekBar ); } ); /* VOLUME */ audio.volume = volumeBar.value / 100; volumeBar.addEventListener( "input", function() { audio.volume = volumeBar.value / 100; updateRange( volumeBar ); } ); /* SONG FINISHED */ audio.addEventListener( "ended", function() { if ( repeatBtn.classList.contains( "active" ) ) { audio.currentTime = 0; playTrack(); return; } currentTrack++; if ( currentTrack >= playlist.length ) { currentTrack = 0; } loadTrack( currentTrack ); playTrack(); } ); /* FAVORITE */ favoriteBtn.addEventListener( "click", function() { favoriteBtn.classList.toggle( "active" ); favoriteBtn.textContent = favoriteBtn.classList.contains( "active" ) ? "♥" : "♡"; } ); /* SHUFFLE */ shuffleBtn.addEventListener( "click", function() { shuffleBtn.classList.toggle( "active" ); } ); /* REPEAT */ repeatBtn.addEventListener( "click", function() { repeatBtn.classList.toggle( "active" ); } ); /* FORMAT TIME */ function formatTime(seconds) { if ( !Number.isFinite(seconds) ) { return "0:00"; } const minutes = Math.floor( seconds / 60 ); const remaining = Math.floor( seconds % 60 ); return ( minutes + ":" + String( remaining ).padStart( 2, "0" ) ); } /* RANGE COLOR */ function updateRange(input) { const value = input.value; input.style.background = ` linear-gradient( to right, #7c5cff 0%, #20d6ff ${value}%, rgba(255,255,255,.12) ${value}%, rgba(255,255,255,.12) 100% ) `; } /* INITIALIZE */ loadTrack(0); updateRange( seekBar ); updateRange( volumeBar );
terminal
JavaScript Console
Preview
Clear
close
›
Run