Material Switcher
One sphere in five materials: matte, glossy, brushed metal, glass and velvet; the light follows your pointer.
AI prompt
Product render of a sphere in polished brushed aluminium on a seamless light grey backdrop, long soft strip light from the upper left creating bright mirrored bands that wrap around the form, fine horizontal brushing grain, crisp contact shadow, shallow depth, studio photography. Material set: matte clay (soft diffuse shading, no highlight), glossy ceramic (sharp white highlight, clear reflection of a softbox), clear glass (transparent, refracting the striped background, thin bright rim), velvet (dark centre, bright fuzzy rim, no highlight). Negative: plastic look, noisy textures, unrealistic reflections, text.About this pattern
Definition
A material is defined by how its surface answers light: diffuse (matte), a sharp highlight (glossy), mirrored bands (metal), transparency with refraction (glass) or a bright rim with a dark centre (velvet).
When to use it
- Saying the material is the quickest way to change the whole feel of a product or object render.
- Mention the surface finish too: polished, brushed, satin, frosted.
- Describe the light that reveals it: a softbox for gloss, a hard strip for metal, a backlight for glass.
What the controls do
- Five buttons choose the material; moving the pointer over the stage moves the light.
Motion & timing
- The highlight follows the pointer; material changes cross-fade over 200ms.
- Reduced motion: no cross-fade; the highlight still follows the pointer.
Tips & variations
- Highlights are the main cue; keep them visible at small sizes.
- Check that materials still differ in greyscale.
Code of this live preview
<div class="bx"><div class="stg" id="stg"><div class="ball" id="ball"><i class="hl" id="hl"></i></div></div>
<div class="pre" id="pre" role="group" aria-label="Material"><button data-m="matte" aria-pressed="true">Matte</button><button data-m="gloss" aria-pressed="false">Glossy</button><button data-m="metal" aria-pressed="false">Metal</button><button data-m="glass" aria-pressed="false">Glass</button><button data-m="velvet" aria-pressed="false">Velvet</button></div><p class="out" id="out" aria-live="polite"></p></div>:root{--bg:#F1F1EF;--surface:#fff;--surface-2:#F7F7F5;--line:#E0E0DC;--text:#171717;--muted:#6f6f6f;--accent:#171717;--accent-ink:#fff;--danger:#d92d20}
*{box-sizing:border-box;margin:0}
.bx{width:min(300px,100%);display:grid;gap:8px}
.stg{position:relative;height:150px;border-radius:12px;display:grid;place-items:center;background:repeating-linear-gradient(90deg,#e4e4e0 0 18px,#cfcfca 18px 36px)}
.ball{position:relative;width:100px;height:100px;border-radius:50%;transition:background .2s,box-shadow .2s,backdrop-filter .2s}
.hl{position:absolute;left:calc(var(--lx,35%) - 14px);top:calc(var(--ly,28%) - 9px);width:28px;height:18px;border-radius:50%;background:#fff;opacity:0;filter:blur(1.5px);pointer-events:none;transition:opacity .2s}
.m-matte{background:radial-gradient(circle at var(--lx,35%) var(--ly,28%),#ecd3ae,#c29b6a 60%,#8a6540);box-shadow:0 14px 14px -8px rgba(60,40,20,.4)}
.m-gloss{background:radial-gradient(circle at var(--lx,35%) var(--ly,28%),#9ec3e6,#3a6ea5 55%,#1d3d63);box-shadow:0 14px 14px -8px rgba(20,40,70,.45)}.m-gloss .hl{opacity:.95}
.m-metal{background:linear-gradient(calc(var(--ang,160) * 1deg),#f7f7f7,#8d8d8d 28%,#e8e8e8 46%,#5e5e5e 66%,#cfcfcf 85%,#8a8a8a);box-shadow:0 14px 14px -8px rgba(0,0,0,.4)}
.m-glass{background:rgba(255,255,255,.08);box-shadow:inset 0 0 0 2px rgba(255,255,255,.7),inset 6px 8px 18px rgba(255,255,255,.35),0 12px 14px -8px rgba(0,0,0,.25);-webkit-backdrop-filter:blur(2px) saturate(1.2);backdrop-filter:blur(2px) saturate(1.2)}.m-glass .hl{opacity:.8}
.m-velvet{background:radial-gradient(circle at 50% 50%,#3a0a18 50%,#7a1f3d 80%,#c0446e);box-shadow:0 14px 14px -8px rgba(60,10,30,.45)}
.pre{display:grid;grid-template-columns:repeat(5,1fr);gap:4px}
.pre button{height:28px;border-radius:99px;border:1px solid var(--line);background:var(--surface);font:inherit;font-size:11px;cursor:pointer;padding:0}
.pre button[aria-pressed=true]{background:var(--accent);color:var(--accent-ink);border-color:var(--accent)}
button:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
.out{font-size:12px;color:var(--muted);line-height:1.4}.out b{color:var(--text)}
@media (prefers-reduced-motion:reduce){.ball,.hl{transition:none}}const stage=document.getElementById('stg'),ball=document.getElementById('ball'),out=document.getElementById('out'),bs=[...document.querySelectorAll('#pre button')];
const T={matte:'diffuse shading, no highlight',gloss:'a sharp white highlight and clear reflection',metal:'mirrored light and dark bands that wrap the form',glass:'transparent, refracts the stripes, thin bright rim',velvet:'dark centre, bright fuzzy rim, no highlight'};
function show(k){ball.className='ball m-'+k;out.innerHTML='<b>'+bs.find(b=>b.dataset.m===k).textContent+'</b>: '+T[k];bs.forEach(b=>b.setAttribute('aria-pressed',String(b.dataset.m===k)));}
stage.addEventListener('pointermove',e=>{const r=ball.getBoundingClientRect(),x=Math.max(10,Math.min(90,(e.clientX-r.left)/r.width*100)),y=Math.max(10,Math.min(90,(e.clientY-r.top)/r.height*100));
ball.style.setProperty('--lx',x+'%');ball.style.setProperty('--ly',y+'%');ball.style.setProperty('--ang',120+x*.8);});
bs.forEach(b=>b.addEventListener('click',()=>show(b.dataset.m)));show('matte');One complete HTML file. Save it and open it in a browser.
<!doctype html>
<html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Material Switcher — demo</title>
<style>
:root{--bg:#F1F1EF;--surface:#fff;--surface-2:#F7F7F5;--line:#E0E0DC;--text:#171717;--muted:#6f6f6f;--accent:#171717;--accent-ink:#fff;--danger:#d92d20}
*{box-sizing:border-box;margin:0}
html,body{height:100%}body{background:var(--bg);color:var(--text);font:15px/1.5 -apple-system,BlinkMacSystemFont,'Segoe UI',Inter,Roboto,sans-serif;-webkit-font-smoothing:antialiased}.stage{min-height:100%;display:grid;place-items:center;padding:24px}button,input,select,textarea{font-family:inherit}@media (prefers-reduced-motion:reduce){html{scroll-behavior:auto}}
.bx{width:min(300px,100%);display:grid;gap:8px}
.stg{position:relative;height:150px;border-radius:12px;display:grid;place-items:center;background:repeating-linear-gradient(90deg,#e4e4e0 0 18px,#cfcfca 18px 36px)}
.ball{position:relative;width:100px;height:100px;border-radius:50%;transition:background .2s,box-shadow .2s,backdrop-filter .2s}
.hl{position:absolute;left:calc(var(--lx,35%) - 14px);top:calc(var(--ly,28%) - 9px);width:28px;height:18px;border-radius:50%;background:#fff;opacity:0;filter:blur(1.5px);pointer-events:none;transition:opacity .2s}
.m-matte{background:radial-gradient(circle at var(--lx,35%) var(--ly,28%),#ecd3ae,#c29b6a 60%,#8a6540);box-shadow:0 14px 14px -8px rgba(60,40,20,.4)}
.m-gloss{background:radial-gradient(circle at var(--lx,35%) var(--ly,28%),#9ec3e6,#3a6ea5 55%,#1d3d63);box-shadow:0 14px 14px -8px rgba(20,40,70,.45)}.m-gloss .hl{opacity:.95}
.m-metal{background:linear-gradient(calc(var(--ang,160) * 1deg),#f7f7f7,#8d8d8d 28%,#e8e8e8 46%,#5e5e5e 66%,#cfcfcf 85%,#8a8a8a);box-shadow:0 14px 14px -8px rgba(0,0,0,.4)}
.m-glass{background:rgba(255,255,255,.08);box-shadow:inset 0 0 0 2px rgba(255,255,255,.7),inset 6px 8px 18px rgba(255,255,255,.35),0 12px 14px -8px rgba(0,0,0,.25);-webkit-backdrop-filter:blur(2px) saturate(1.2);backdrop-filter:blur(2px) saturate(1.2)}.m-glass .hl{opacity:.8}
.m-velvet{background:radial-gradient(circle at 50% 50%,#3a0a18 50%,#7a1f3d 80%,#c0446e);box-shadow:0 14px 14px -8px rgba(60,10,30,.45)}
.pre{display:grid;grid-template-columns:repeat(5,1fr);gap:4px}
.pre button{height:28px;border-radius:99px;border:1px solid var(--line);background:var(--surface);font:inherit;font-size:11px;cursor:pointer;padding:0}
.pre button[aria-pressed=true]{background:var(--accent);color:var(--accent-ink);border-color:var(--accent)}
button:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
.out{font-size:12px;color:var(--muted);line-height:1.4}.out b{color:var(--text)}
@media (prefers-reduced-motion:reduce){.ball,.hl{transition:none}}
</style></head>
<body><div class="stage">
<div class="bx"><div class="stg" id="stg"><div class="ball" id="ball"><i class="hl" id="hl"></i></div></div>
<div class="pre" id="pre" role="group" aria-label="Material"><button data-m="matte" aria-pressed="true">Matte</button><button data-m="gloss" aria-pressed="false">Glossy</button><button data-m="metal" aria-pressed="false">Metal</button><button data-m="glass" aria-pressed="false">Glass</button><button data-m="velvet" aria-pressed="false">Velvet</button></div><p class="out" id="out" aria-live="polite"></p></div>
</div>
<script>
const stage=document.getElementById('stg'),ball=document.getElementById('ball'),out=document.getElementById('out'),bs=[...document.querySelectorAll('#pre button')];
const T={matte:'diffuse shading, no highlight',gloss:'a sharp white highlight and clear reflection',metal:'mirrored light and dark bands that wrap the form',glass:'transparent, refracts the stripes, thin bright rim',velvet:'dark centre, bright fuzzy rim, no highlight'};
function show(k){ball.className='ball m-'+k;out.innerHTML='<b>'+bs.find(b=>b.dataset.m===k).textContent+'</b>: '+T[k];bs.forEach(b=>b.setAttribute('aria-pressed',String(b.dataset.m===k)));}
stage.addEventListener('pointermove',e=>{const r=ball.getBoundingClientRect(),x=Math.max(10,Math.min(90,(e.clientX-r.left)/r.width*100)),y=Math.max(10,Math.min(90,(e.clientY-r.top)/r.height*100));
ball.style.setProperty('--lx',x+'%');ball.style.setProperty('--ly',y+'%');ball.style.setProperty('--ang',120+x*.8);});
bs.forEach(b=>b.addEventListener('click',()=>show(b.dataset.m)));show('matte');
</script>
</body></html>