About this snippet

Keep users engaged during AI generation with this advanced skeleton loader. We sweep a glowing magical gradient across the blocks, so users feel the platform thinking and generating content.

Size
2.9 KB
Uses
HTML, CSS
Loads
Nothing external
Views
208
<div class="ai-gen-card">
  <div class="gen-header">
    <div class="ai-sparkle">
      <svg viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="url(#sparkle-grad)" stroke-width="2"><path d="M12 2l3 7 7 3-7 3-3 7-3-7-7-3 7-3z"></path>
      <defs>
        <linearGradient id="sparkle-grad" x1="0" y1="0" x2="1" y2="1">
          <stop offset="0%" stop-color="#a855f7"></stop>
          <stop offset="100%" stop-color="#ec4899"></stop>
        </linearGradient>
      </defs></svg>
    </div>
    <span class="gen-status">Generating Insights...</span>
  </div>
  
  <div class="skeleton-body">
    <div class="skeleton-block s-title"></div>
    <div class="skeleton-block s-line"></div>
    <div class="skeleton-block s-line short"></div>
    
    <div class="skeleton-grid">
      <div class="skeleton-block s-box"></div>
      <div class="skeleton-block s-box"></div>
    </div>
  </div>
</div>
*, *::before, *::after {
  box-sizing: border-box;
}

body {
  font-family: system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
  margin: 0;
  background: #0f172a;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 20px;
}

.ai-gen-card {
  background: #1e293b;
  border: 1px solid #334155;
  width: 100%;
  max-width: 500px;
  border-radius: 20px;
  padding: 30px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.gen-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 30px;
}

.ai-sparkle {
  animation: spin-pulse 3s linear infinite;
}

@keyframes spin-pulse {
  0% { transform: rotate(0deg) scale(1); }
  50% { transform: rotate(180deg) scale(1.2); }
  100% { transform: rotate(360deg) scale(1); }
}

.gen-status {
  background: linear-gradient(90deg, #a855f7, #ec4899, #a855f7);
  background-size: 200% auto;
  color: transparent;
  background-clip: text;
  -webkit-background-clip: text;
  font-weight: 600;
  font-size: 1.125rem;
  animation: shimmer-text 2s linear infinite;
}

@keyframes shimmer-text {
  to { background-position: 200% center; }
}

.skeleton-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.skeleton-block {
  background: #334155;
  border-radius: 8px;
  position: relative;
  overflow: hidden;
}

/* The sweeping generative glow effect */
.skeleton-block::after {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 50%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(168, 85, 247, 0.3), transparent);
  animation: ai-sweep 2s ease-in-out infinite;
}

@keyframes ai-sweep {
  100% { left: 200%; }
}

.s-title {
  width: 60%;
  height: 28px;
  margin-bottom: 10px;
}

.s-line {
  width: 100%;
  height: 16px;
}

.short {
  width: 80%;
  margin-bottom: 20px;
}

.skeleton-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.s-box {
  height: 120px;
  border-radius: 12px;
}
Esc
↑↓ moveEnter select

Start from a template

Open an .html file, or HTML, CSS, JS, Markdown, Less or TypeScript files. You can also drop them here. Styles and scripts go into their panes.

Share

Source

Keyboard shortcuts

Save