Cart fly (Pro)
ProIncluded in $99The item the agent adds is thrown into the cart, which dips to catch it.
On this page
ProThe item the agent adds is thrown into the cart along an arc, shrinking as it goes; the cart dips to catch it and the count and total roll up.
flyToCart throws a copy of the item's picture along an arc into the cart, shrinking and rounding as it goes, and resolves the moment it lands. Bump the count then: the cart dips under the weight and springs back, the badge pops, and the count and total roll to their new values.
Installation
Needs chatcn Pro
This command works with a Pro license, along with every Pro component.
Or start free: sign up and get three Pro components on us, with a new one every month.
Usage
import { CartButton, flyToCart } from "@/components/ui/chatcn/pro/cart-fly"
await flyToCart(thumbRef.current, cartRef.current)
setCount((c) => c + 1)
<CartButton ref={cartRef} count={count} total={total} />Props
| Prop | Type | Notes |
|---|---|---|
count | number | Going up plays the catch |
total | number | Rolls with the count |
currency | string | Default "USD" |
flyToCart(source, cart, duration?) | Promise<void> | Resolves on landing |
Accessibility
- The cart is a button named with the count; the flying copy is hidden.
Motion
- A 640 ms arc sampled in 18 frames; the catch is a 480 ms squash. Reduced motion: no flight.