How it works
A cow that walks in, and a chat that walks out of it
Stand’s widget is optional. The pink cow is a reusable attention-grabber for any page: a procedural low-poly cow that walks along the bottom of the screen when a visitor lingers, and a complete Stand chat that unfolds out of its flank when clicked. One import, one call, and the timing is yours.
Try it
- Scroll past the top of the letter and wait. The countdown in Try it shows when the cow is due; pick a shorter wait, or summon it.
- The cow walks in from the right, stops, looks at you, and something knocks on its hatch. Hover, and it stops to watch your pointer.
- Click the cow. The hatch swings open, a folded card flies out and unfolds into the chat, exactly where the live chat fades in.
- Ask something, or press a suggestion. The cow chews while a reply is on its way. Replies stream in as the Stand-in writes them.
- Close the chat with the ×, Esc or a click outside. The card folds back into the cow, the hatch shuts, and the cow bucks and gallops off.
This page uses siteId: 'demo', Stand Chat’s shared demo site, which works on any domain. Its demo Stand-in follows the cow’s greeting and prompt. With your own Site ID, your own Stand-ins and team answer.
1. Put the cow on your page
Copy the folder, add the three.js import map, and start the cow. Everything else, three.js included, loads only when the cow is about to walk on.
<script type="importmap">
{ "imports": {
"three": "https://cdn.jsdelivr.net/npm/three@0.186.1/build/three.module.min.js",
"three/addons/": "https://cdn.jsdelivr.net/npm/three@0.186.1/examples/jsm/"
} }
</script>
<script type="module">
import { PinkCow } from './pink-cow/pink-cow.js';
const cow = new PinkCow({
siteId: 'demo', // your Site ID from Sites in Stand
hero: '#hero', // the wait starts when this scrolls out of view
delay: 30_000, // 30 seconds of visible time
once: true, // a cookie remembers the visit
});
cow.start();
</script>
2. When it comes, and when it doesn’t
The wait counts visible time after the hero scrolls away; a hidden tab does not bring the cow closer. It never comes to a visitor who has already started a chat, and it waits while a modal or an open chat panel would cover it. Everything is an option, and the page can take over.
const cow = new PinkCow({ siteId: 'demo', hero: '#hero', delay: 15_000, once: false });
cow.start();
cow.setDelay(5_000); // takes effect on the running countdown
cow.summon(); // now, wait or no wait
cow.dueIn; // milliseconds until the cow is due, or null
cow.addEventListener('shown', () => { /* it's on the page */ });
cow.addEventListener('chat-started', ({ detail }) => console.log(detail.suggestion));
cow.addEventListener('left', () => { /* gone; with once: false the wait starts over */ });
3. The chat is Stand’s Visitor API
Nothing talks to Stand until the cow is clicked. Then the chat asks Stand who can answer, reports the activation, and creates the conversation with the visitor’s first message. The cow’s greeting goes along as the opening line, and prompt gives the responder its context: what the visitor just clicked, why the cow is pink, and what custom chat UIs are. Sends go over HTTP, replies arrive on a WebSocket, and the conversation ends when the cow leaves.
const session = await post('/v1/sessions', {
siteId, page: location.href,
standinProfileId: offer.standinProfileId, // or repId for a person
initialMessage: text,
includeOpeningGreeting: true, openingMessage: greeting,
prompt, // context, not a secret
activationId, activationAnalyticsId: 'pink-cow', // ties the chat to the cow in Stand's analytics
showId: offer.showId,
});
4. The cow itself
There is no model file. cow-model.js lofts the body, neck and head from cross-sections, tints every facet a slightly different pink, and projects the spots and the question-mark hatch onto the flank as decals. cow-motion.js walks it: each hoof is planted in world space while it bears weight, so feet never slide, and swinging hooves land where the body will be. The legs are solved with inverse kinematics every frame; the hind legs fold at the hock like a real cow’s. The head turns to the pointer, the eyes blink, the ears flick, the tail swishes and the bell swings on its own little pendulum.
The chat card is paper. cow-stage.js draws the card’s first state onto a canvas texture, folds it into three strips inside the hatch, and unfolds it along a curve to the exact rectangle where the HTML card sits, which then fades in over it. Closing plays the same film backwards.
// Two hinges, folded shut inside the hatch, then sprung open on the way up.
card.setFold([1, 1]);
await stage.animate(0.95, (t) => {
card.setFold([1 - easeOutBack(window01(t, 0.22, 0.72)), 1 - easeOutBack(window01(t, 0.4, 0.95))]);
});
The files
pink-cow.js is the component: options, the wait, the cookie, the clickable cow, the “Curious?” bubble, and the choreography from click to gallop.
cow-chat.js and pink-cow.css are the chat card: an accessible dialog with the transcript, streamed replies, suggestions, follow-up form and attribution.
stand-client.js is the Stand part to copy anywhere: discovery, one-time creation, idempotent sends, WebSocket receive, recovery, handoffs and typing. It is the vintage terminal’s client.
cow-model.js, cow-motion.js and cow-stage.js are the cow, its gait, and the stage with the folding card. cow-glyph.js is the question mark both the hatch and the card use.
site.js and style.css are The Remark: the demo page and its controls. Not part of the cow.
Good to know
- The prompt is context, not a secret. It lives in the page and Stand stores it with the conversation. It tells the responder what the visitor clicked and asks for short, warm replies with at most one cow pun each.
- One cookie, no identifier. With
once: true the cookie holds only seen or engaged, like a dismissed banner. Set cookie to rename it, or once: false to do without.
- Nothing loads until it matters. The page carries the component (a few kilobytes). three.js and the cow load when the cow is due; while the chat is open the cow idles at 30 fps, and when it leaves the GPU context is released.
- It respects reduced motion. A still cow fades in, waits, and fades out; the chat opens without the unfolding. Without WebGL there is no cow at all.
- It is a real dialog. The cow is a button with a label; the chat traps focus, closes on Esc, and announces replies to screen readers.
- Keep the attribution. The card shows the notices and the Powered by Stand link that discovery returns, like the widget does.
How this was made
The cow first walked across stand.chat’s own front page. Claude Opus 5.5, in Claude Code, built it there from the prompt below: the procedural model, the gait, the unfolding card and the trigger rules, checking its own work in a browser as it went. A second prompt turned it into this reusable component and wrote The Remark around it.
A chat that belongs to your site’s world is a prompt away. Stand’s Visitor API keeps the conversation, the AI Stand-in and your team behind it.
The prompt, lightly edited
Create an animated pink 3D cow. Low poly. Realistic animation. This is a reference to the book Purple Cow.
On the Stand Chat front page, if a visitor does not engage with chat but lingers around for over 30 seconds after scrolling away from the hero video, let’s have the pink cow walk through the screen, right to left. The side of the cow should have a big question mark.
If the user clicks the cow, open a custom chat that unfolds (in 3D) from the cow. Basically happening inside the cow. The cow chat should introduce a custom prompt explaining, in a smart subtle way, that this is a reference to Purple Cow. The cow should only appear once per visitor (record it in a cookie). The chat should be easy to dismiss, and the cow should run from the screen in a fun way. The cow should not appear if the visitor otherwise engages with chat.
The purpose is to encourage people to create custom chat experiences and communicate that they are possible. Include in the prompt an explanation of custom chat UIs, with a link to examples.stand.chat.
Think this through hard. The outcome should feel like a high-end design agency came up with it. Feel free to improve or change anything above.
The follow-up
Create a PR to github.com/standchat/examples for the pink cow. Turn it into a reusable component that is not specific to the stand.chat website. Make the timing configurable. Generate a simple, stylish example website that discusses attention and recommends the book Purple Cow, and that uses the cow. Add a control for the cow’s timing and a button for summoning it immediately. Explain that on a real site one could only see the cow once, but on this demo page it comes out every time.
Copy this example
npx degit standchat/examples/pink-cow my-cow