DEV Community

9xj89gzrtw-hue
9xj89gzrtw-hue

Posted on

10 Production-Ready Micro-Interactions & Generative SVG Badges for Web3 Landings (Zero Deps)

10 Production-Ready Micro-Interactions & Generative SVG Badges for Web3 Landings

Most modern SaaS and Web3 landing pages look identical: generic Tailwind blur gradients, uninspired hero sections, and stock component libraries. But high-converting pages stand out through tactile micro-interactions and crisp, vector-sharp generative assets.

In this guide, we dive into building high-fidelity interactive components using standard CSS variables, native DOM events, and standalone Python SVG generation — with zero heavyweight JavaScript framework dependencies.


1. The Physics-Based 3D Tilt Card (Roman Numeral Holler Card)

Rather than pulling a 50kb React spring animation library, modern browsers give us high-performance perspective transformations via CSS transform: perspective() rotateX() rotateY():

<div class="tilt-card" id="card">
  <div class="inner-glare"></div>
  <div class="card-content">
    <span class="badge">EDITION MMXXVI</span>
    <h3>Sovereign Node</h3>
    <p>Procedural cryptographic identity asset with dynamic ambient glare.</p>
  </div>
</div>

<style>
.tilt-card {
  width: 320px;
  height: 440px;
  background: linear-gradient(145deg, #18181b, #09090b);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.1s ease-out;
  cursor: pointer;
}
.inner-glare {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(circle at var(--mouse-x, 50%) var(--mouse-y, 50%), rgba(255, 255, 255, 0.12), transparent 70%);
  pointer-events: none;
}
</style>

<script>
const card = document.getElementById('card');
card.addEventListener('mousemove', (e) => {
  const rect = card.getBoundingClientRect();
  const x = e.clientX - rect.left;
  const y = e.clientY - rect.top;
  const cx = rect.width / 2;
  const cy = rect.height / 2;
  const rotX = ((y - cy) / cy) * -12;
  const rotY = ((x - cx) / cx) * 12;
  card.style.transform = `perspective(1000px) rotateX(${rotX}deg) rotateY(${rotY}deg) scale3d(1.02, 1.02, 1.02)`;
  card.style.setProperty('--mouse-x', `${(x / rect.width) * 100}%`);
  card.style.setProperty('--mouse-y', `${(y / rect.height) * 100}%`);
});
card.addEventListener('mouseleave', () => {
  card.style.transform = 'perspective(1000px) rotateX(0deg) rotateY(0deg) scale3d(1, 1, 1)';
});
</script>
Enter fullscreen mode Exit fullscreen mode

2. Procedural SVG Brandmark Generation in Python

Sharp vectors load instantly (0 HTTP network overhead when inlined) and look pristine on 4K Apple Retina screens. Here is how we generate customized geometric brandmarks on the fly:

import math

def generate_holler_badge(title: str, radius: int = 120) -> str:
    """Generates a concentric neo-brutalist SVG badge with mathematical precision."""
    cx, cy = 150, 150
    lines = []
    num_teeth = 24
    for i in range(num_teeth):
        angle = (2 * math.pi / num_teeth) * i
        x1 = cx + (radius - 12) * math.cos(angle)
        y1 = cy + (radius - 12) * math.sin(angle)
        x2 = cx + radius * math.cos(angle)
        y2 = cy + radius * math.sin(angle)
        lines.append(f'<line x1="{x1:.1f}" y1="{y1:.1f}" x2="{x2:.1f}" y2="{y2:.1f}" stroke="#10b981" stroke-width="2.5" stroke-linecap="round" />')

    return f'''<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 300 300" width="300" height="300">
      <rect width="100%" height="100%" fill="#09090b" rx="24" />
      <circle cx="{cx}" cy="{cy}" r="{radius - 20}" fill="none" stroke="rgba(16, 185, 129, 0.2)" stroke-width="1" />
      {''.join(lines)}
      <text x="{cx}" y="{cy + 6}" font-family="monospace" font-size="14" font-weight="bold" fill="#f4f4f5" text-anchor="middle" letter-spacing="2">{title}</text>
    </svg>'''

# Example execution
svg_code = generate_holler_badge("VERIFIED_NODE")
with open("badge.svg", "w") as f:
    f.write(svg_code)
Enter fullscreen mode Exit fullscreen mode

3. What Else is in the Production Kit?

We assembled a full library of 10 plug-and-play UI components built without framework bloat:

  1. Roman Numeral Holler Card: 3D tilt with metallic specular highlight.
  2. Neo-Brutalist Crypto Checkout Card: 1-click address copy, QR generator, network switcher.
  3. Animated Terminal Block: Typewriter command replay with copy button.
  4. Bento Spotlight Grid: Grid cards reacting to global cursor movement.
  5. Infinite Marquee Ticker: CSS hardware-accelerated continuous banner.
  6. Animated Radial Token Metric: SVG ring with live easing animations.
  7. Clean Accordion FAQ: Native <details> / <summary> with smooth height expansion.
  8. Toast Notification Engine: Micro-library for alerts under 2KB.
  9. Interactive Pricing Switcher: Monthly/Annual pricing calculator with animated toggle.
  10. Procedural SVG Generator CLI: Python script producing custom high-res assets in seconds.

Live Demo & Pro Pack

Top comments (0)