Hiệu năng
Cần chú ýTốc độ khung hình: trung bình 56.7 fps, p5 59.5 · Tác vụ dài: 0 tác vụ, tổng 0 ms, dài nhất 0 ms · Mã nguồn gzip 8.6 KB · Khi chạy 189 KB
Shooting StarsMITHọa tiếtAnimata
Component React Họa tiết của Animata. Được thu thập nguyên vẹn từ Animata theo giấy phép MIT và hiển thị trực tiếp tại đây.
Báo cáo chất lượng
Xếp loại và điểm số đến từ các kiểm tra tự động lúc dựng hoặc kiểm thử. Nếu một mục chưa chạy, nó được đánh dấu Chưa kiểm tra — không bao giờ bịa số liệu.
Tốc độ khung hình: trung bình 56.7 fps, p5 59.5 · Tác vụ dài: 0 tác vụ, tổng 0 ms, dài nhất 0 ms · Mã nguồn gzip 8.6 KB · Khi chạy 189 KB
Vấn đề 0 · Trình đọc màn hình: Đạt
Tôn trọng giảm chuyển động
Không tràn
Số liệu tốc độ khung hình và tác vụ dài được đo trong Chromium không giao diện với WebGL phần mềm. Chúng chỉ nên được so sánh giữa các thành phần trên trang này, và không đại diện cho thiết bị thật.
Không có vi phạm axe-core.

