Свечение AI-поля
Поле для запроса, которое загорается вращающейся радужной кромкой, пока ассистент думает, а потом выводит ответ слово за словом. Свечение на чистом CSS через @property.
- Первый экран
- Бесплатно
- @property
- Добавлен 14 сентября 2026
<style>
@property --angle { syntax: '<angle>'; initial-value: 0deg; inherits: false; }
@keyframes spin { to { --angle: 360deg; } }
.ai-card { position: relative; box-sizing: border-box; width: min(420px, 92vw); padding: 22px; border-radius: 28px; background: #0C0E15; isolation: isolate; }
/* the halo behind the card: exactly the rule from the video */
.ai-card::before, .ai-card::after { content: ""; position: absolute; z-index: -2; border-radius: inherit; opacity: 0; transition: opacity .5s cubic-bezier(.23, 1, .32, 1); }
.ai-card::before { inset: -2px; }
.ai-card::after { inset: -1.5px; }
.thinking::before {
background: conic-gradient(from var(--angle),
#3BC9F5, #8D6BFF, #FF6FA3, #FFB36B, #3BC9F5);
filter: blur(14px);
animation: spin 1.8s linear infinite;
opacity: .9;
}
/* a thin sharp edge on top of the halo, same colors */
.thinking::after { background: conic-gradient(from var(--angle), #3BC9F5, #8D6BFF, #FF6FA3, #FFB36B, #3BC9F5); animation: spin 1.8s linear infinite; opacity: 1; }
.ai-card .inner { position: absolute; inset: 0; z-index: -1; border-radius: inherit; background: #0C0E15; box-shadow: inset 0 0 0 1px rgba(255,255,255,.08); }
.thinking.done::before { opacity: .25; }
.thinking.done::after { opacity: .5; }
.ai-card h2 { margin: 0; font-size: 18px; letter-spacing: -.01em; }
.ai-card .status { margin: 4px 0 18px; color: #7A8290; font-size: 12px; }
.chat { min-height: 170px; display: flex; flex-direction: column; gap: 14px; }
.bubble { align-self: flex-end; max-width: 80%; padding: 9px 14px; border-radius: 18px; background: #2A2F3D; font-size: 14px; animation: rise .45s cubic-bezier(.23, 1, .32, 1); }
@keyframes rise { from { opacity: 0; transform: translateY(24px) scale(.97); } }
.answer { margin: 0; font-size: 16px; line-height: 1.6; }
.answer span { display: inline-block; white-space: pre; animation: word .35s cubic-bezier(.23, 1, .32, 1) both; }
@keyframes word { from { opacity: 0; filter: blur(6px); transform: translateY(6px); } }
.prompt { display: flex; align-items: center; gap: 10px; margin-top: 18px; padding: 6px 6px 6px 16px; border-radius: 26px; background: #141722; box-shadow: inset 0 0 0 1px rgba(141,107,255,.45); }
.prompt input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: inherit; font: 500 15px system-ui, sans-serif; }
.prompt input::placeholder { color: #5B6272; }
.prompt button { width: 36px; height: 36px; border: 0; border-radius: 50%; background: #F3F5F8; color: #05060A; cursor: pointer; display: grid; place-items: center;
transition: transform .12s cubic-bezier(.23, 1, .32, 1), opacity .2s ease; }
.prompt button:active { transform: scale(.94); }
.prompt button:disabled { opacity: .35; cursor: default; }
.prompt:focus-within { box-shadow: inset 0 0 0 1.5px #8D6BFF; }
.prompt button:focus-visible { outline: 2px solid #8D6BFF; outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
.ai-card::before, .ai-card::after { animation: none; }
.bubble, .answer span { animation: none; }
}
</style>
<form class="ai-card">
<div class="inner"></div>
<h2>Assistant</h2>
<p class="status">Ask anything</p>
<div class="chat" aria-live="polite"></div>
<label class="prompt">
<input name="q" placeholder="Ask anything" autocomplete="off" value="Design a login that feels alive">
<button aria-label="Send"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round"><path d="M8 13V3M3 8l5-5 5 5"/></svg></button>
</label>
</form>
<script>
const card = document.querySelector('.ai-card');
const chat = card.querySelector('.chat');
const status = card.querySelector('.status');
const input = card.querySelector('input');
const send = card.querySelector('button');
const WORD_DELAY = 100; // ms between streamed words
// swap this for a real request, e.g. fetch('/api/ask', { method: 'POST', body: q })
function fakeReply(q) {
return new Promise(done => setTimeout(() => done('Split the button into two fields and let liquid metal stretch between them as they open.'), 1200));
}
card.onsubmit = async e => {
e.preventDefault();
const q = input.value.trim(); if (!q) return;
chat.innerHTML = ''; input.value = ''; send.disabled = true;
const bubble = document.createElement('div'); bubble.className = 'bubble'; bubble.textContent = q; chat.append(bubble);
card.classList.remove('done');
card.classList.add('thinking');
status.textContent = 'Thinking…';
const text = await fakeReply(q);
status.textContent = 'Answer';
const answer = document.createElement('p'); answer.className = 'answer'; chat.append(answer);
const words = text.split(' ');
for (const [i, w] of words.entries()) {
const span = document.createElement('span'); span.textContent = w + (i < words.length - 1 ? ' ' : ''); answer.append(span);
await new Promise(r => setTimeout(r, WORD_DELAY));
}
card.classList.add('done');
send.disabled = false; input.focus();
};
</script>
Нажмите кнопку со стрелкой или Enter.
Что можно поменять
Поменяйте число, сохраните файл и обновите страницу, разница будет видна сразу.
1.8sspinСколько длится один полный оборот радуги.
blur(14px)filterМягкость ореола. Меньше значит резче.
WORD_DELAY100Пауза между словами ответа в миллисекундах.
Как поставить на свой сайт
Для AI-чата, строки поиска или любого места, где человек ждёт ответа.
Комментарии в коде на английском, так файл понятен любому разработчику.
CSS
Вставьте в свой файл стилей или в тег <style> внутри <head>.
@property --angle { syntax: '<angle>'; initial-value: 0deg; inherits: false; } @keyframes spin { to { --angle: 360deg; } } .ai-card { position: relative; box-sizing: border-box; width: min(420px, 92vw); padding: 22px; border-radius: 28px; background: #0C0E15; isolation: isolate; } /* the halo behind the card: exactly the rule from the video */ .ai-card::before, .ai-card::after { content: ""; position: absolute; z-index: -2; border-radius: inherit; opacity: 0; transition: opacity .5s cubic-bezier(.23, 1, .32, 1); } .ai-card::before { inset: -2px; } .ai-card::after { inset: -1.5px; } .thinking::before { background: conic-gradient(from var(--angle), #3BC9F5, #8D6BFF, #FF6FA3, #FFB36B, #3BC9F5); filter: blur(14px); animation: spin 1.8s linear infinite; opacity: .9; } /* a thin sharp edge on top of the halo, same colors */ .thinking::after { background: conic-gradient(from var(--angle), #3BC9F5, #8D6BFF, #FF6FA3, #FFB36B, #3BC9F5); animation: spin 1.8s linear infinite; opacity: 1; } .ai-card .inner { position: absolute; inset: 0; z-index: -1; border-radius: inherit; background: #0C0E15; box-shadow: inset 0 0 0 1px rgba(255,255,255,.08); } .thinking.done::before { opacity: .25; } .thinking.done::after { opacity: .5; } .ai-card h2 { margin: 0; font-size: 18px; letter-spacing: -.01em; } .ai-card .status { margin: 4px 0 18px; color: #7A8290; font-size: 12px; } .chat { min-height: 170px; display: flex; flex-direction: column; gap: 14px; } .bubble { align-self: flex-end; max-width: 80%; padding: 9px 14px; border-radius: 18px; background: #2A2F3D; font-size: 14px; animation: rise .45s cubic-bezier(.23, 1, .32, 1); } @keyframes rise { from { opacity: 0; transform: translateY(24px) scale(.97); } } .answer { margin: 0; font-size: 16px; line-height: 1.6; } .answer span { display: inline-block; white-space: pre; animation: word .35s cubic-bezier(.23, 1, .32, 1) both; } @keyframes word { from { opacity: 0; filter: blur(6px); transform: translateY(6px); } } .prompt { display: flex; align-items: center; gap: 10px; margin-top: 18px; padding: 6px 6px 6px 16px; border-radius: 26px; background: #141722; box-shadow: inset 0 0 0 1px rgba(141,107,255,.45); } .prompt input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: inherit; font: 500 15px system-ui, sans-serif; } .prompt input::placeholder { color: #5B6272; } .prompt button { width: 36px; height: 36px; border: 0; border-radius: 50%; background: #F3F5F8; color: #05060A; cursor: pointer; display: grid; place-items: center; transition: transform .12s cubic-bezier(.23, 1, .32, 1), opacity .2s ease; } .prompt button:active { transform: scale(.94); } .prompt button:disabled { opacity: .35; cursor: default; } .prompt:focus-within { box-shadow: inset 0 0 0 1.5px #8D6BFF; } .prompt button:focus-visible { outline: 2px solid #8D6BFF; outline-offset: 2px; } @media (prefers-reduced-motion: reduce) { .ai-card::before, .ai-card::after { animation: none; } .bubble, .answer span { animation: none; } }HTML
Поставьте в то место страницы, где должен быть эффект.
<form class="ai-card"> <div class="inner"></div> <h2>Assistant</h2> <p class="status">Ask anything</p> <div class="chat" aria-live="polite"></div> <label class="prompt"> <input name="q" placeholder="Ask anything" autocomplete="off" value="Design a login that feels alive"> <button aria-label="Send"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round"><path d="M8 13V3M3 8l5-5 5 5"/></svg></button> </label> </form>JavaScript
Вставьте перед закрывающим тегом </body>, внутри <script></script>.
const card = document.querySelector('.ai-card'); const chat = card.querySelector('.chat'); const status = card.querySelector('.status'); const input = card.querySelector('input'); const send = card.querySelector('button'); const WORD_DELAY = 100; // ms between streamed words // swap this for a real request, e.g. fetch('/api/ask', { method: 'POST', body: q }) function fakeReply(q) { return new Promise(done => setTimeout(() => done('Split the button into two fields and let liquid metal stretch between them as they open.'), 1200)); } card.onsubmit = async e => { e.preventDefault(); const q = input.value.trim(); if (!q) return; chat.innerHTML = ''; input.value = ''; send.disabled = true; const bubble = document.createElement('div'); bubble.className = 'bubble'; bubble.textContent = q; chat.append(bubble); card.classList.remove('done'); card.classList.add('thinking'); status.textContent = 'Thinking…'; const text = await fakeReply(q); status.textContent = 'Answer'; const answer = document.createElement('p'); answer.className = 'answer'; chat.append(answer); const words = text.split(' '); for (const [i, w] of words.entries()) { const span = document.createElement('span'); span.textContent = w + (i < words.length - 1 ? ' ' : ''); answer.append(span); await new Promise(r => setTimeout(r, WORD_DELAY)); } card.classList.add('done'); send.disabled = false; input.focus(); };
Подключение к серверу
Замените fakeReply() запросом к своему AI. Свечение включается и выключается само.
Полезно знать
- @property работает в Chrome, Edge, Safari 16.4+ и Firefox 128+. Старые браузеры показывают неподвижную градиентную кромку.
Tilda, Webflow, WordPress
Нажмите «Скопировать весь код» вверху и вставьте его в один HTML-блок.
Добавить блок, Другое, T123 HTML-код. Вставьте и сохраните. Проверяйте на опубликованной странице, в редакторе скрипты не запускаются.
Панель Add, Embed. Вставьте и нажмите Save & Close. Свой код работает на опубликованном сайте.
Добавить блок, Произвольный HTML. Вставьте и нажмите «Обновить».


