V. Suryawanshi, home

Behind the scenes · this site

How this room
was built

The top of this site is a photo that looks back at you. There’s no 3D engine, WebGL or animation library: just 77 head poses generated from one photo, cut out with Apple’s Vision framework, and a room lit entirely with CSS. This is its second version, and a comment on LinkedIn is the reason it exists.

Frames
77 head poses and a blink, from one photo
Tools
ChatGPT, Google Flow, LivePortrait, ffmpeg, Swift + Vision
Site
Next.js and plain CSS
Libraries for motion
None
poses in version one
25
poses in version two, 4° apart
77
Version one jumped between 25 separately generated poses. Version two has 77 from one photo: 11 angles across (20° either side) by 7 up and down (12°), with the front pose in the middle.

The briefCopy link to this section

I wanted a portfolio that makes a hiring manager smile in the first second and still gets out of the way. Out of five directions (a video call, an IDE, a magazine cover, a tiny desktop OS and a warm room), I picked the room: me at a walnut desk in golden-hour light, turning to look at wherever your cursor goes.

One portrait, many framesCopy link to this section

Everything starts from a single portrait. From it, image and video models generated the same scene with my head turned in each direction, plus a short clip of me blinking. Every frame had to share the exact framing, desk and light, or the illusion breaks the moment the head moves.

Every generated frame also came with a small sparkle watermark in the corner, sitting right on the desk’s edge. Removing it took two steps in ffmpeg: copy a clean strip from beside the sparkle’s tip so the desk line stays straight, then let delogo fill in the rest from the surrounding wall. The first attempt left a one-pixel notch: the desk edge rises a pixel toward the right, so the strip has to come from the left.

Close-up of the desk corner: the sparkle watermark before, and clean wall and desk after
Before and after, zoomed in on the desk corner.

Cutting out the person and the deskCopy link to this section

To paint my own wall and light, the subject had to come out of the photo. Apple’s Vision framework does person segmentation on-device, but a desk isn’t a person. So a small Swift tool finds the desk’s back edge in each frame, keeps everything below it, and merges that with the person mask. A flood fill then plugs the see-through gaps between arms and body.

The lighting baked into the photo stays. Instead, the new wall behind me is painted to agree with it: warm light from the upper right, and a soft shadow thrown to the left.

The original generated photo next to the cutout on a plain wall
The generated photo (left) and the cutout, before the room’s CSS lighting is added.

Version one: 25 poses that snappedCopy link to this section

The first version measured the angle and distance from my face to your cursor and picked one of 25 generated poses: straight ahead, a half turn in eight directions, or a full turn in sixteen. The body stayed one permanent image and only the head was swapped in, through an SVG mask that fades into the collar. It worked, but every change was a jump.

After I shared it, one comment on LinkedIn simply said: “It’s cute but not smooth.” They were right.

Version two: one photo, 77 posesCopy link to this section

More frames from a video model weren’t the answer. I’d tried that, and every in-between frame redrew my face slightly. What I needed was the same face at many precise angles. LivePortrait, an open-source model, does exactly that: it takes one photo and rotates the head by the angle you ask for, and it can move the eyes on their own.

From the same portrait I generated a grid of 77 poses, 4° apart: 20° either side, 12° up and down, with the eyes leading each turn. Every pose starts from the same photo, so the face, the stubble and the golden-hour light never change. Each result is pasted back into the full frame with a feathered edge, cut out again with Vision, and cropped to the head. The whole grid cost about sixteen cents to generate.

The motion changed too. Your cursor now sets a target angle, and the head eases toward it, showing the nearest pose on every frame, so a big move walks through the in-between poses instead of snapping.

One bug worth sharing: LivePortrait’s eye controls use the opposite sign from its head controls. My first batch turned the head while the eyes stared straight back at the camera. It looked unsettling. Flipping one sign and regenerating 70 poses fixed it for about seven cents.

A grid of 77 head poses: looking up in the top row, down in the bottom row, left on the left, right on the right
All 77 poses, arranged by where your cursor would be. Every one comes from the same photo.

Blinking, and doing nothingCopy link to this section

The first generated blink was wrong in a very human-noticeable way: the eyes stayed shut for about 0.3 seconds, then never quite reopened. Now the blink comes from the same photo as every pose: open, closing, nearly shut, shut, and back again in about a fifth of a second, only while I’m looking straight at you.

Leave the cursor alone for four seconds and I start living a little: mostly blinking, sometimes a glance to the side and back. Glances ease through the same grid, so they move as smoothly as cursor tracking. Any movement cancels them instantly.

Four close-ups of the eyes: open, closing, nearly shut and shut
The blink frames, generated from the same photo as the poses.

Light, night and scroll, all in CSSCopy link to this section

One animation loop eases your cursor position into two CSS variables. The window light, the sun glow, my shadow and the night-time desk lamp all read those variables and move with transforms only, so the browser never has to re-lay out the page. Day and night are colour tokens registered with @property, which lets the whole room fade between them instead of snapping.

Below the room, the day carries on: each section is a later hour, from late afternoon to night. Things rise into place as you scroll using the browser’s own scroll-driven animations. Browsers that don’t support them simply show the finished page.

/* the whole scroll reveal: no JavaScript */
@supports (animation-timeline: view()) {
  .reveal {
    animation: reveal linear both;
    animation-timeline: view();
    animation-range: entry 0% entry 80%;
  }
}
@keyframes reveal { from { opacity: 0; translate: 0 48px; } }

What didn’t make itCopy link to this section

  • A head-turn video, played frame by frame. I generated a ten-second clip looking in every direction and stepped through 44 of its frames toward the cursor. On paper it was smoother. In practice it looked unnatural, so it went.
  • Crossfades between version one’s poses. They were so far apart that halfway through you briefly saw two heads.
  • A generated smile. It looked like someone else’s smile.

The lesson: the problem was never the number of frames, it was the face changing between them. More frames only help if every one of them is unmistakably the same person. And the fastest way to find that out was to ship, and listen.