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>Geometry interactive playground</title> </head> <body> <!-- Start your code here --> <div class="geometry-app"> <header class="topbar"> <div> <div class="eyebrow">GENERATIVE ART STUDIO</div> <h1>GEOMETRY<span>.</span></h1> <p>Simple shapes. Infinite possibilities.</p> </div> <button id="generate" class="generate-btn">↻ Generate</button> </header> <main class="workspace"> <section class="art-panel"> <canvas id="artCanvas"></canvas> <div class="canvas-caption"> <span>COMPOSITION / <b id="composition">001</b></span> <span>GENERATIVE STUDY</span> </div> </section> <aside class="controls"> <div class="panel-heading">DESIGN CONTROLS</div> <div class="control"> <div class="control-label"> <label for="symmetry">Symmetry</label> <output id="symmetryValue">12</output> </div> <input id="symmetry" type="range" min="4" max="32" value="12"> </div> <div class="control"> <div class="control-label"> <label for="layers">Layers</label> <output id="layersValue">6</output> </div> <input id="layers" type="range" min="2" max="12" value="6"> </div> <div class="control"> <div class="control-label"> <label for="complexity">Complexity</label> <output id="complexityValue">5</output> </div> <input id="complexity" type="range" min="1" max="10" value="5"> </div> <div class="control"> <div class="control-label"> <label for="rotation">Rotation</label> <output id="rotationValue">0°</output> </div> <input id="rotation" type="range" min="0" max="360" value="0"> </div> <div class="control"> <div class="control-label"> <label for="palette">Color palette</label> </div> <select id="palette"> <option value="aurora">Aurora</option> <option value="sunset">Sunset</option> <option value="ocean">Ocean</option> <option value="orchid">Orchid</option> <option value="mono">Monochrome</option> </select> </div> <div class="control"> <div class="control-label"> <label for="fill">Fill style</label> </div> <select id="fill"> <option value="mixed">Mixed shapes</option> <option value="outline">Line art</option> <option value="solid">Solid shapes</option> </select> </div> <div class="panel-note"> <span class="note-dot"></span> Adjust the controls to create your own composition. </div> </aside> </main> <footer class="bottom-bar"> <span>GEOMETRY STUDIO</span> <span>ONE SHAPE AT A TIME</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: #172b35; color: #f4eee4; font-family: 'Manrope', sans-serif; } .geometry-app { max-width: 1440px; margin: 0 auto; } .topbar { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 24px; } .eyebrow, .panel-heading, .canvas-caption, .bottom-bar { font-family: 'DM Mono', monospace; letter-spacing: 1.5px; font-size: 10px; color: #9aafb0; } h1 { font-size: clamp(34px, 5vw, 54px); letter-spacing: -3px; line-height: 1; margin: 8px 0; font-weight: 800; } h1 span { color: #e7a66e; } .topbar p { color: #aab9b7; font-size: 13px; margin: 8px 0 0; } .generate-btn { border: 0; border-radius: 6px; background: #e7a66e; color: #24343a; padding: 13px 20px; font: 700 13px 'Manrope', sans-serif; cursor: pointer; transition: transform .2s, background .2s; } .generate-btn:hover { background: #f4bd89; transform: translateY(-2px); } .workspace { display: grid; grid-template-columns: minmax(0, 1fr) 270px; gap: 18px; align-items: stretch; } .art-panel { position: relative; min-width: 0; min-height: 520px; height: min(68vw, 720px); max-height: 720px; background: #203a42; border: 1px solid rgba(211, 226, 213, .12); border-radius: 10px; overflow: hidden; } #artCanvas { display: block; width: 100%; height: 100%; } .canvas-caption { position: absolute; bottom: 18px; left: 20px; right: 20px; display: flex; justify-content: space-between; pointer-events: none; color: #9fb3b0; font-size: 9px; } .canvas-caption b { color: #e7a66e; font-weight: 500; } .controls { background: #203a42; border: 1px solid rgba(211, 226, 213, .12); border-radius: 10px; padding: 24px 20px; } .panel-heading { color: #e7a66e; padding-bottom: 22px; border-bottom: 1px solid rgba(211, 226, 213, .12); margin-bottom: 24px; } .control { margin-bottom: 25px; } .control-label { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; } .control-label label { font-size: 12px; color: #e9e9df; font-weight: 600; } .control-label output { color: #e7a66e; font: 11px 'DM Mono', monospace; } input[type="range"] { width: 100%; accent-color: #e7a66e; cursor: pointer; } select { width: 100%; background: #294750; color: #f4eee4; border: 1px solid rgba(211, 226, 213, .18); padding: 11px; border-radius: 5px; font: 12px 'Manrope', sans-serif; outline: none; } .panel-note { margin-top: 34px; padding-top: 18px; border-top: 1px solid rgba(211, 226, 213, .12); color: #9aafb0; font-size: 11px; line-height: 1.7; } .note-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #e7a66e; margin-right: 7px; } .bottom-bar { display: flex; justify-content: space-between; padding: 18px 2px; color: #829c9c; font-size: 9px; } @media (max-width: 800px) { body { padding: 16px; } .workspace { grid-template-columns: 1fr; } .art-panel { height: min(100vw, 580px); min-height: 350px; } .controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 20px; } .panel-heading, .panel-note { grid-column: 1 / -1; } .panel-heading { margin-bottom: 12px; } .panel-note { margin-top: 10px; } } @media (max-width: 480px) { .controls { grid-template-columns: 1fr; } .topbar { align-items: flex-start; } .generate-btn { padding: 11px 13px; } .canvas-caption span:last-child { display: none; } }
(function () { const canvas = document.getElementById('artCanvas'); const ctx = canvas.getContext('2d'); const controls = { symmetry: document.getElementById('symmetry'), layers: document.getElementById('layers'), complexity: document.getElementById('complexity'), rotation: document.getElementById('rotation'), palette: document.getElementById('palette'), fill: document.getElementById('fill') }; const palettes = { aurora: ['#e7a66e', '#9ac6b5', '#6e9ca2', '#e7d4a3', '#d78e85'], sunset: ['#ed9877', '#e8c17d', '#c96d68', '#9d6d7c', '#f0d9a5'], ocean: ['#77c6c1', '#4f91a0', '#a7d4c5', '#e5c58c', '#477080'], orchid: ['#d5a0c8', '#a78bc5', '#e9b9a0', '#8b9fc2', '#e7d4b2'], mono: ['#f0e8d8', '#b9c5bc', '#879d9a', '#d5b995', '#718487'] }; let width = 0; let height = 0; let seed = 1; let composition = 1; let pointerX = 0; let pointerY = 0; function random() { seed = (seed * 16807) % 2147483647; return (seed - 1) / 2147483646; } function resize() { const rect = canvas.getBoundingClientRect(); const dpr = Math.min(window.devicePixelRatio || 1, 1.5); 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); draw(); } function polygon(radius, sides, rotation, color, fillStyle) { ctx.beginPath(); for (let i = 0; i < sides; i++) { const angle = rotation + (Math.PI * 2 * i / sides); const x = Math.cos(angle) * radius; const y = Math.sin(angle) * radius; if (i === 0) ctx.moveTo(x, y); else ctx.lineTo(x, y); } ctx.closePath(); if (fillStyle !== 'outline') { ctx.fillStyle = color; ctx.fill(); } if (fillStyle !== 'solid') { ctx.strokeStyle = color; ctx.lineWidth = 1.1; ctx.stroke(); } } function drawPetal(radius, angle, color, style) { ctx.save(); ctx.rotate(angle); ctx.beginPath(); ctx.moveTo(0, 0); ctx.bezierCurveTo( radius * 0.25, -radius * 0.42, radius * 0.78, -radius * 0.42, radius, 0 ); ctx.bezierCurveTo( radius * 0.78, radius * 0.42, radius * 0.25, radius * 0.42, 0, 0 ); ctx.closePath(); if (style !== 'outline') { ctx.fillStyle = color; ctx.globalAlpha = 0.42; ctx.fill(); ctx.globalAlpha = 1; } if (style !== 'solid') { ctx.strokeStyle = color; ctx.lineWidth = 1.2; ctx.stroke(); } ctx.restore(); } function draw() { if (!width || !height) return; const symmetry = Number(controls.symmetry.value); const layers = Number(controls.layers.value); const complexity = Number(controls.complexity.value); const rotation = Number(controls.rotation.value) * Math.PI / 180; const style = controls.fill.value; const colors = palettes[controls.palette.value]; ctx.clearRect(0, 0, width, height); const background = ctx.createLinearGradient(0, 0, width, height); background.addColorStop(0, '#203a42'); background.addColorStop(1, '#172e38'); ctx.fillStyle = background; ctx.fillRect(0, 0, width, height); const cx = width / 2 + pointerX; const cy = height / 2 + pointerY; const maxRadius = Math.min(width, height) * 0.39; ctx.save(); ctx.translate(cx, cy); ctx.rotate(rotation); // Subtle background guide circles. ctx.strokeStyle = 'rgba(220, 231, 216, 0.07)'; ctx.lineWidth = 1; for (let i = 1; i <= 4; i++) { ctx.beginPath(); ctx.arc(0, 0, maxRadius * i / 4, 0, Math.PI * 2); ctx.stroke(); } // Main radial composition. for (let layer = layers; layer >= 1; layer--) { const progress = layer / layers; const radius = maxRadius * progress; const color = colors[(layers - layer) % colors.length]; const offset = layer % 2 ? 0 : Math.PI / symmetry; ctx.save(); ctx.rotate(offset); // Repeated petal forms. for (let i = 0; i < symmetry; i++) { const angle = Math.PI * 2 * i / symmetry; ctx.save(); ctx.rotate(angle); const petalLength = radius * (0.55 + complexity * 0.035); drawPetal(petalLength, 0, color, style); if (complexity > 2) { drawPetal( petalLength * 0.65, Math.PI / symmetry, colors[(layers - layer + 2) % colors.length], style ); } ctx.restore(); } // Geometric ring. polygon( radius * 0.74, symmetry, Math.PI / symmetry, color, style ); // Fine radial details. if (complexity > 4) { ctx.strokeStyle = color; ctx.globalAlpha = 0.55; ctx.lineWidth = 0.8; for (let i = 0; i < symmetry; i++) { const angle = Math.PI * 2 * i / symmetry; const inner = radius * 0.18; const outer = radius * 0.72; ctx.beginPath(); ctx.moveTo(Math.cos(angle) * inner, Math.sin(angle) * inner); ctx.lineTo(Math.cos(angle) * outer, Math.sin(angle) * outer); ctx.stroke(); } ctx.globalAlpha = 1; } ctx.restore(); } // Central medallion. const centerColor = colors[0]; ctx.beginPath(); ctx.arc(0, 0, maxRadius * 0.12, 0, Math.PI * 2); if (style !== 'outline') { ctx.fillStyle = centerColor; ctx.fill(); } ctx.strokeStyle = centerColor; ctx.lineWidth = 1.5; ctx.stroke(); ctx.beginPath(); ctx.arc(0, 0, maxRadius * 0.055, 0, Math.PI * 2); ctx.stroke(); ctx.restore(); } function updateLabels() { document.getElementById('symmetryValue').textContent = controls.symmetry.value; document.getElementById('layersValue').textContent = controls.layers.value; document.getElementById('complexityValue').textContent = controls.complexity.value; document.getElementById('rotationValue').textContent = controls.rotation.value + '°'; } Object.keys(controls).forEach(function (key) { controls[key].addEventListener('input', function () { updateLabels(); draw(); }); controls[key].addEventListener('change', draw); }); document.getElementById('generate').addEventListener('click', function () { seed = Math.floor(Math.random() * 1000000) + 1; composition++; document.getElementById('composition').textContent = String(composition).padStart(3, '0'); draw(); }); canvas.addEventListener('pointermove', function (event) { const rect = canvas.getBoundingClientRect(); pointerX = (event.clientX - rect.left - width / 2) * 0.025; pointerY = (event.clientY - rect.top - height / 2) * 0.025; draw(); }); canvas.addEventListener('pointerleave', function () { pointerX = 0; pointerY = 0; draw(); }); if (typeof ResizeObserver !== 'undefined') { const observer = new ResizeObserver(resize); observer.observe(canvas); } else { window.addEventListener('resize', resize); } updateLabels(); resize(); })();
terminal
JavaScript Console
Preview
Clear
close
›
Run