Prestasi
Perlu perhatianKadar bingkai: purata 60 fps, p5 59.5 · Tugas panjang: 1 tugas, jumlah 61 ms, terpanjang 61 ms · Sumber gzip 9.9 KB · Masa jalan 334 KB
Team ClockMITKadAnimata
Komponen React Kad oleh Animata. Dikumpul tanpa ubahan daripada Animata di bawah lesen MIT dan dipaparkan secara langsung di sini.
Laporan kualiti
Gred dan skor datang daripada pemeriksaan automatik semasa binaan atau ujian. Jika suatu pemeriksaan tidak dijalankan, ia ditanda Belum diuji — nombor tidak pernah direka.
Kadar bingkai: purata 60 fps, p5 59.5 · Tugas panjang: 1 tugas, jumlah 61 ms, terpanjang 61 ms · Sumber gzip 9.9 KB · Masa jalan 334 KB
Isu 0 · Pembaca skrin: Lulus
Tiada gerakan berterusan
Tidak melimpah
Angka kadar bingkai dan tugas panjang diukur dalam Chromium tanpa paparan dengan WebGL perisian. Ia hanya boleh dibandingkan antara komponen di laman ini, dan tidak mewakili peranti sebenar.
Tidak berkenaan: tiada animasi yang kelihatan ketika rehat. Animasi yang dicetuskan oleh tuding tidak diuji.
Tiada pelanggaran axe-core.

