07X post embed frame — a card whose border brightness is recomputed on a cycle to glow
The card border's brightness value is recomputed on a steady cycle, and as that value rises and falls the border glows faintly and settles, framing the quoted post like a real embed widget.
Best forPress and social-reaction quote roundups, quote cards used in place of screenshots
requestAnimationFramesetPropertyaria-live

<main class="stage">
<section class="panel">
<div class="card" id="card">
<div class="frameLine" aria-hidden="true"></div>
<div class="avatarRow">
<canvas class="avatar" id="avatar" width="32" height="32" aria-hidden="true"></canvas>
<div class="who">
<span class="name">Channel A</span>
<span class="handle">@channel_a</span>
</div>
</div>
<p class="quoteBody">A quoted line pulled in by the embed goes here.</p>
<p class="meta">2:14 PM · Quoted</p>
</div>
<div class="readout" id="readout" aria-live="polite">
<span class="readoutLabel">Border brightness</span>
<span class="readoutValue" id="glowValue">50%</span>
</div>
</section>
</main>@use "../../../../site/static/demo-tokens" as *;
@include stage($stage-orange);
.panel {
display: flex;
flex-direction: column;
align-items: center;
gap: $sp-4;
}
.card {
position: relative;
box-sizing: border-box;
width: 240px;
padding: $sp-4;
border-radius: $r-card;
background: $stage-paper;
box-shadow: $shadow-raised;
color: $subject-ink;
}
.frameLine {
position: absolute;
inset: 0;
border: 2px solid $subject-ink;
border-radius: $r-card;
// 계산 겹: JS 가 매 프레임 사인파로 다시 구한 --glow 값을 opacity 로 반영해 테두리를 맥동시킨다
opacity: calc(0.14 + 0.5 * var(--glow, 0));
pointer-events: none;
}
.avatarRow {
display: flex;
align-items: center;
gap: $sp-2;
margin-bottom: $sp-3;
}
.avatar {
flex: 0 0 auto;
width: 32px;
height: 32px;
border-radius: $r-pill;
}
.who {
display: flex;
flex-direction: column;
gap: $sp-1;
}
.name {
font-family: -apple-system, "Segoe UI", "Noto Sans KR", sans-serif;
font-weight: 700;
font-size: 13px;
line-height: 1.3;
}
.handle {
font-family: -apple-system, "Segoe UI", "Noto Sans KR", sans-serif;
font-weight: 400;
font-size: 12px;
line-height: 1.3;
opacity: .72;
}
.quoteBody {
margin: 0 0 $sp-2;
font-family: -apple-system, "Segoe UI", "Noto Sans KR", sans-serif;
font-weight: 400;
font-size: 14px;
line-height: 1.5;
}
.meta {
margin: 0;
font-family: -apple-system, "Segoe UI", "Noto Sans KR", sans-serif;
font-weight: 400;
font-size: 11px;
line-height: 1.3;
opacity: .78;
}
.readout {
display: flex;
align-items: center;
gap: $sp-2;
padding: $sp-1 $sp-3;
border-radius: $r-pill;
background: $subject-cream;
color: $subject-ink;
}
.readoutLabel {
font-family: -apple-system, "Segoe UI", "Noto Sans KR", sans-serif;
font-weight: 500;
font-size: 11px;
line-height: 1.3;
opacity: .84;
}
.readoutValue {
font-family: "Space Mono", ui-monospace, monospace;
font-weight: 700;
font-size: 13px;
line-height: 1.3;
}
@media (max-width: 340px) {
.panel { gap: $sp-2; }
.card { width: 200px; padding: $sp-2 $sp-3; }
.avatar { width: 26px; height: 26px; }
.avatarRow { margin-bottom: $sp-2; }
.name { font-size: 12px; }
.handle { font-size: 11px; }
.quoteBody { margin-bottom: $sp-1; font-size: 12px; }
.meta { font-size: 10px; }
.readoutLabel { font-size: 10px; }
.readoutValue { font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) {
.frameLine { opacity: .3; }
}html, body {
margin: 0;
overflow: hidden;
}
.stage {
box-sizing: border-box;
min-height: 100vh;
display: grid;
place-items: center;
margin: 0;
background: #ff4d1f;
font-family: -apple-system, "Segoe UI", "Noto Sans KR", sans-serif;
padding: clamp(8px, 4vw, 24px);
}
.panel {
display: flex;
flex-direction: column;
align-items: center;
gap: 16px;
}
.card {
position: relative;
box-sizing: border-box;
width: 240px;
padding: 16px;
border-radius: 16px;
background: #ffffff;
box-shadow: 0 14px 24px rgba(23, 20, 26, 0.32);
color: #17141a;
}
.frameLine {
position: absolute;
inset: 0;
border: 2px solid #17141a;
border-radius: 16px;
opacity: calc(0.14 + 0.5 * var(--glow, 0));
pointer-events: none;
}
.avatarRow {
display: flex;
align-items: center;
gap: 8px;
margin-bottom: 12px;
}
.avatar {
flex: 0 0 auto;
width: 32px;
height: 32px;
border-radius: 999px;
}
.who {
display: flex;
flex-direction: column;
gap: 4px;
}
.name {
font-family: -apple-system, "Segoe UI", "Noto Sans KR", sans-serif;
font-weight: 700;
font-size: 13px;
line-height: 1.3;
}
.handle {
font-family: -apple-system, "Segoe UI", "Noto Sans KR", sans-serif;
font-weight: 400;
font-size: 12px;
line-height: 1.3;
opacity: 0.72;
}
.quoteBody {
margin: 0 0 8px;
font-family: -apple-system, "Segoe UI", "Noto Sans KR", sans-serif;
font-weight: 400;
font-size: 14px;
line-height: 1.5;
}
.meta {
margin: 0;
font-family: -apple-system, "Segoe UI", "Noto Sans KR", sans-serif;
font-weight: 400;
font-size: 11px;
line-height: 1.3;
opacity: 0.78;
}
.readout {
display: flex;
align-items: center;
gap: 8px;
padding: 4px 12px;
border-radius: 999px;
background: #fff7e6;
color: #17141a;
}
.readoutLabel {
font-family: -apple-system, "Segoe UI", "Noto Sans KR", sans-serif;
font-weight: 500;
font-size: 11px;
line-height: 1.3;
opacity: 0.84;
}
.readoutValue {
font-family: "Space Mono", ui-monospace, monospace;
font-weight: 700;
font-size: 13px;
line-height: 1.3;
}
@media (max-width: 340px) {
.panel {
gap: 8px;
}
.card {
width: 200px;
padding: 8px 12px;
}
.avatar {
width: 26px;
height: 26px;
}
.avatarRow {
margin-bottom: 8px;
}
.name {
font-size: 12px;
}
.handle {
font-size: 11px;
}
.quoteBody {
margin-bottom: 4px;
font-size: 12px;
}
.meta {
font-size: 10px;
}
.readoutLabel {
font-size: 10px;
}
.readoutValue {
font-size: 11px;
}
}
@media (prefers-reduced-motion: reduce) {
.frameLine {
opacity: 0.3;
}
}// 인용 게시물 임베드(07) — 카드 테두리 발광 강도를 매 프레임 사인파로 다시 계산해
// CSS 변수로 주입한다. 실키·실서버 요청 없음, 리스너 없음(자동 재생만).
(function () {
var cardEl = document.getElementById('card');
var avatarEl = document.getElementById('avatar');
var glowValueEl = document.getElementById('glowValue');
if (!cardEl || !avatarEl || !glowValueEl) return;
var reduce = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
var CYCLE_MS = 2000;
var GLOW_MS = 900;
function mulberry32(seed) {
var a = seed >>> 0;
return function () {
a |= 0; a = (a + 0x6D2B79F5) | 0;
var t = Math.imul(a ^ (a >>> 15), 1 | a);
t = (t + Math.imul(t ^ (t >>> 7), 61 | t)) ^ t;
return ((t ^ (t >>> 14)) >>> 0) / 4294967296;
};
}
function drawSeedThumb(canvas, seed) {
var ctx = canvas.getContext('2d');
if (!ctx) return;
var rnd = mulberry32(seed);
var w = canvas.width, h = canvas.height;
var hues = [216, 32, 268, 168];
ctx.fillStyle = 'hsl(' + hues[Math.floor(rnd() * hues.length)] + ', 38%, 22%)';
ctx.fillRect(0, 0, w, h);
for (var i = 0; i < 6; i++) {
var cx = rnd() * w, cy = rnd() * h, r = (0.18 + rnd() * 0.3) * Math.min(w, h);
ctx.fillStyle = 'hsla(' + hues[Math.floor(rnd() * hues.length)] + ', ' + (44 + rnd() * 22).toFixed(1) + '%, ' + (38 + rnd() * 26).toFixed(1) + '%, .5)';
ctx.beginPath(); ctx.arc(cx, cy, r, 0, Math.PI * 2); ctx.fill();
}
ctx.fillStyle = 'rgba(255, 247, 230, .06)';
for (var j = 0; j < h; j += 4) ctx.fillRect(0, j, w, 1);
}
drawSeedThumb(avatarEl, 107);
// 계산 겹: 테두리 밝기를 사인파로 매 프레임 재계산해 --glow 로 주입, opacity 로 맥동시킨다
function apply(t) {
var glow = 0.5 + 0.5 * Math.sin(2 * Math.PI * t / GLOW_MS);
cardEl.style.setProperty('--glow', glow.toFixed(3));
glowValueEl.textContent = Math.round(glow * 100) + '%';
}
if (reduce) {
apply(0);
return;
}
var start = null;
function loop(ts) {
if (start === null) start = ts;
var t = (ts - start) % CYCLE_MS;
apply(t);
requestAnimationFrame(loop);
}
requestAnimationFrame(loop);
})();import { useEffect, useRef } from "react";
import styles from "./EmbedXPost.module.scss";
// 인용 게시물 임베드 — 카드 테두리 발광 강도를 매 프레임 사인파로 다시 계산해
// CSS 변수로 주입한다. 실키·실서버 요청 없음. 리스너 없음(자동 재생만).
const CYCLE_MS = 2000;
const GLOW_MS = 900;
function mulberry32(seed: number) {
let a = seed >>> 0;
return function () {
a |= 0;
a = (a + 0x6d2b79f5) | 0;
let t = Math.imul(a ^ (a >>> 15), 1 | a);
t = (t + Math.imul(t ^ (t >>> 7), 61 | t)) ^ t;
return ((t ^ (t >>> 14)) >>> 0) / 4294967296;
};
}
function drawSeedThumb(canvas: HTMLCanvasElement, seed: number) {
const ctx = canvas.getContext("2d");
if (!ctx) return;
const rnd = mulberry32(seed);
const w = canvas.width;
const h = canvas.height;
const hues = [216, 32, 268, 168];
ctx.fillStyle = "hsl(" + hues[Math.floor(rnd() * hues.length)] + ", 38%, 22%)";
ctx.fillRect(0, 0, w, h);
for (let i = 0; i < 6; i++) {
const cx = rnd() * w;
const cy = rnd() * h;
const r = (0.18 + rnd() * 0.3) * Math.min(w, h);
ctx.fillStyle =
"hsla(" +
hues[Math.floor(rnd() * hues.length)] +
", " +
(44 + rnd() * 22).toFixed(1) +
"%, " +
(38 + rnd() * 26).toFixed(1) +
"%, .5)";
ctx.beginPath();
ctx.arc(cx, cy, r, 0, Math.PI * 2);
ctx.fill();
}
ctx.fillStyle = "rgba(255, 247, 230, .06)";
for (let j = 0; j < h; j += 4) ctx.fillRect(0, j, w, 1);
}
export default function EmbedXPost() {
const cardRef = useRef<HTMLDivElement>(null);
const avatarRef = useRef<HTMLCanvasElement>(null);
const glowValueRef = useRef<HTMLSpanElement>(null);
useEffect(() => {
const card = cardRef.current;
const avatar = avatarRef.current;
const glowValueEl = glowValueRef.current;
if (!card || !avatar || !glowValueEl) return;
const reduce = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
drawSeedThumb(avatar, 107);
function apply(t: number) {
const glow = 0.5 + 0.5 * Math.sin((2 * Math.PI * t) / GLOW_MS);
card!.style.setProperty("--glow", glow.toFixed(3));
glowValueEl!.textContent = Math.round(glow * 100) + "%";
}
if (reduce) {
apply(0);
return;
}
let start: number | null = null;
let raf = 0;
function loop(ts: number) {
if (start === null) start = ts;
const t = (ts - start) % CYCLE_MS;
apply(t);
raf = requestAnimationFrame(loop);
}
raf = requestAnimationFrame(loop);
return () => cancelAnimationFrame(raf);
}, []);
return (
<div className={styles.stage}>
<section className={styles.panel}>
<div className={styles.card} ref={cardRef}>
<div className={styles.frameLine} aria-hidden="true" />
<div className={styles.avatarRow}>
<canvas className={styles.avatar} ref={avatarRef} width={32} height={32} aria-hidden="true" />
<div className={styles.who}>
<span className={styles.name}>Channel A</span>
<span className={styles.handle}>@channel_a</span>
</div>
</div>
<p className={styles.quoteBody}>임베드로 가져온 인용 문장이 이 자리에 들어갑니다.</p>
<p className={styles.meta}>오후 2:14 · 인용됨</p>
</div>
<div className={styles.readout} aria-live="polite">
<span className={styles.readoutLabel}>테두리 밝기</span>
<span className={styles.readoutValue} ref={glowValueRef}>50%</span>
</div>
</section>
</div>
);
}07 X post embed frame — a card whose border brightness is recomputed on a cycle to glow — Measured area 1.878% · moving frames 23/23Original by GODRICH · SCSS and React ship in the zip · 9 YouTube Embed Code UI Patterns (Copy-Paste)
The post this demo lives in
9 YouTube Embed Code UI Patterns (Copy-Paste)Nine embed UIs: a frame's height recomputes from its width, a lite facade times itself into a full frame after a delay, See all demos in this post


