{"success":true,"name":"add-a-css-skeleton-shimmer-that-fades-into-the-loaded-image","description":"Need the concrete code for an animated placeholder before an image shows","category":"ai-brimind","path":"ai-brimind/add-a-css-skeleton-shimmer-that-fades-into-the-loaded-image/SKILL.md","file":"SKILL.md","content":"---\nname: add-a-css-skeleton-shimmer-that-fades-into-the-loaded-image\ndescription: \"Need the concrete code for an animated placeholder before an image shows\"\n---\n\n# Add a CSS Skeleton Shimmer That Fades Into the Loaded Image\n\n## When to use\nProject is a web frontend, and you are implementing the actual placeholder animation and fade-in for one image slot right now.\n\n## Example request\nshimmer needed → a gradient background moved by a looping CSS keyframe animation, the classic skeleton pattern — fade-in needed → image starts at opacity 0, a class added on the onload event transitions it to 1 — animation keeps running behind the photo → stop or hide the skeleton once loaded; loading UI must end when loading ends — shimmer feels janky on low-end devices → animate only transform/opacity, the GPU-friendly properties\n\n## Instructions\nYou are a frontend developer implementing one image slot precisely, using standard CSS mechanisms instead of inventing new ones. Before writing code, confirm the slot's dimensions or aspect ratio — if unknown, ask, because the pattern breaks without reserved space. Then build exactly this: (1) a wrapper div with the fixed size or aspect-ratio, position relative, overflow hidden, (2) the skeleton: a background using a linear-gradient (base tone → lighter highlight → base tone) with background-size wider than the box, animated by a @keyframes loop that moves background-position — this is the standard shimmer, do not hand-roll a JS animation for it, (3) the img absolutely positioned to fill the wrapper, starting at opacity 0 with a transition on opacity, (4) on the image's onload event add a 'loaded' class that sets opacity to 1 and stops or hides the shimmer — never leave an infinite animation running under a visible photo, (5) respect prefers-reduced-motion by disabling the shimmer movement for those users. Keep everything on opacity and background-position (cheap properties); do not animate width, height, or filters in the loop. If the framework already provides this (e.g. next/image blur placeholder), use it and only add the fade CSS. Verify by throttling the network in devtools and watching all states; confirm the smoothness comes from the load-event-driven class swap, not a timing guess.\n\n## Metadata\n- role: developer\n- level: tactical\n- places: vibeCoding\n- origin: ai.brimind.pro skill #922\n","linked_files":[],"origin":"ai.brimind.pro","owner_id":null,"source":"router"}