Disemak 15 Nov 2026 · Angka datang daripada skrip automatik, bukan sampel tulisan tangan.
Dipaparkan pada saiz sebenar.
Salinan bermula dengan notis lesen. Kekalkannya apabila anda menggunakan kod.
<div id="root"></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-space-y-reverse:0;--tw-border-style:solid;--tw-font-weight:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-duration: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-gray-200:oklch(92.8% .006 264.531);--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-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-lg:1.125rem;--text-lg--line-height:calc(1.75 / 1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75 / 1.25);--text-2xl:1.5rem;--text-2xl--line-height:calc(2 / 1.5);--text-3xl:1.875rem;--text-3xl--line-height:calc(2.25 / 1.875);--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--radius-lg:var(--radius);--radius-2xl:1rem;--ease-out:cubic-bezier(.22, 1, .36, 1);--default-transition-duration:.2s;--default-transition-timing-function:var(--ease-out);--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));--color-accent:hsl(var(--accent));--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}}@layer utilities{.absolute{position:absolute}.relative{position:relative}.top-0\.5{top:calc(var(--spacing) * .5)}.top-\[50\%\]{top:50%}.left-0\.5{left:calc(var(--spacing) * .5)}.my-4{margin-block:calc(var(--spacing) * 4)}.mr-3{margin-right:calc(var(--spacing) * 3)}.mr-4{margin-right:calc(var(--spacing) * 4)}.mb-4{margin-bottom:calc(var(--spacing) * 4)}.flex{display:flex}.inline-flex{display:inline-flex}.h-5{height:calc(var(--spacing) * 5)}.h-6{height:calc(var(--spacing) * 6)}.h-10{height:calc(var(--spacing) * 10)}.h-\[10px\]{height:10px}.h-\[20px\]{height:20px}.h-\[100px\]{height:100px}.h-\[120px\]{height:120px}.h-auto{height:auto}.h-full{height:100%}.w-1\/2{width:50%}.w-5{width:calc(var(--spacing) * 5)}.w-10{width:calc(var(--spacing) * 10)}.w-11{width:calc(var(--spacing) * 11)}.w-\[2px\]{width:2px}.w-\[3px\]{width:3px}.w-\[4px\]{width:4px}.w-\[5px\]{width:5px}.w-\[10px\]{width:10px}.w-full{width:100%}.w-px{width:1px}.min-w-26{min-width:calc(var(--spacing) * 26)}.grow{flex-grow:1}.origin-bottom{transform-origin:bottom}.transform{transform:var(--tw-rotate-x, ) var(--tw-rotate-y, ) var(--tw-rotate-z, ) var(--tw-skew-x, ) var(--tw-skew-y, )}.cursor-pointer{cursor:pointer}.resize{resize:both}.flex-col{flex-direction:column}.items-center{align-items:center}.justify-between{justify-content:space-between}.justify-center{justify-content:center}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 4) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 4) * calc(1 - var(--tw-space-y-reverse)))}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.rounded-2xl{border-radius:var(--radius-2xl)}.rounded-full{border-radius:2147483647px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-r-lg{border-top-right-radius:var(--radius-lg);border-bottom-right-radius:var(--radius-lg)}.border{border-style:var(--tw-border-style);border-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.bg-accent{background-color:var(--color-accent)}.bg-gray-200{background-color:var(--color-gray-200)}.bg-white{background-color:var(--color-white)}.p-3{padding:calc(var(--spacing) * 3)}.p-4{padding:calc(var(--spacing) * 4)}.p-6{padding:calc(var(--spacing) * 6)}.py-14{padding-block:calc(var(--spacing) * 14)}.pt-1{padding-top:var(--spacing)}.pb-4{padding-bottom:calc(var(--spacing) * 4)}.text-center{text-align:center}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-3xl{font-size:var(--text-3xl);line-height:var(--tw-leading,var(--text-3xl--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.whitespace-nowrap{white-space:nowrap}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-shadow{transition-property:box-shadow;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-300{--tw-duration:.3s;transition-duration:.3s}@media (hover:hover){.hover\:shadow-lg:hover{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a), 0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}}@media (min-width:40rem){.sm\:text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}}@media (min-width:48rem){.md\:w-\[450px\]{width:450px}.md\:flex-row{flex-direction:row}}@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-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-duration{syntax:"*";inherits:false}// animata source (MIT). npm i clsx motion react tailwind-merge · Tailwind CSS v4
// ── animata/widget/team-clock.tsx (https://github.com/codse/animata/blob/25c27e5a874c60a56dcc1609df3b2c4f5f8456f8/animata/widget/team-clock.tsx)
"use client";
import { AnimatePresence, motion } from "motion/react";
import { useEffect, useMemo, useReducer, useRef, useState } from "react";
import { cn } from "@/lib/utils";
interface TeamClockProps {
users: Array<{
name: string;
city: string;
country: string;
timeDifference: string;
pfp: string;
}>;
clockSize: number;
animationDuration: number;
accentColor: string;
backgroundColor: string;
textColor: string;
borderColor: string;
hoverBackgroundColor: string;
showSeconds: boolean;
use24HourFormat: boolean;
}
type TeamClockState = {
isExpanded: boolean;
angle: number;
currentTime: Date;
isMobile: boolean;
selectedUser: string | null;
hoveredUser: string | null;
};
type TeamClockAction =
| { type: "toggle" }
| { type: "tick"; time: Date }
| { type: "setMobile"; isMobile: boolean }
| { type: "selectUser"; userName: string; timeDifference: string; users: TeamClockProps["users"] }
| {
type: "hoverUser";
userName: string | null;
timeDifference: string | null;
users: TeamClockProps["users"];
};
function teamClockReducer(state: TeamClockState, action: TeamClockAction): TeamClockState {
switch (action.type) {
case "toggle":
return { ...state, isExpanded: !state.isExpanded };
case "tick":
return { ...state, currentTime: action.time };
case "setMobile":
return { ...state, isMobile: action.isMobile };
case "selectUser": {
if (state.selectedUser === action.userName) {
return { ...state, selectedUser: null, angle: 0 };
}
return {
...state,
selectedUser: action.userName,
angle: parseInt(action.timeDifference, 10) * 30,
};
}
case "hoverUser": {
if (action.userName && action.timeDifference) {
return {
...state,
hoveredUser: action.userName,
angle: parseInt(action.timeDifference, 10) * 30,
};
}
if (!state.selectedUser) {
return { ...state, hoveredUser: null, angle: 0 };
}
const selectedUserData = action.users.find((user) => user.name === state.selectedUser);
return {
...state,
hoveredUser: null,
angle: selectedUserData ? parseInt(selectedUserData.timeDifference, 10) * 30 : 0,
};
}
default:
return state;
}
}
function createInitialTeamClockState(): TeamClockState {
return {
isExpanded: false,
angle: 0,
currentTime: new Date(),
isMobile: typeof window !== "undefined" ? window.innerWidth < 768 : false,
selectedUser: null,
hoveredUser: null,
};
}
export default function TeamClock({
users,
clockSize,
animationDuration,
accentColor = "#000",
backgroundColor = "#ffffff",
textColor = "#1f2937",
borderColor = "#e5e7eb",
hoverBackgroundColor = "#f3f4f6",
showSeconds = false,
use24HourFormat = false,
}: TeamClockProps) {
const [state, dispatch] = useReducer(teamClockReducer, undefined, createInitialTeamClockState);
const { isExpanded, angle, currentTime, isMobile, selectedUser, hoveredUser } = state;
useEffect(() => {
const checkMobile = () => {
dispatch({ type: "setMobile", isMobile: window.innerWidth < 768 });
};
window.addEventListener("resize", checkMobile);
return () => window.removeEventListener("resize", checkMobile);
}, []);
useEffect(() => {
const timer = setInterval(() => {
dispatch({ type: "tick", time: new Date() });
}, 1000);
return () => clearInterval(timer);
}, []);
const handleToggle = () => {
dispatch({ type: "toggle" });
};
const handleUserSelect = (userName: string, timeDifference: string) => {
dispatch({ type: "selectUser", userName, timeDifference, users });
};
const handleUserHover = (userName: string | null, timeDifference: string | null) => {
dispatch({ type: "hoverUser", userName, timeDifference, users });
};
return (
<motion.div
className={cn(
"relative flex flex-col overflow-hidden rounded-lg border transition-shadow duration-300 hover:shadow-lg md:flex-row",
"min-w-26 h-auto w-full md:w-[450px]",
isMobile ? "team-clock-mobile" : "",
)}
style={{
backgroundColor: backgroundColor,
borderColor: borderColor,
color: textColor,
}}
animate={{ width: isMobile ? "100%" : isExpanded ? "800px" : "400px" }}
transition={{ duration: animationDuration }}
>
<div
className={cn("flex flex-col rounded-lg p-4", {
"w-full": isMobile || (!isExpanded && !isMobile),
"w-1/2": isExpanded && !isMobile,
})}
style={{ backgroundColor: backgroundColor }}
>
<div
className="mb-4 flex items-center justify-between border-b pb-4 pt-1"
style={{ borderColor: borderColor }}
>
<h2 className="text-2xl font-bold">Team</h2>
{!isMobile && (
<ToggleButton onClick={handleToggle} accentColor={accentColor} textColor={textColor} />
)}
</div>
<div className="flex grow items-center justify-center">
<Clock
angle={angle}
pressed={isExpanded}
size={isMobile ? Math.min(clockSize, window.innerWidth - 40) : clockSize}
animationDuration={animationDuration}
accentColor={accentColor}
textColor={textColor}
backgroundColor={backgroundColor}
/>
</div>
<div className="my-4 text-center text-3xl font-semibold">
{currentTime.toLocaleTimeString([], {
hour: use24HourFormat ? "2-digit" : "numeric",
minute: "2-digit",
second: showSeconds ? "2-digit" : undefined,
hour12: !use24HourFormat,
})}
</div>
</div>
{/* Add vertical dividing line */}
{isExpanded && !isMobile && (
<div className="h-full w-px" style={{ backgroundColor: borderColor }}></div>
)}
<AnimatePresence>
{(isExpanded || isMobile) && (
<motion.div
className={cn("overflow-y-auto rounded-r-lg", {
"team-clock-mobile-list w-full": isMobile,
"w-1/2": !isMobile,
})}
style={{ backgroundColor: backgroundColor }}
initial={isMobile ? { opacity: 1 } : { width: 0, opacity: 0 }}
animate={isMobile ? { opacity: 1 } : { width: "50%", opacity: 1 }}
exit={isMobile ? { opacity: 1 } : { width: 0, opacity: 0 }}
transition={{ duration: animationDuration }}
>
<motion.div
className="space-y-4 p-4"
initial={isMobile ? { x: 0 } : { x: "100%" }}
animate={{ x: 0 }}
exit={isMobile ? { x: 0 } : { x: "100%" }}
transition={{ duration: animationDuration }}
>
{users.map((user, index) => (
<ListElement
key={index}
name={user.name}
city={user.city}
country={user.country}
pfp={user.pfp}
timeDifference={user.timeDifference}
onSelect={handleUserSelect}
onHover={handleUserHover}
isSelected={selectedUser === user.name}
isHovered={hoveredUser === user.name}
isMobile={isMobile}
currentTime={currentTime}
animationDuration={animationDuration}
accentColor={accentColor}
textColor={textColor}
hoverBackgroundColor={hoverBackgroundColor}
/>
))}
</motion.div>
</motion.div>
)}
</AnimatePresence>
</motion.div>
);
}
interface ClockProps {
angle: number;
pressed: boolean;
size: number;
animationDuration: number;
accentColor: string;
textColor: string;
backgroundColor: string;
}
function Clock({
angle,
size,
animationDuration,
accentColor,
textColor,
backgroundColor,
}: ClockProps) {
const [time, setTime] = useState(() => new Date());
const gradientRef = useRef<HTMLDivElement>(null);
useEffect(() => {
const interval = setInterval(() => {
setTime(new Date());
}, 1000);
return () => clearInterval(interval);
}, []);
useEffect(() => {
const isClockwise = angle > 0;
if (gradientRef.current && time) {
const hours = time.getHours();
const minutes = time.getMinutes();
const hourDegrees = (hours % 12) * 30 + minutes * 0.5;
gradientRef.current.style.background = isClockwise
? `conic-gradient(from ${hourDegrees}deg, rgba(0,200,0,0.5), rgba(0,200,0,0) ${angle}deg)`
: `conic-gradient(from ${
hourDegrees + angle
}deg, rgba(200,0,0,0.3), rgba(200,0,0,0.0) ${-angle}deg)`;
}
}, [angle, time]);
const hours = time.getHours();
const minutes = time.getMinutes();
const seconds = time.getSeconds();
const hourDegrees = (hours % 12) * 30 + minutes * 0.5;
const minuteDegrees = minutes * 6;
const secondDegrees = seconds * 6;
return (
<div
className="flex items-center justify-center py-14"
style={{ "--accent-color": accentColor } as React.CSSProperties}
>
<div
className="relative flex items-center justify-center rounded-full border p-6 text-center text-xl"
ref={gradientRef}
style={{
height: `${size}px`,
width: `${size}px`,
backgroundColor: backgroundColor,
borderColor: textColor,
}}
>
{Array.from({ length: 12 }, (_, i) => (
<div
key={i}
className="absolute"
style={{ transform: `rotate(${i * 30}deg) translate(0, -46%)` }}
>
<hr className="h-[20px] w-[3px] rounded-lg" style={{ backgroundColor: textColor }} />
</div>
))}
<motion.div
className="absolute top-[50%] h-[100px] w-[5px] origin-bottom rounded-2xl"
style={{ transformOrigin: "50% 0%", backgroundColor: textColor }}
animate={{ rotate: 180 + hourDegrees + angle }}
transition={{ duration: animationDuration }}
/>
<motion.div
className="absolute top-[50%] h-[120px] w-[4px] origin-bottom rounded-2xl"
style={{
transformOrigin: "50% 0%",
backgroundColor: textColor,
opacity: 0.6,
}}
animate={{ rotate: 180 + minuteDegrees }}
transition={{ duration: animationDuration }}
/>
<motion.div
className="absolute top-[50%] w-[2px] origin-bottom rounded-2xl bg-accent"
style={{ height: `${size * 0.4}px`, transformOrigin: "50% 0%" }}
animate={{ rotate: 180 + secondDegrees }}
transition={{ duration: animationDuration }}
/>
<div className="absolute h-[10px] w-[10px] rounded-full bg-accent" />
</div>
</div>
);
}
interface ListElementProp {
name: string;
city: string;
country: string;
timeDifference: string;
pfp: string;
onSelect: (name: string, timeDifference: string) => void;
onHover: (name: string | null, timeDifference: string | null) => void;
isSelected: boolean;
isHovered: boolean;
isMobile: boolean;
currentTime: Date;
animationDuration: number;
accentColor: string;
textColor: string;
hoverBackgroundColor: string;
}
function ListElement(props: ListElementProp) {
const [isHovered, setIsHovered] = useState(false);
const handleEnter = () => {
if (!props.isMobile) {
setIsHovered(true);
props.onHover(props.name, props.timeDifference);
}
};
const handleLeave = () => {
if (!props.isMobile) {
setIsHovered(false);
props.onHover(null, null);
}
};
const handleClick = () => {
props.onSelect(props.name, props.timeDifference);
};
const localTime = useMemo(() => {
const hourDifference = parseInt(props.timeDifference, 10);
const newTime = new Date(props.currentTime);
newTime.setHours(newTime.getHours() + hourDifference);
return newTime.toLocaleTimeString([], {
hour: "2-digit",
minute: "2-digit",
});
}, [props.currentTime, props.timeDifference]);
return (
<motion.div
className={cn("flex cursor-pointer items-center rounded-lg p-3", "")}
onMouseEnter={handleEnter}
onMouseLeave={handleLeave}
onClick={handleClick}
animate={{
boxShadow: props.isSelected ? "inset 0 2px 4px 0 rgba(0, 0, 0, 0.06)" : "none",
backgroundColor: props.isSelected || isHovered ? props.hoverBackgroundColor : "transparent",
}}
transition={{ duration: props.animationDuration }}
style={{ color: props.textColor }}
>
<img src={props.pfp} alt={props.name} className="mr-4 h-10 w-10 rounded-full" />
<div className="grow">
<div className="flex items-center justify-between">
<span className="text-lg font-semibold">{props.name}</span>
<div className="relative text-sm">
<AnimatePresence>
{!props.isSelected && !isHovered && (
<motion.div
initial={{ opacity: 0, y: 10 }}
animate={{ opacity: 1, y: 0 }}
exit={{ opacity: 0, y: -10 }}
transition={{ duration: props.animationDuration }}
>
{localTime}
</motion.div>
)}
{(props.isSelected || isHovered) && (
<motion.div
className={"whitespace-nowrap text-xs sm:text-sm"}
style={{ color: parseInt(props.timeDifference, 10) < 0 ? "#EF4444" : "#10B981" }}
initial={{ opacity: 0, y: 10 }}
animate={{ opacity: 1, y: 0 }}
exit={{ opacity: 0, y: -10 }}
transition={{ duration: props.animationDuration }}
>
{parseInt(props.timeDifference, 10) === 0
? "+ 0 Hours"
: `${props.timeDifference} Hours`}
</motion.div>
)}
</AnimatePresence>
</div>
</div>
<div
className="text-sm"
style={{ color: props.textColor }}
>{`${props.city}, ${props.country}`}</div>
</div>
</motion.div>
);
}
type ToggleButtonProps = {
onClick: (isToggled: boolean) => void;
accentColor: string;
textColor: string;
};
function ToggleButton({ onClick, accentColor, textColor, ...props }: ToggleButtonProps) {
const [isToggled, setIsToggled] = useState(false);
const handleClick = () => {
setIsToggled(!isToggled);
onClick(!isToggled);
};
return (
<motion.button
className="relative inline-flex cursor-pointer items-center"
onClick={handleClick}
{...props}
>
<span className="mr-3 text-sm font-medium" style={{ color: textColor }}>
{isToggled ? "Hide List" : "Show List"}
</span>
<div className="relative">
<motion.div
className="h-6 w-11 rounded-full bg-gray-200"
animate={{ backgroundColor: isToggled ? accentColor : "#D1D5DB" }}
transition={{ duration: 0.3 }}
/>
<motion.div
className="absolute left-0.5 top-0.5 h-5 w-5 rounded-full bg-white shadow"
animate={{ x: isToggled ? 20 : 0 }}
transition={{ duration: 0.3 }}
/>
</div>
</motion.button>
);
}
// ── 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);
}Kawalan · HTML · CSS · JS
Sunting kod dan laraskan dengan kawalan. Pratonton dikemas kini semasa anda menaip.

Komponen ini berjalan daripada binaan berpakej, jadi skripnya baca sahaja di sini. Sunting HTML dan CSS; sumber penuh ada dalam tab Kod.
Sunting setiap komponen secara langsung, laraskan dengan kawalan, muat turun sumber penuh dan salin prompt lanjutan.
$49 sekali bayarHarga sementara
Mod ujian: tiada bayaran sebenar dikenakan.
Percuma: pratonton, butang salin dan nota pelajaran.
Ruang yang lapang, bucu lembut dan satu warna aksen meletakkan kandungan di hadapan.
Senarai ciri, profil, jubin produk dan papan pemuka.
Laras padding, kedalaman bayang dan warna aksen.
Tambahkan komponen "Team Clock (Kad)" daripada Animata (github.com/codse/animata) (MIT) ke aplikasi React + Tailwind CSS saya. Fail sumber: https://github.com/codse/animata/blob/25c27e5a874c60a56dcc1609df3b2c4f5f8456f8/animata/widget/team-clock.tsx. Ruang yang lapang, bucu lembut dan satu warna aksen meletakkan kandungan di hadapan. Gunakan untuk: Senarai ciri, profil, jubin produk dan papan pemuka. Tetapan untuk dilaras: Laras padding, kedalaman bayang dan warna aksen. Sokong tema cerah dan gelap serta hormati prefers-reduced-motion. Kekalkan notis lesen MIT.
Prompt lebih panjang dengan langkah pelarasan, kebolehcapaian dan integrasi.