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>Color flow generator</title> </head> <body> <!-- Start your code here --> <div class="flow-app"> <header class="flow-header"> <div> <div class="flow-kicker">GENERATIVE ART STUDIO / 002</div> <h1>COLOR <span>FLOW</span></h1> <p>A living canvas of color, movement and light.</p> </div> <button id="flowPause" class="flow-button">Ⅱ Pause</button> </header> <main class="flow-layout"> <section class="flow-stage"> <canvas id="flowCanvas"></canvas> <div class="flow-overlay"> <span>LIVE COMPOSITION</span> <span id="flowStatus">ANIMATION ACTIVE</span> </div> </section> <aside class="flow-controls"> <div class="flow-section-title">FLOW SETTINGS</div> <div class="flow-control"> <div class="flow-label"> <label for="flowSpeed">Speed</label> <output id="flowSpeedValue">40%</output> </div> <input id="flowSpeed" type="range" min="0" max="100" value="40"> </div> <div class="flow-control"> <div class="flow-label"> <label for="flowDensity">Ribbon density</label> <output id="flowDensityValue">32</output> </div> <input id="flowDensity" type="range" min="8" max="55" value="32"> </div> <div class="flow-control"> <div class="flow-label"> <label for="flowAmplitude">Wave intensity</label> <output id="flowAmplitudeValue">55%</output> </div> <input id="flowAmplitude" type="range" min="10" max="100" value="55"> </div> <div class="flow-control"> <div class="flow-label"> <label for="flowWidth">Ribbon width</label> <output id="flowWidthValue">50%</output> </div> <input id="flowWidth" type="range" min="10" max="100" value="50"> </div> <div class="flow-control"> <div class="flow-label"> <label for="flowPalette">Color palette</label> </div> <select id="flowPalette"> <option value="lagoon">Lagoon</option> <option value="ember">Ember</option> <option value="candy">Candy</option> <option value="forest">Forest</option> <option value="dream">Dream</option> </select> </div> <button id="flowNew" class="flow-new">✦ New composition</button> <div class="flow-hint"> <span class="flow-hint-dot"></span> Move your pointer across the canvas to influence the flow. </div> </aside> </main> <footer class="flow-footer"> <span>COLOR FLOW / EXPERIMENT 01</span> <span>MADE OF MOVEMENT</span> </footer> </div> <!-- End your code here --> </body> </html>
@import url('https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=Manrope:wght@400;500;600;700;800&display=swap'); * { box-sizing: border-box; } body { margin: 0; padding: 28px; background: #172c32; color: #f5f0e8; font-family: 'Manrope', sans-serif; } .flow-app { max-width: 1440px; margin: 0 auto; } .flow-header { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 24px; } .flow-kicker, .flow-section-title, .flow-overlay, .flow-footer { font-family: 'DM Mono', monospace; font-size: 10px; letter-spacing: 1.5px; color: #9aadaa; } .flow-header h1 { font-size: clamp(36px, 5vw, 56px); line-height: 1; letter-spacing: -3px; margin: 9px 0; font-weight: 800; } .flow-header h1 span { color: #e6a77c; } .flow-header p { margin: 8px 0 0; color: #aabbb7; font-size: 13px; } .flow-button { background: #e6a77c; color: #243a3d; border: 0; border-radius: 6px; padding: 12px 19px; font: 700 12px 'Manrope', sans-serif; cursor: pointer; } .flow-button:hover, .flow-new:hover { filter: brightness(1.1); } .flow-layout { display: grid; grid-template-columns: minmax(0, 1fr) 270px; gap: 18px; align-items: stretch; } .flow-stage { position: relative; min-width: 0; height: min(68vw, 720px); min-height: 420px; max-height: 720px; overflow: hidden; border-radius: 10px; border: 1px solid rgba(220, 235, 225, .12); background: #142b33; } #flowCanvas { width: 100%; height: 100%; display: block; touch-action: pan-y; } .flow-overlay { position: absolute; bottom: 18px; left: 20px; right: 20px; display: flex; justify-content: space-between; pointer-events: none; font-size: 9px; color: rgba(235, 240, 225, .65); } .flow-controls { padding: 24px 20px; background: #203a40; border: 1px solid rgba(220, 235, 225, .12); border-radius: 10px; } .flow-section-title { color: #e6a77c; padding-bottom: 22px; margin-bottom: 24px; border-bottom: 1px solid rgba(220, 235, 225, .12); } .flow-control { margin-bottom: 25px; } .flow-label { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; } .flow-label label { font-size: 12px; font-weight: 600; color: #e9eee6; } .flow-label output { color: #e6a77c; font: 11px 'DM Mono', monospace; } .flow-control input[type="range"] { width: 100%; accent-color: #e6a77c; cursor: pointer; } .flow-control select { width: 100%; padding: 11px; color: #f5f0e8; background: #294850; border: 1px solid rgba(220, 235, 225, .16); border-radius: 5px; outline: none; font: 12px 'Manrope', sans-serif; } .flow-new { width: 100%; margin-top: 4px; padding: 13px; background: #d58e75; color: #20353a; border: 0; border-radius: 5px; font: 700 12px 'Manrope', sans-serif; cursor: pointer; } .flow-hint { margin-top: 25px; padding-top: 18px; border-top: 1px solid rgba(220, 235, 225, .12); color: #9aadaa; font-size: 11px; line-height: 1.7; } .flow-hint-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 7px; background: #e6a77c; } .flow-footer { display: flex; justify-content: space-between; padding: 18px 2px; font-size: 9px; color: #829c9c; } @media (max-width: 800px) { body { padding: 16px; } .flow-layout { grid-template-columns: 1fr; } .flow-stage { height: min(100vw, 580px); min-height: 340px; } .flow-controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 20px; } .flow-section-title, .flow-hint, .flow-new { grid-column: 1 / -1; } .flow-section-title { margin-bottom: 12px; } .flow-hint { margin-top: 10px; } } @media (max-width: 480px) { .flow-controls { grid-template-columns: 1fr; } .flow-header { align-items: flex-start; } .flow-button { padding: 11px 13px; } }
(function () { const canvas = document.getElementById('flowCanvas'); const ctx = canvas.getContext('2d'); if (!ctx) return; const $ = function (id) { return document.getElementById(id); }; const controls = { speed: $('flowSpeed'), density: $('flowDensity'), amplitude: $('flowAmplitude'), width: $('flowWidth'), palette: $('flowPalette') }; const palettes = { lagoon: ['#50d5c0', '#328eaa', '#8de0ce', '#e4c18b', '#70a9c0'], ember: ['#f18a64', '#d95e65', '#f4bd78', '#a94f60', '#f2d19b'], candy: ['#f18db3', '#a88bea', '#68cbd0', '#f4b2a1', '#e5a4db'], forest: ['#a7c96e', '#4d9c83', '#d4c78c', '#568c69', '#b4d5a0'], dream: ['#b7a1ee', '#6ec6d5', '#e7a8c5', '#e8cf9a', '#83b6d6'] }; let width = 0; let height = 0; let dpr = 1; let time = 0; let lastFrame = 0; let animationId = 0; let running = true; let pointer = { x: 0.5, y: 0.5, active: false }; let compositionOffset = Math.random() * 100; let resizeObserver = null; const reducedMotion = window.matchMedia && window.matchMedia('(prefers-reduced-motion: reduce)').matches; if (reducedMotion) running = false; function resize() { const rect = canvas.getBoundingClientRect(); if (!rect.width || !rect.height) return; width = rect.width; height = rect.height; dpr = Math.min(window.devicePixelRatio || 1, 1.5); canvas.width = Math.round(width * dpr); canvas.height = Math.round(height * dpr); ctx.setTransform(dpr, 0, 0, dpr, 0, 0); draw(); } function getSettings() { return { speed: Number(controls.speed.value) / 100, density: Number(controls.density.value), amplitude: Number(controls.amplitude.value) / 100, ribbonWidth: Number(controls.width.value) / 100, colors: palettes[controls.palette.value] }; } function background() { const gradient = ctx.createLinearGradient(0, 0, width, height); gradient.addColorStop(0, '#142a35'); gradient.addColorStop(0.55, '#193a43'); gradient.addColorStop(1, '#152b35'); ctx.fillStyle = gradient; ctx.fillRect(0, 0, width, height); const glow = ctx.createRadialGradient( width * 0.5, height * 0.5, 5, width * 0.5, height * 0.5, Math.max(width, height) * 0.7 ); glow.addColorStop(0, 'rgba(80, 170, 155, 0.13)'); glow.addColorStop(1, 'rgba(10, 25, 35, 0)'); ctx.fillStyle = glow; ctx.fillRect(0, 0, width, height); } function draw() { if (!width || !height) return; const settings = getSettings(); const colors = settings.colors; const count = settings.density; const amplitude = settings.amplitude * height * 0.21; const lineWidth = 0.5 + settings.ribbonWidth * 3.5; const phase = time * (0.25 + settings.speed * 1.5) + compositionOffset; background(); // A small pointer influence creates a gentle local current. const pointerX = pointer.x * width; const pointerY = pointer.y * height; for (let i = 0; i < count; i++) { const progress = i / Math.max(1, count - 1); const baseY = height * (0.12 + progress * 0.76); const ribbonPhase = phase + i * 0.19; const color = colors[i % colors.length]; const gradient = ctx.createLinearGradient(0, 0, width, 0); gradient.addColorStop(0, colors[(i + 0) % colors.length]); gradient.addColorStop(0.5, colors[(i + 2) % colors.length]); gradient.addColorStop(1, colors[(i + 3) % colors.length]); ctx.beginPath(); const steps = Math.max(45, Math.min(90, Math.round(width / 8))); for (let j = 0; j <= steps; j++) { const x = (j / steps) * width; const nx = j / steps; const wave1 = Math.sin(nx * 6.2 + ribbonPhase) * amplitude; const wave2 = Math.sin(nx * 11.5 - ribbonPhase * 0.7 + i * 0.12) * amplitude * 0.34; const wave3 = Math.sin(nx * 2.8 + ribbonPhase * 0.45) * amplitude * 0.5; let y = baseY + wave1 + wave2 + wave3; if (pointer.active) { const dx = (x - pointerX) / (width * 0.22); const dy = (baseY - pointerY) / (height * 0.28); const distance = dx * dx + dy * dy; const influence = Math.exp(-distance * 2.2); y += Math.sin(dx * 4 + ribbonPhase) * amplitude * 0.8 * influence; } if (j === 0) { ctx.moveTo(x, y); } else { ctx.lineTo(x, y); } } const opacity = 0.28 + (0.48 * (1 - Math.abs(progress - 0.5) * 1.5)); ctx.strokeStyle = gradient; ctx.globalAlpha = Math.max(0.15, opacity); ctx.lineWidth = lineWidth * (0.65 + 0.35 * Math.sin(i * 0.3)); ctx.lineCap = 'round'; ctx.lineJoin = 'round'; ctx.stroke(); // A subtle highlight makes the ribbons feel layered. if (i % 3 === 0) { ctx.globalAlpha = 0.22; ctx.lineWidth = 0.7; ctx.strokeStyle = '#e9f5dd'; ctx.stroke(); } } ctx.globalAlpha = 1; } function updateLabels() { $('flowSpeedValue').textContent = controls.speed.value + '%'; $('flowDensityValue').textContent = controls.density.value; $('flowAmplitudeValue').textContent = controls.amplitude.value + '%'; $('flowWidthValue').textContent = controls.width.value + '%'; } function animate(timestamp) { animationId = 0; if (!running || document.hidden) return; if (timestamp - lastFrame >= 33) { const delta = lastFrame ? Math.min((timestamp - lastFrame) / 1000, 0.06) : 0.033; lastFrame = timestamp; time += delta; draw(); } animationId = requestAnimationFrame(animate); } function start() { if (running && !document.hidden && !animationId) { lastFrame = 0; animationId = requestAnimationFrame(animate); } } function stop() { if (animationId) { cancelAnimationFrame(animationId); animationId = 0; } } Object.keys(controls).forEach(function (key) { controls[key].addEventListener('input', function () { updateLabels(); draw(); }); }); $('flowPause').addEventListener('click', function () { running = !running; $('flowPause').textContent = running ? 'Ⅱ Pause' : '▶ Play'; $('flowStatus').textContent = running ? 'ANIMATION ACTIVE' : 'ANIMATION PAUSED'; if (running) { start(); } else { stop(); } }); $('flowNew').addEventListener('click', function () { compositionOffset = Math.random() * 100; time = 0; draw(); }); canvas.addEventListener('pointermove', function (event) { const rect = canvas.getBoundingClientRect(); pointer.x = (event.clientX - rect.left) / rect.width; pointer.y = (event.clientY - rect.top) / rect.height; pointer.active = true; if (!running) draw(); }); canvas.addEventListener('pointerleave', function () { pointer.active = false; if (!running) draw(); }); document.addEventListener('visibilitychange', function () { if (document.hidden) { stop(); } else { start(); } }); if (typeof ResizeObserver !== 'undefined') { resizeObserver = new ResizeObserver(resize); resizeObserver.observe(canvas); } else { window.addEventListener('resize', resize); } updateLabels(); resize(); start(); })();
terminal
JavaScript Console
Preview
Clear
close
›
Run