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
Night mode
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
<!DOCTYPE html> <html> <head> <title>Autumn leaves</title> </head> <body> <!-- Start your code here --> <div class="autumn-scene"> <canvas id="leafCanvas"></canvas> <div class="sky-glow"></div> <div class="sun"></div> <div class="landscape"> <div class="hill hill-back"></div> <div class="hill hill-front"></div> <div class="ground"></div> </div> <header class="topbar"> <div class="brand"><span>✦</span> SEASONAL MOMENTS</div> <div class="season-label">NOVEMBER · 2026</div> </header> <main class="hero"> <div class="eyebrow"> <span></span> A LITTLE AUTUMN MAGIC </div> <h1>Autumn<br><em>Leaves</em></h1> <div class="ornament">✦ ───────── ✦</div> <p class="message"> The world slows down.<br> The leaves let go.<br> And everything becomes a little more beautiful. </p> <div class="thankful">GIVE THANKS. FIND BEAUTY. ENJOY THE MOMENT.</div> <button id="gustButton" class="gust-button"> <span>✧</span> Send a gentle breeze </button> </main> <div class="bottom-panel"> <div class="stat"> <span class="stat-number" id="leafCount">0</span> <span class="stat-label">LEAVES IN MOTION</span> </div> <div class="controls"> <label> <span>Wind</span> <input id="windControl" type="range" min="0" max="100" value="35"> </label> <label> <span>Density</span> <input id="densityControl" type="range" min="20" max="180" value="100"> </label> <label> <span>Speed</span> <input id="speedControl" type="range" min="20" max="180" value="100"> </label> <button id="pauseButton" class="pause-button" aria-label="Pause animation">Ⅱ</button> </div> </div> <div class="hint">MOVE YOUR MOUSE TO PLAY WITH THE WIND</div> </div> <!-- End your code here --> </body> </html>
@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,400;0,500;0,600;1,400;1,500;1,600&family=DM+Sans:wght@400;500;600&display=swap'); * { box-sizing: border-box; } html, body { margin: 0; width: 100%; min-height: 100%; } body { background: #211b19; font-family: 'DM Sans', sans-serif; } .autumn-scene { position: relative; width: 100%; min-height: 680px; height: 100vh; overflow: hidden; isolation: isolate; background: linear-gradient( 180deg, #302522 0%, #744332 37%, #c27645 67%, #e3a56a 100% ); color: #fff4df; } #leafCanvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 5; pointer-events: none; } .sky-glow { position: absolute; width: 75vw; height: 65vw; max-height: 700px; max-width: 900px; top: 8%; left: 50%; transform: translateX(-50%); background: radial-gradient( ellipse, rgba(255, 195, 115, .35), rgba(236, 133, 76, .12) 45%, transparent 70% ); z-index: 0; } .sun { position: absolute; width: 190px; height: 190px; border-radius: 50%; background: radial-gradient( circle at 40% 40%, #ffe7ae, #f8bd79 55%, rgba(250, 173, 97, .3) ); top: 17%; right: 17%; opacity: .72; box-shadow: 0 0 100px rgba(255, 194, 115, .4); } .landscape { position: absolute; inset: 0; z-index: 1; pointer-events: none; } .hill { position: absolute; width: 140%; left: -20%; border-radius: 50% 50% 0 0; } .hill-back { height: 43%; bottom: -17%; background: linear-gradient(150deg, #70402e, #3c2923); transform: rotate(-5deg); } .hill-front { height: 34%; bottom: -16%; background: linear-gradient(160deg, #593526, #251e1c); transform: rotate(5deg); } .ground { position: absolute; bottom: 0; height: 15%; width: 100%; background: linear-gradient( 180deg, rgba(62, 39, 27, .2), #211b19 ); } .topbar { position: absolute; z-index: 10; top: 0; left: 0; width: 100%; padding: 30px 5%; display: flex; justify-content: space-between; align-items: center; } .brand { font-size: 11px; font-weight: 600; letter-spacing: 3px; } .brand span { color: #f8bd79; margin-right: 9px; } .season-label { font-size: 10px; letter-spacing: 2px; color: rgba(255, 240, 218, .65); } .hero { position: absolute; z-index: 8; top: 50%; left: 12%; transform: translateY(-52%); max-width: 580px; } .eyebrow { font-size: 10px; letter-spacing: 4px; color: #ffd69e; margin-bottom: 25px; } .eyebrow span { display: inline-block; width: 25px; height: 1px; vertical-align: middle; margin-right: 10px; background: #ffd69e; } h1 { font-family: 'Cormorant Garamond', serif; font-weight: 400; font-size: clamp(85px, 12vw, 155px); line-height: .72; letter-spacing: -5px; margin: 0; text-shadow: 0 8px 40px rgba(43, 23, 15, .2); } h1 em { font-weight: 400; color: #ffcf91; } .ornament { color: #f5bc78; font-size: 12px; letter-spacing: 3px; margin: 38px 0 20px; } .message { font-family: 'Cormorant Garamond', serif; font-size: 23px; line-height: 1.5; color: rgba(255, 241, 220, .9); margin: 0; } .thankful { margin-top: 29px; font-size: 9px; letter-spacing: 2px; color: #ffd49b; } .gust-button { margin-top: 35px; padding: 13px 22px; border: 1px solid rgba(255, 221, 176, .55); border-radius: 30px; background: rgba(255, 239, 215, .08); color: #fff0d8; font-family: inherit; font-size: 11px; letter-spacing: 1px; cursor: pointer; backdrop-filter: blur(8px); transition: .3s ease; } .gust-button:hover { background: rgba(255, 239, 215, .2); transform: translateY(-3px); } .gust-button span { margin-right: 8px; color: #ffd18f; } .bottom-panel { position: absolute; z-index: 10; bottom: 35px; left: 5%; right: 5%; display: flex; justify-content: space-between; align-items: center; gap: 25px; } .stat { display: flex; flex-direction: column; gap: 5px; } .stat-number { font-family: 'Cormorant Garamond', serif; font-size: 34px; color: #ffdaa7; } .stat-label { font-size: 8px; letter-spacing: 2px; color: rgba(255, 241, 220, .6); } .controls { display: flex; align-items: center; gap: 22px; padding: 13px 18px; background: rgba(32, 23, 19, .3); border: 1px solid rgba(255, 238, 218, .15); border-radius: 12px; backdrop-filter: blur(12px); } .controls label { display: flex; flex-direction: column; gap: 7px; font-size: 9px; letter-spacing: 1px; color: #f3d9bd; } .controls input { width: 90px; accent-color: #e8a15f; cursor: pointer; } .pause-button { border: 0; background: none; color: #ffe2bd; font-size: 17px; cursor: pointer; padding: 5px; } .hint { position: absolute; z-index: 10; bottom: 14px; width: 100%; text-align: center; font-size: 8px; letter-spacing: 2px; color: rgba(255, 235, 210, .4); } @media (max-width: 700px) { .autumn-scene { min-height: 720px; } .topbar { padding: 22px 6%; } .brand { font-size: 9px; letter-spacing: 2px; } .season-label { font-size: 8px; } .hero { left: 8%; top: 43%; transform: translateY(-50%); } h1 { font-size: clamp(85px, 19vw, 125px); } .message { font-size: 20px; } .sun { width: 130px; height: 130px; right: 8%; top: 14%; } .bottom-panel { bottom: 38px; left: 7%; right: 7%; flex-direction: column; align-items: stretch; gap: 14px; } .stat { flex-direction: row; align-items: baseline; gap: 12px; } .stat-number { font-size: 25px; } .controls { justify-content: space-between; gap: 8px; padding: 12px; } .controls input { width: 65px; } .hint { bottom: 12px; font-size: 7px; } } @media (prefers-reduced-motion: reduce) { .gust-button { transition: none; } }
(() => { const canvas = document.getElementById("leafCanvas"); const ctx = canvas.getContext("2d"); const countDisplay = document.getElementById("leafCount"); const windControl = document.getElementById("windControl"); const densityControl = document.getElementById("densityControl"); const speedControl = document.getElementById("speedControl"); const gustButton = document.getElementById("gustButton"); const pauseButton = document.getElementById("pauseButton"); if (!canvas || !ctx) return; const colors = [ "#d84e25", "#ed762d", "#f4a43c", "#e8b94c", "#a94b29", "#bd3929", "#dc8c39", "#c9a14d" ]; let width = 0; let height = 0; let leaves = []; let particles = []; let paused = false; let lastTime = 0; let elapsed = 0; let gust = 0; let wind = 0.35; let speed = 1; let density = 100; const pointer = { x: -1000, y: -1000, active: false }; const random = (min, max) => Math.random() * (max - min) + min; function resize() { const rect = canvas.getBoundingClientRect(); const dpr = Math.min(window.devicePixelRatio || 1, 2); width = rect.width; height = rect.height; canvas.width = Math.round(width * dpr); canvas.height = Math.round(height * dpr); ctx.setTransform(dpr, 0, 0, dpr, 0, 0); const target = Math.round( width * height / 9500 * density / 100 ); while (leaves.length < target) { leaves.push(createLeaf(true)); } if (leaves.length > target) { leaves.length = target; } } function createLeaf(initial = false) { const size = random(8, 21); return { x: random(0, width), y: initial ? random(-height, height) : -size * 2, size, rotation: random(0, Math.PI * 2), rotationSpeed: random(-1.5, 1.5), fallSpeed: random(25, 75), sway: random(0.7, 2.2), swayOffset: random(0, Math.PI * 2), drift: random(-18, 18), color: colors[Math.floor(Math.random() * colors.length)], flip: random(0.6, 1.5), alpha: random(0.65, 1), depth: random(0.6, 1.4) }; } function drawLeaf(leaf) { ctx.save(); ctx.translate(leaf.x, leaf.y); ctx.rotate(leaf.rotation); // Flip the leaf as it tumbles. const flip = Math.cos(elapsed * leaf.flip + leaf.swayOffset); ctx.scale(flip, 1); const s = leaf.size; ctx.globalAlpha = leaf.alpha; // Leaf silhouette. ctx.beginPath(); ctx.moveTo(0, -s); ctx.bezierCurveTo( s * 0.9, -s * 0.8, s * 1.3, -s * 0.1, s * 0.65, s * 0.35 ); ctx.bezierCurveTo( s * 0.4, s * 0.8, s * 0.15, s * 0.9, 0, s ); ctx.bezierCurveTo( -s * 0.15, s * 0.9, -s * 0.4, s * 0.8, -s * 0.65, s * 0.35 ); ctx.bezierCurveTo( -s * 1.3, -s * 0.1, -s * 0.9, -s * 0.8, 0, -s ); ctx.closePath(); ctx.fillStyle = leaf.color; ctx.fill(); // Central vein. ctx.beginPath(); ctx.moveTo(0, -s * 0.85); ctx.lineTo(0, s * 0.85); ctx.strokeStyle = "rgba(80, 38, 20, .45)"; ctx.lineWidth = 0.8; ctx.stroke(); // Side veins. for (let i = 0; i < 3; i++) { const y = -s * 0.45 + i * s * 0.35; ctx.beginPath(); ctx.moveTo(0, y); ctx.lineTo(s * 0.45, y - s * 0.15); ctx.moveTo(0, y); ctx.lineTo(-s * 0.45, y - s * 0.15); ctx.strokeStyle = "rgba(80, 38, 20, .3)"; ctx.lineWidth = 0.5; ctx.stroke(); } // Small stem. ctx.beginPath(); ctx.moveTo(0, s * 0.8); ctx.lineTo(0, s * 1.15); ctx.strokeStyle = "rgba(85, 45, 25, .7)"; ctx.lineWidth = 1.1; ctx.stroke(); ctx.restore(); } function createBurst(x, y) { for (let i = 0; i < 18; i++) { particles.push({ x, y, vx: random(-180, 180), vy: random(-180, 60), size: random(5, 13), color: colors[Math.floor(Math.random() * colors.length)], life: 1, rotation: random(0, Math.PI * 2), spin: random(-5, 5) }); } } function updateParticles(dt) { for (let i = particles.length - 1; i >= 0; i--) { const p = particles[i]; p.x += p.vx * dt; p.y += p.vy * dt; p.vy += 120 * dt; p.rotation += p.spin * dt; p.life -= dt * 0.65; if (p.life <= 0) { particles.splice(i, 1); continue; } ctx.save(); ctx.translate(p.x, p.y); ctx.rotate(p.rotation); ctx.globalAlpha = p.life; ctx.fillStyle = p.color; ctx.fillRect(-p.size / 2, -p.size / 2, p.size, p.size * 0.6); ctx.restore(); } } function updateLeaves(dt) { const activeWind = wind + gust; for (const leaf of leaves) { const wave = Math.sin(elapsed * leaf.sway + leaf.swayOffset) * 30; // Gentle wind response. let windForce = activeWind * 85 + leaf.drift + wave; // Mouse creates a local wind field. if (pointer.active) { const dx = leaf.x - pointer.x; const dy = leaf.y - pointer.y; const distance = Math.sqrt(dx * dx + dy * dy); if (distance < 160 && distance > 0) { const force = (1 - distance / 160) * 180; windForce += (dx / distance) * force; leaf.fallSpeed += (dy / distance) * force * 0.002; } } leaf.x += windForce * dt * leaf.depth; leaf.y += leaf.fallSpeed * speed * dt * leaf.depth; leaf.rotation += leaf.rotationSpeed * dt * speed; // Wrap around the edges. if (leaf.x > width + 40) leaf.x = -40; if (leaf.x < -40) leaf.x = width + 40; // Recycle leaves at the bottom. if (leaf.y > height + 40) { Object.assign(leaf, createLeaf(false)); } drawLeaf(leaf); } } function animate(timestamp) { requestAnimationFrame(animate); if (paused) { lastTime = timestamp; return; } const dt = lastTime ? Math.min((timestamp - lastTime) / 1000, 0.04) : 0; lastTime = timestamp; elapsed += dt; // Wind gust gradually fades. gust *= Math.pow(0.08, dt); // Clear previous frame. ctx.clearRect(0, 0, width, height); updateLeaves(dt); updateParticles(dt); countDisplay.textContent = leaves.length; if (gust < 0.005) gust = 0; } function sendGust(x, y) { gust = 2.5; createBurst( x ?? width * 0.5, y ?? height * 0.5 ); } // Interactive wind. canvas.parentElement.addEventListener("pointermove", e => { const rect = canvas.getBoundingClientRect(); pointer.x = e.clientX - rect.left; pointer.y = e.clientY - rect.top; pointer.active = true; }); canvas.parentElement.addEventListener("pointerleave", () => { pointer.active = false; }); canvas.parentElement.addEventListener("pointerdown", e => { const rect = canvas.getBoundingClientRect(); sendGust( e.clientX - rect.left, e.clientY - rect.top ); }); gustButton.addEventListener("click", () => { sendGust( random(width * 0.2, width * 0.8), random(height * 0.2, height * 0.8) ); }); windControl.addEventListener("input", () => { wind = Number(windControl.value) / 100; }); densityControl.addEventListener("input", () => { density = Number(densityControl.value); resize(); }); speedControl.addEventListener("input", () => { speed = Number(speedControl.value) / 100; }); pauseButton.addEventListener("click", () => { paused = !paused; pauseButton.textContent = paused ? "▶" : "Ⅱ"; pauseButton.setAttribute( "aria-label", paused ? "Resume animation" : "Pause animation" ); if (!paused) lastTime = 0; }); window.addEventListener("resize", resize); wind = Number(windControl.value) / 100; resize(); // Start the animation. requestAnimationFrame(animate); })();
terminal
JavaScript Console
Preview
Clear
close
›
Run