About this snippet

Keep users waiting happily with an AI thinking text animation. We fade a glowing gradient across the text smoothly, so it looks like it is processing data, but remains lightweight.

Size
1.7 KB
Uses
HTML, CSS
Loads
Nothing external
Views
1,065
<div class="ai-box">
  <div class="ai-header">
    <svg viewBox="0 0 24 24" width="24" height="24" fill="none" stroke="#a855f7" stroke-width="2"><path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"></path></svg>
    <h3>Nexus AI</h3>
  </div>
  
  <div class="message-bubble">
    <p class="gradient-text">Analyzing your request and generating the perfect response...</p>
  </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";
  background: #0f172a;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  margin: 0;
  padding: 20px;
}

.ai-box {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 16px;
  padding: 24px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
}

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

.ai-header h3 {
  color: #f8fafc;
  margin: 0;
  font-size: 1.125rem;
}

.message-bubble {
  background: rgba(0, 0, 0, 0.2);
  padding: 16px 20px;
  border-radius: 12px;
  border-bottom-left-radius: 2px;
}

.gradient-text {
  margin: 0;
  font-size: 1.125rem;
  line-height: 1.6;
  font-weight: 500;
  /* The Magic Gradient Animation */
  background: linear-gradient(
    90deg, 
    #94a3b8 0%, 
    #f8fafc 25%, 
    #a855f7 50%, 
    #f8fafc 75%, 
    #94a3b8 100%
  );
  background-size: 200% auto;
  color: transparent;
  -webkit-background-clip: text;
  background-clip: text;
  animation: shine 3s linear infinite;
}

@keyframes shine {
  to {
    background-position: 200% center;
  }
}
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