feat: implement UI-3D state consistency switcher for week 3 task 3 in r3f

This commit is contained in:
divyap 2026-04-12 12:30:37 +05:30
parent b787546d6c
commit d99a41b6b8
2 changed files with 43 additions and 0 deletions

View File

@ -4,6 +4,45 @@
position: relative; position: relative;
background-color: white; background-color: white;
overflow: hidden; overflow: hidden;
font-family: 'Inter', system-ui, -apple-system, sans-serif;
}
#controls {
position: absolute;
top: 20px;
left: 20px;
z-index: 10;
display: flex;
gap: 12px;
background: rgba(255, 255, 255, 0.8);
backdrop-filter: blur(10px);
padding: 16px;
border-radius: 12px;
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
border: 1px solid rgba(0, 0, 0, 0.05);
}
button {
padding: 10px 18px;
border: none;
border-radius: 8px;
background: white;
color: #333;
cursor: pointer;
font-weight: 500;
transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}
button:hover {
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}
button.active {
background: #333;
color: white;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
} }
.canvas-wrapper { .canvas-wrapper {

View File

@ -15,6 +15,10 @@ const variants = {
gold: { gold: {
geometry: <torusGeometry args={[1.2, 0.4, 16, 100]} />, geometry: <torusGeometry args={[1.2, 0.4, 16, 100]} />,
material: { color: "#FFD700", roughness: 0.4, metalness: 1 } material: { color: "#FFD700", roughness: 0.4, metalness: 1 }
},
emerald: {
geometry: <cylinderGeometry args={[1.2, 0.4, 2.5, 32]} />,
material: { color: "#009B77", roughness: 0.4, metalness: 1 }
} }
}; };