Kiểm tra ngày 15 thg 11, 2026 · Số liệu đến từ tập lệnh tự động, không phải mẫu viết tay.
Hiển thị đúng kích thước thật.
Bản sao bắt đầu bằng thông báo giấy phép. Hãy giữ lại khi dùng mã.
<div id="root" class="full"></div>:root{--bg:#f6f4f0;--ink:#17181a;--background:40 20% 96%;--foreground:24 10% 8%;--card:0 0% 100%}html,body{min-height:100%;margin:0;background:var(--bg);color:var(--ink)}html,body{height:100%;overflow:hidden}body{display:grid;place-items:center}#root{display:grid;place-items:center;max-width:100%;max-height:100%;box-sizing:border-box;padding:16px;color:hsl(var(--foreground))}#root.full{width:100%;height:100%;padding:0}@media(prefers-reduced-motion:reduce){*,*::before,*::after{animation-play-state:paused!important;transition-duration:0s!important}}
/*! tailwindcss v4.3.5 | MIT License | https://tailwindcss.com */
@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:block))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-gradient-position:initial;--tw-gradient-from:#0000;--tw-gradient-via:#0000;--tw-gradient-to:#0000;--tw-gradient-stops:initial;--tw-gradient-via-stops:initial;--tw-gradient-from-position:0%;--tw-gradient-via-position:50%;--tw-gradient-to-position:100%;--tw-font-weight:initial;--tw-tracking:initial;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-ease:initial;--tw-animation-delay:0s;--tw-animation-direction:normal;--tw-animation-duration:initial;--tw-animation-fill-mode:none;--tw-animation-iteration-count:1;--tw-enter-blur:0;--tw-enter-opacity:1;--tw-enter-rotate:0;--tw-enter-scale:1;--tw-enter-translate-x:0;--tw-enter-translate-y:0;--tw-exit-blur:0;--tw-exit-opacity:1;--tw-exit-rotate:0;--tw-exit-scale:1;--tw-exit-translate-x:0;--tw-exit-translate-y:0}}}@layer theme{:root,:host{--font-sans:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--font-mono:"Paper Mono", ui-monospace, monospace;--color-yellow-300:oklch(90.5% .182 98.111);--color-yellow-500:oklch(79.5% .184 86.047);--color-blue-300:oklch(80.9% .105 251.813);--color-blue-500:oklch(62.3% .214 259.815);--color-indigo-950:oklch(25.7% .09 281.288);--color-zinc-200:oklch(92% .004 286.32);--color-zinc-700:oklch(37% .013 285.805);--color-zinc-950:oklch(14.1% .005 285.823);--color-white:#fff;--spacing:.25rem;--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-3xl:1.875rem;--text-3xl--line-height:calc(2.25 / 1.875);--text-5xl:3rem;--text-5xl--line-height:1;--font-weight-semibold:600;--tracking-tight:-.025em;--ease-out:cubic-bezier(.22, 1, .36, 1);--ease-in-out:cubic-bezier(.4, 0, 0, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono);--color-border:hsl(var(--border));--color-background:hsl(var(--background));--color-foreground:hsl(var(--foreground));--ease-apple:cubic-bezier(.4, 0, .6, 1)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring:where(:not(iframe)){outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab, currentcolor 50%, transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}*{border-color:var(--color-border)}body{background-color:var(--color-background);color:var(--color-foreground)}:root{--background:0 0% 100%;--foreground:0 0% 11%;--card:0 0% 100%;--card-foreground:0 0% 11%;--popover:0 0% 100%;--popover-foreground:0 0% 11%;--primary:0 0% 11%;--primary-foreground:0 0% 100%;--secondary:0 0% 96%;--secondary-foreground:0 0% 11%;--muted:0 0% 96%;--muted-foreground:0 0% 43%;--accent:262 83% 58%;--accent-foreground:0 0% 100%;--destructive:0 84% 60%;--destructive-foreground:0 0% 98%;--border:0 0% 90%;--input:0 0% 90%;--ring:262 83% 58%;--radius:.75rem;--surface-alt:0 0% 96%;--surface-card:0 0% 100%;--surface-dark:0 0% 7%;--text-secondary:0 0% 43%;--ink:#76756f;--ink-faint:#e3e3e3;--link:210 100% 40%;--link-hover:210 100% 32%;--shadow-sm:0 1px 2px #0000000d;--shadow-md:0 2px 8px #0000000f, 0 4px 16px #0000000a;--shadow-lg:0 4px 12px #0000000f, 0 12px 32px #00000014;--footer-surface:#f5f5f7;--footer-ink:#0f1d42;--footer-ink-muted:#1a2d5c;--footer-accent:#1a4fff;--footer-gold:#fc0;--footer-category-title:#1d1d1f;--footer-category-link:#515154;--footer-stamp:#9f9f9f}.dark{--background:0 0% 0%;--foreground:0 0% 96%;--card:0 0% 4%;--card-foreground:0 0% 96%;--popover:0 0% 4%;--popover-foreground:0 0% 96%;--primary:0 0% 96%;--primary-foreground:0 0% 0%;--secondary:0 0% 10%;--secondary-foreground:0 0% 96%;--muted:0 0% 10%;--muted-foreground:0 0% 45%;--accent:262 83% 65%;--accent-foreground:0 0% 100%;--destructive:0 62% 30%;--destructive-foreground:0 0% 98%;--border:0 0% 12%;--input:0 0% 12%;--ring:262 83% 65%;--surface-alt:0 0% 4%;--surface-card:0 0% 6%;--surface-dark:0 0% 2%;--text-secondary:0 0% 55%;--ink:#e3e3e3;--ink-faint:#76756f;--link:262 80% 70%;--link-hover:262 80% 80%;--shadow-sm:none;--shadow-md:none;--shadow-lg:none;--footer-surface:#1d1d1f;--footer-ink:#f5f5f7;--footer-ink-muted:#86868b;--footer-accent:#fc0;--footer-gold:#fc0;--footer-category-title:#f5f5f7;--footer-category-link:#86868b;--footer-stamp:#48484a}}@layer components{.text-animator-demo .text-animation-stage,[data-text-animator-demo] .text-animation-stage{perspective:900px;padding:clamp(1rem,5cqi,1.5rem);font-size:clamp(1rem,10cqi,2rem);font-weight:500;line-height:1.1}.text-animator-demo .text-animation-title,.text-animator-demo .text-animation-kinetic-word,[data-text-animator-demo] .text-animation-title,[data-text-animator-demo] .text-animation-kinetic-word{text-align:center;letter-spacing:-.025em}.text-animator-demo .text-animation-title,[data-text-animator-demo] .text-animation-title{text-wrap:balance;font-variant-numeric:tabular-nums}@keyframes ss-shoot{0%{opacity:0;transform:translate(0)}6%{opacity:1}82%{opacity:1}to{transform:translate(var(--dx), var(--dy));opacity:0}}@keyframes ss-twinkle{0%,to{opacity:var(--o)}50%{opacity:calc(var(--o) * .25)}}}@layer utilities{.absolute{position:absolute}.relative{position:relative}.inset-0{inset:0}.inset-x-0{inset-inline:0}.top-1\/4{top:25%}.z-0{z-index:0}.z-10{z-index:10}@media (min-width:40rem){.container{max-width:40rem}}@media (min-width:48rem){.container{max-width:48rem}}@media (min-width:64rem){.container{max-width:64rem}}@media (min-width:80rem){.container{max-width:80rem}}@media (min-width:96rem){.container{max-width:96rem}}.container{width:100%;margin-inline:auto;padding-inline:1rem}@media (min-width:640px){.container{max-width:640px}}@media (min-width:768px){.container{max-width:768px}}@media (min-width:1024px){.container{max-width:1024px}}@media (min-width:1280px){.container{max-width:1280px}}.mt-3{margin-top:calc(var(--spacing) * 3)}.flex{display:flex}.h-3\/4{height:75%}.h-full{height:100%}.min-h-96{min-height:calc(var(--spacing) * 96)}.w-full{width:100%}.transform{transform:var(--tw-rotate-x, ) var(--tw-rotate-y, ) var(--tw-rotate-z, ) var(--tw-skew-x, ) var(--tw-skew-y, )}.flex-col{flex-direction:column}.items-center{align-items:center}.justify-center{justify-content:center}.overflow-hidden{overflow:hidden}.bg-linear-to-b{--tw-gradient-position:to bottom}@supports (background-image:linear-gradient(in lab, red, red)){.bg-linear-to-b{--tw-gradient-position:to bottom in oklab}}.bg-linear-to-b{background-image:linear-gradient(var(--tw-gradient-stops))}.from-indigo-950{--tw-gradient-from:var(--color-indigo-950);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-\[\#05050f\]{--tw-gradient-to:#05050f;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.text-center{text-align:center}.text-3xl{font-size:var(--text-3xl);line-height:var(--tw-leading,var(--text-3xl--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-tight{--tw-tracking:var(--tracking-tight);letter-spacing:var(--tracking-tight)}.text-white{color:var(--color-white)}.text-white\/60{color:#fff9}@supports (color:color-mix(in lab, red, red)){.text-white\/60{color:color-mix(in oklab, var(--color-white) 60%, transparent)}}.opacity-40{opacity:.4}.filter{filter:var(--tw-blur, ) var(--tw-brightness, ) var(--tw-contrast, ) var(--tw-grayscale, ) var(--tw-hue-rotate, ) var(--tw-invert, ) var(--tw-saturate, ) var(--tw-sepia, ) var(--tw-drop-shadow, )}.ease-in-out{--tw-ease:var(--ease-in-out);transition-timing-function:var(--ease-in-out)}@media (min-width:48rem){.md\:text-5xl{font-size:var(--text-5xl);line-height:var(--tw-leading,var(--text-5xl--line-height))}}@keyframes orbit-move{0%{transform:translate(-50%,-50%)rotateY(-40deg)rotateX(70deg)rotate(0)translate(100px)}to{transform:translate(-50%,-50%)rotateY(-40deg)rotateX(70deg)rotate(360deg)translate(100px)}}@keyframes counter-rotate{0%{opacity:1;transform:rotate(0)rotateX(-70deg)rotateY(40deg)scale(1)}25%{opacity:1;transform:rotate(-90deg)rotateX(-70deg)rotateY(40deg)scale(1.2)}50%{opacity:.3;transform:rotate(-180deg)rotateX(-70deg)rotateY(40deg)scale(.8)}75%{opacity:.3;transform:rotate(-270deg)rotateX(-70deg)rotateY(40deg)scale(.8)}to{opacity:1;transform:rotate(-360deg)rotateX(-70deg)rotateY(40deg)scale(1)}}@keyframes orbit-indexes{0%,25%,to{z-index:11}50%,99%{z-index:9}}}@property --tw-animation-delay{syntax:"*";inherits:false;initial-value:0s}@property --tw-animation-direction{syntax:"*";inherits:false;initial-value:normal}@property --tw-animation-duration{syntax:"*";inherits:false}@property --tw-animation-fill-mode{syntax:"*";inherits:false;initial-value:none}@property --tw-animation-iteration-count{syntax:"*";inherits:false;initial-value:1}@property --tw-enter-blur{syntax:"*";inherits:false;initial-value:0}@property --tw-enter-opacity{syntax:"*";inherits:false;initial-value:1}@property --tw-enter-rotate{syntax:"*";inherits:false;initial-value:0}@property --tw-enter-scale{syntax:"*";inherits:false;initial-value:1}@property --tw-enter-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-enter-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-exit-blur{syntax:"*";inherits:false;initial-value:0}@property --tw-exit-opacity{syntax:"*";inherits:false;initial-value:1}@property --tw-exit-rotate{syntax:"*";inherits:false;initial-value:0}@property --tw-exit-scale{syntax:"*";inherits:false;initial-value:1}@property --tw-exit-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-exit-translate-y{syntax:"*";inherits:false;initial-value:0}.preview{margin-bottom:calc(var(--spacing) * 4)}.preview-light{background-color:#fefefe;background-image:radial-gradient(#efefef 1px,#0000 1px),radial-gradient(#efefef 1px,#0000 1px);background-position:0 0,10px 10px;background-size:20px 20px}.preview-dark{background-image:radial-gradient(#6a6a6a 1px,#0000 1px),radial-gradient(#6a6a6a 1px,#0000 1px);background-position:0 0,10px 10px;background-size:20px 20px}.component-list-item{border-color:var(--color-zinc-200);background-color:#fefefe;background-image:radial-gradient(#efefef 1px,#0000 1px),radial-gradient(#efefef 1px,#0000 1px);background-position:0 0,10px 10px;background-size:20px 20px}.dark .component-list-item{border-color:var(--color-zinc-700);background-color:var(--color-zinc-950);background-image:radial-gradient(#6a6a6a 1px,#0000 1px),radial-gradient(#6a6a6a 1px,#0000 1px);background-position:0 0,10px 10px;background-size:20px 20px}[style*="opacity: 1"]>.scroll-baby{color:var(--color-yellow-300)}[style*="opacity: 1"]>.scroll-baby:where(.dark,.dark *){color:var(--color-yellow-500)}[style*="opacity: 1"]>.scroll-file{color:var(--color-blue-300)}[style*="opacity: 1"]>.scroll-file:where(.dark,.dark *){color:var(--color-blue-500)}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-gradient-position{syntax:"*";inherits:false}@property --tw-gradient-from{syntax:"<color>";inherits:false;initial-value:#0000}@property --tw-gradient-via{syntax:"<color>";inherits:false;initial-value:#0000}@property --tw-gradient-to{syntax:"<color>";inherits:false;initial-value:#0000}@property --tw-gradient-stops{syntax:"*";inherits:false}@property --tw-gradient-via-stops{syntax:"*";inherits:false}@property --tw-gradient-from-position{syntax:"<length-percentage>";inherits:false;initial-value:0%}@property --tw-gradient-via-position{syntax:"<length-percentage>";inherits:false;initial-value:50%}@property --tw-gradient-to-position{syntax:"<length-percentage>";inherits:false;initial-value:100%}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false}// animata source (MIT). npm i clsx react tailwind-merge · Tailwind CSS v4
// ── animata/background/shooting-stars.css (https://github.com/codse/animata/blob/25c27e5a874c60a56dcc1609df3b2c4f5f8456f8/animata/background/shooting-stars.css)
@layer components {
@keyframes ss-shoot {
0% {
transform: translate(0px, 0px);
opacity: 0;
}
6% {
opacity: 1;
}
82% {
opacity: 1;
}
100% {
transform: translate(var(--dx), var(--dy));
opacity: 0;
}
}
@keyframes ss-twinkle {
0%,
100% {
opacity: var(--o);
}
50% {
opacity: calc(var(--o) * 0.25);
}
}
}
// ── animata/background/shooting-stars.tsx (https://github.com/codse/animata/blob/25c27e5a874c60a56dcc1609df3b2c4f5f8456f8/animata/background/shooting-stars.tsx)
"use client";
import { useCallback, useEffect, useRef, useState } from "react";
import { cn } from "@/lib/utils";
import "./shooting-stars.css";
/**
* ShootingStars — a night sky where streaks shoot across with variable length,
* speed and direction, over a twinkling starfield.
*
* Inspired by Jeremboo's WebGL "Animated Mesh Lines" demo: a generator spawns
* lines continuously, each with randomized length, speed and position, and a
* short bright segment travels along the line before fading. Here it's done with
* SVG — each star is a tapered streak (a gradient rect with a glowing head) that
* travels along its angle while fading, then recycles with fresh random params so
* the field keeps regenerating. Glow is a radial gradient (no CSS filter), so
* there's no edge flicker. Drop content inside; the sky renders behind it.
*/
type GradId = "ss-white" | "ss-blue" | "ss-warm";
const ACCENTS: GradId[] = ["ss-blue", "ss-warm"];
interface Star {
id: number;
x: number;
y: number;
dx: number;
dy: number;
angle: number;
len: number;
width: number;
duration: number;
delay: number;
grad: GradId;
}
interface Dot {
id: number;
x: number;
y: number;
r: number;
o: number;
}
const rand = (min: number, max: number) => min + Math.random() * (max - min);
function makeStar(id: number, w: number, h: number, firstRun: boolean): Star {
const angle = rand(15, 31); // one diagonal direction (down-right) + variance
const rad = (angle * Math.PI) / 180;
const len = rand(60, 200);
// Keep the whole streak + glow off-screen at spawn so it animates IN, never pops mid-view.
const margin = len + 48;
// Travel far enough to cross the container and exit off the bottom-right.
const diag = Math.hypot(w, h);
const travel = diag + margin * 2 + rand(0, diag * 0.3);
// Down-right movers enter from the top or left edge — start the head just past it.
const fromTop = Math.random() < w / (w + h);
const x = fromTop ? rand(-0.15 * w, 0.85 * w) : -margin - rand(0, 0.2 * w);
const y = fromTop ? -margin - rand(0, 0.2 * h) : rand(-0.15 * h, 0.6 * h);
return {
id,
x,
y,
dx: Math.cos(rad) * travel,
dy: Math.sin(rad) * travel,
angle,
len,
width: rand(1, 2.4),
duration: rand(1.3, 3.6),
delay: firstRun ? rand(0, 4) : rand(0, 1.8),
grad: Math.random() < 0.82 ? "ss-white" : ACCENTS[Math.floor(Math.random() * ACCENTS.length)],
};
}
export default function ShootingStars({
children,
className,
}: {
children?: React.ReactNode;
className?: string;
}) {
const containerRef = useRef<HTMLDivElement>(null);
const dims = useRef({ w: 0, h: 0 });
const nextId = useRef(0);
const [stars, setStars] = useState<Star[]>([]);
const [dots, setDots] = useState<Dot[]>([]);
useEffect(() => {
const el = containerRef.current;
if (!el) return;
const reduced = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
let seeded = false;
const seed = () => {
const r = el.getBoundingClientRect();
dims.current = { w: r.width, h: r.height };
const { w, h } = dims.current;
if (!w || !h) return;
seeded = true;
const dotCount = Math.min(90, Math.max(24, Math.round((w * h) / 14000)));
setDots(
Array.from({ length: dotCount }, (_, i) => ({
id: i,
x: rand(0, w),
y: rand(0, h),
r: rand(0.4, 1.3),
o: rand(0.15, 0.7),
})),
);
if (reduced) {
setStars([]);
return;
}
const starCount = Math.min(30, Math.max(12, Math.round(w / 95)));
setStars(Array.from({ length: starCount }, () => makeStar(nextId.current++, w, h, true)));
};
const seedFrame = requestAnimationFrame(() => seed());
const ro = new ResizeObserver(() => {
const r = el.getBoundingClientRect();
dims.current = { w: r.width, h: r.height };
// If we mounted at 0×0 (hidden tab, collapsed/lazy panel), seed once the
// container actually has a size — otherwise the sky stays empty.
if (!seeded && r.width && r.height) {
requestAnimationFrame(() => seed());
}
});
ro.observe(el);
return () => {
cancelAnimationFrame(seedFrame);
ro.disconnect();
};
}, []);
const recycle = useCallback((id: number) => {
const { w, h } = dims.current;
if (!w || !h) return;
setStars((prev) =>
prev.map((s) => (s.id === id ? makeStar(nextId.current++, w, h, false) : s)),
);
}, []);
return (
<div className={cn("relative w-full overflow-hidden", className)}>
<div
ref={containerRef}
className="absolute inset-0 z-0 bg-linear-to-b from-indigo-950 to-[#05050f]"
>
<div
className="absolute inset-x-0 top-1/4 h-3/4 opacity-40"
style={{
background:
"radial-gradient(55% 50% at 50% 45%, rgba(76,82,180,0.4) 0%, rgba(20,22,60,0.22) 45%, rgba(5,5,15,0) 100%)",
}}
/>
<svg className="absolute inset-0 h-full w-full" aria-hidden>
<defs>
<linearGradient id="ss-white" x1="0" y1="0" x2="1" y2="0">
<stop offset="0%" stopColor="#ffffff" stopOpacity="0" />
<stop offset="100%" stopColor="#ffffff" stopOpacity="1" />
</linearGradient>
<linearGradient id="ss-blue" x1="0" y1="0" x2="1" y2="0">
<stop offset="0%" stopColor="#9ec1ff" stopOpacity="0" />
<stop offset="100%" stopColor="#cfe0ff" stopOpacity="1" />
</linearGradient>
<linearGradient id="ss-warm" x1="0" y1="0" x2="1" y2="0">
<stop offset="0%" stopColor="#ffd9a8" stopOpacity="0" />
<stop offset="100%" stopColor="#ffe9cf" stopOpacity="1" />
</linearGradient>
<radialGradient id="ss-glow">
<stop offset="0%" stopColor="#ffffff" stopOpacity="0.9" />
<stop offset="100%" stopColor="#ffffff" stopOpacity="0" />
</radialGradient>
</defs>
{dots.map((d) => (
<circle
key={`dot-${d.id}`}
cx={d.x}
cy={d.y}
r={d.r}
fill="#fff"
style={
{
"--o": d.o,
opacity: d.o,
animation: `ss-twinkle ${4 + (d.id % 5)}s ease-in-out ${d.id % 7}s infinite`,
} as React.CSSProperties
}
/>
))}
{stars.map((s) => (
<g key={s.id} transform={`translate(${s.x} ${s.y})`}>
<g
onAnimationEnd={() => recycle(s.id)}
style={
{
"--dx": `${s.dx}px`,
"--dy": `${s.dy}px`,
opacity: 0,
animation: `ss-shoot ${s.duration}s cubic-bezier(0.4, 0, 0.7, 1) ${s.delay}s forwards`,
} as React.CSSProperties
}
>
<g transform={`rotate(${s.angle})`}>
<rect
x={-s.len}
y={-s.width / 2}
width={s.len}
height={s.width}
rx={s.width / 2}
fill={`url(#${s.grad})`}
/>
{/* soft glow + bright core at the head — pure paint, no filter */}
<circle cx={0} cy={0} r={Math.max(5, s.width * 3.5)} fill="url(#ss-glow)" />
<circle cx={0} cy={0} r={Math.max(1.4, s.width * 1.05)} fill="#ffffff" />
</g>
</g>
</g>
))}
</svg>
</div>
<div className="relative z-10 h-full w-full">{children}</div>
</div>
);
}
// ── lib/utils.ts (https://github.com/codse/animata/blob/25c27e5a874c60a56dcc1609df3b2c4f5f8456f8/lib/utils.ts)
import { type ClassValue, clsx } from "clsx";
import { twMerge } from "tailwind-merge";
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs));
}
export function absoluteUrl(path: string) {
return `${process.env.NEXT_PUBLIC_APP_URL}${path}`;
}
// Linear interpolation
export function lerp(a: number, b: number, n: number) {
return (1 - n) * a + n * b;
}
// Get distance between two points
export function getDistance(x1: number, y1: number, x2: number, y2: number) {
return Math.hypot(x2 - x1, y2 - y1);
}Điều khiển · HTML · CSS · JS
Sửa mã và tinh chỉnh bằng các nút điều khiển. Bản xem trước cập nhật khi bạn gõ.

