Long Shadow

A flat icon pops in and casts a long shadow to the frame edge, then the light swings and the shadow sweeps around on a spring

Installation
$ pnpm dlx shadcn@latest add @remocn/long-shadow

Usage

LongShadow is a full-frame scene. The icon springs in from nothing at the center of the frame. Its shadow grows out of it until it reaches the frame edge, a solid band the exact shape of the icon's silhouette. Then the light swings, and the shadow sweeps from angleFrom to angleTo on a soft spring that overshoots a little before it settles.

tsx
import { LongShadow } from "@/components/remocn/long-shadow";
 
export const Done = () => <LongShadow />;

Without children it shows a red check badge. Pass a flat icon or mark as children to cast its shadow instead. The children are centered, and the shadow is built from their alpha, so any opaque shape works: an SVG, an image with transparency or plain text.

tsx
import { LongShadow } from "@/components/remocn/long-shadow";
 
export const AppIcon = () => (
  <LongShadow
    angleFrom={30}
    angleTo={150}
    shadowColor="#1F4FD1"
    background="#2D6BE5"
    fade={0.6}
  >
    <div
      style={{
        width: 240,
        height: 240,
        borderRadius: 56,
        background: "#FFFFFF",
      }}
    />
  </LongShadow>
);

Angles are in degrees, clockwise from the right: 0 casts the shadow to the right and 90 casts it down. fade fades the shadow toward its far end, from 0 for a solid band to 1 for a shadow that disappears at the edge.

Timing

At 30 fps and speed={1}:

FramesMotion
0–19The icon and its shadow spring in from zero scale
7–22The shadow grows out to the frame edge at angleFrom
24–48The light swings and the shadow sweeps to angleTo, overshooting slightly

longShadowLength is 48, the frame the swing settles. speed scales the whole timeline.

Notes

The shadow is an SVG filter that stacks 1023 offset copies of the silhouette in ten doubling passes, then softens the steps with a hair of blur. It covers the full frame, so expect slower renders than a plain scene, especially at 4K.

Props9

PropTypeDefault
children
React.ReactNode—

Flat icon or mark that casts the shadow, centered. Without it a red check badge is shown

angleFrom
number45

Shadow direction before the swing, in degrees clockwise from the right

angleTo
number135

Shadow direction after the swing

shadowColor
string"#ECEAE6"

Shadow color

background
string"#FFFFFF"

Background color

fade
number0

Fades the shadow toward its far end, 0 to 1

iconColor
string"#E5322D"

Disc color of the default badge; ignored with children

checkColor
string"#FFFFFF"

Check mark color of the default badge; ignored with children

speed
number1

Playback multiplier

  • childrenReact.ReactNode

    Flat icon or mark that casts the shadow, centered. Without it a red check badge is shown

  • angleFromnumber

    Shadow direction before the swing, in degrees clockwise from the right

    Default45

  • angleTonumber

    Shadow direction after the swing

    Default135

  • shadowColorstring

    Shadow color

    Default"#ECEAE6"

  • backgroundstring

    Background color

    Default"#FFFFFF"

  • fadenumber

    Fades the shadow toward its far end, 0 to 1

    Default0

  • iconColorstring

    Disc color of the default badge; ignored with children

    Default"#E5322D"

  • checkColorstring

    Check mark color of the default badge; ignored with children

    Default"#FFFFFF"

  • speednumber

    Playback multiplier

    Default1