Thành phần này chạy từ bản đóng gói nên mã script chỉ xem được ở đây. Hãy sửa HTML và CSS; mã nguồn đầy đủ nằm trong thẻ Mã.
Sửa trực tiếp mọi thành phần, tinh chỉnh bằng nút điều khiển, tải mã nguồn đầy đủ và sao chép prompt nâng cao.
$49 một lầnGiá tạm thời
Chế độ thử: không thu tiền thật.
Miễn phí: xem trước, nút sao chép và ghi chú bài học.
Các vệt từ 60 đến 200px bay theo đường chéo xuống bên phải với các dải màu trắng, xanh lam và ấm áp trên một trường có các chấm lấp lánh, xuất hiện ngoài màn hình để không có vệt nào nổi bật ở giữa chế độ xem.
Các anh hùng theo chủ đề ban đêm, trang khởi động và phông nền không gian hoặc sản phẩm AI.
Điều chỉnh phạm vi angle (15 đến 31 độ), độ dài vệt, phạm vi duration và delay cũng như độ chuyển màu nhấn ss-blue và ss-warm.
Thêm component "Nền sao băng" từ Animata (github.com/codse/animata) (MIT) vào ứng dụng React + Tailwind CSS của tôi. Tệp nguồn: https://github.com/codse/animata/blob/25c27e5a874c60a56dcc1609df3b2c4f5f8456f8/animata/background/shooting-stars.tsx. Các vệt từ 60 đến 200px bay theo đường chéo xuống bên phải với các dải màu trắng, xanh lam và ấm áp trên một trường có các chấm lấp lánh, xuất hiện ngoài màn hình để không có vệt nào nổi bật ở giữa chế độ xem. Dùng cho: Các anh hùng theo chủ đề ban đêm, trang khởi động và phông nền không gian hoặc sản phẩm AI. Các thiết lập cần chỉnh: Điều chỉnh phạm vi angle (15 đến 31 độ), độ dài vệt, phạm vi duration và delay cũng như độ chuyển màu nhấn ss-blue và ss-warm. Hỗ trợ giao diện sáng và tối, tôn trọng prefers-reduced-motion. Giữ thông báo giấy phép MIT.
Prompt dài hơn, có các bước tinh chỉnh, trợ năng và tích hợp.