Matt Perry

Matt Perry

@citizenofnowhe.re

πŸ”΅ Creator of motion.dev πŸ“· Photographer citizenofnowhe.re

6.4K followers57 following306 posts

Matt Perry reposted

If you thought we were done with View Transitions, guess again! A feature Chrome is working on, is β€œScoped View Transitions”, which allow you to scope a VT to a subtree of the DOM. This unlocks things like concurrent transitions and prevents layering issues. developer.chrome.com/blog/scoped-...

By default, a carousel should paginate as many items as possible. But with a non-looping carousel you sometimes end up in the situation where you've got a this kind of straggler page. 🧡 [1/2]

The Motion+ Carousel detects these kind of short bois. If the last page is below the average page length by a TBD threshold, it will attempt to redistribute the page thresholds so they're more evenly distributed. Coming September! 🧡 [2/2]

I have two rules for carousel pagination controls. 1. A "page" is calculated from the current item to the start of the next partially-obscured item. 2. Use the current *target* offset, not the current visual offset, to find the next partially-obscured item 🧡

View full thread

The correct (IMO) thing to do is to calculated the next page based on the *target* offset. Leaping vs creeping. You can see in the page indicator that we've correctly moved through three pages from three clicks.

Anyway this is a long way of saying: πŸ“’ Carousel is the next component coming to Motion+ - target mid-September release. πŸŽ‰ Also, Motion+ has reached 1000 users! This is a mind-blowing and humbling milestone, thanks for all the support! Join Motion+ motion.dev/plus

motion.devMotion+ β€” 180+ premium examples and exclusive componentsShip polished animations faster: 180+ copy-paste animation examples and premium Motion components for JS, React & Vue. One-time purchase, lifetime updates.

I have two rules for carousel pagination controls. 1. A "page" is calculated from the current item to the start of the next partially-obscured item. 2. Use the current *target* offset, not the current visual offset, to find the next partially-obscured item 🧡

View full thread

It's weird to animate just one item at a time. It's like those dreams when you're trying to run away from something and your legs turn to pillow. Just me? Instead, animating all the fully-visible items out the way will cut the number of clicks needed by a huge factor. [...]

Likewise if we're clicking next/prev multiple times in a row, most carousels either 1. Do nothing - allow current animation to continue before allowing further pagination 2. Calculate the next page based on the *current* offset, mid-animation. 3 rapid clicks doesn't get you far:

I have two rules for carousel pagination controls. 1. A "page" is calculated from the current item to the start of the next partially-obscured item. 2. Use the current *target* offset, not the current visual offset, to find the next partially-obscured item 🧡

Carousels rarely fulfil both of these rules. The ones that do are all on @framer.com - and I wrote that one (unless we find a bug, in which case Ben wrote it and what's a carousel) If a user is clicking "next" we can assume they're done with all the current items.

Friday

Matt Perry@citizenofnowhe.re

πŸš€ Just published a new example: Cursor Trail No need to wire your own pointer events: usePointerPosition() in Motion+ returns x/y motion values powered by a single site-wide event handler, throttled to the frameloop. examples.motion.dev/react/cursor...

Many thanks to Build UI for supporting Motion from the very start πŸ™ Now that Build UI is winding down we're looking for new sponsors! Support Motion, get your brand in front of over 100k developers a month, and receive Motion+ for your whole team: motion.dev/sponsor

🎨 Motion Studio is in development. The landing page is a proper CSS & Motion transition editor, built using the upcoming Motion Studio SDK. Changes are saved via the URL, so you can bookmark your faves! Build your transitions now: motion.dev/studio

πŸš€ Motion+ Ticker now supports overflow! This means you can lay a ticker out within your document flow, and items will visually extend out to the edges of your viewport. Ticker's optimal cloning strategy will incorporate the viewport dimensions for minimal cloned elements.

πŸš€ Motion for React 12.22 introduces stagger() support for delayChildren! This allows greater stagger control than the now-deprecated staggerChildren/Direction. With staggering out from the center or indexed item, plus support for eased stagger.

πŸ”” Stay ahead of the (bezier) curve β€” Motion+ Team admins can now enable Slack notifications for new Motion releases! Granular controls allow you opt-in to alerts for either new features, bug fixes, or both!

Motion usage continues to explode on npm. Downloads have more than doubled in a year. BUT - site visitors are gradually trending downwards πŸ€” Perhaps there's a summer lull but IMO these two trends are intuitively incompatible without a broader shift at play (you can guess)

View full thread

That *will* happen. But it's parasitic. Gemini sinks its teeth into websites, drains them of information, bleeds them of visitor count and revenue. This will obviously kill those sites. Same could be true of Motion. The challenge now is adapting.

I think MCPs are a big part of the solution here, at least for OSS. Motion for AI sits inside your editor and gives you docs without ever having to hit the website. So from here, what's the upsell? That's the exercise for this year. motion.dev/docs/ai-quick-start

motion.devQuick start with Motion for AI | Motion for AIGet started with Motion for AI's CSS spring generation tools, curve visualisation, vibe coding guides, LLM documentation and custom rulesets.

Motion usage continues to explode on npm. Downloads have more than doubled in a year. BUT - site visitors are gradually trending downwards πŸ€” Perhaps there's a summer lull but IMO these two trends are intuitively incompatible without a broader shift at play (you can guess)

View full thread

That's not to say I don't see this risk. I'm all in on AI. I just think if you're building something actually new, like my approach to child cloning in the Motion+ Ticker motion.dev/blog/buildin... then I fail to see how LLMs could ever do this from a first principles perspective

motion.devBuilding the ultimate ticker - Motion BlogTicker compoments are becoming common decorative features, but building a good one isn't easy. Let's take a look at the problem with CSS components, and how Motion+ Ticker aims to solve them.

So I think the bigger risk for me is people never getting to see the Ticker, or Cursor etc, because they're never on the website, and therefore never want to buy it. This is true of all AI editors, @diabrowser.com etc. I also think the web is so bad now that it does need an AI layer

Motion usage continues to explode on npm. Downloads have more than doubled in a year. BUT - site visitors are gradually trending downwards πŸ€” Perhaps there's a summer lull but IMO these two trends are intuitively incompatible without a broader shift at play (you can guess)

View full thread

Therefore it could be unlikely to make up for the loss of traffic from Google. AI is changing habits here, quickly. The obvious worry, when starting a business off the back of OSS, is that all the premium examples, all the Motion+ APIs - AI will be able to write all that soon

My current methodology when starting a new Motion+ API or example is to get AI to generate it first. How well does it do? If the answer is "dogshit" then perfect - I've found something I can build and sell. This is the answer more often than not.

Motion usage continues to explode on npm. Downloads have more than doubled in a year. BUT - site visitors are gradually trending downwards πŸ€” Perhaps there's a summer lull but IMO these two trends are intuitively incompatible without a broader shift at play (you can guess)

It's still small compared to Google, but ChatGPT was last week the second largest source of motion.dev traffic. This has grown from nothing 3 months ago. Perhaps this growth will continue but from my own experience you can use a library and never hit the source docs

View full thread

The ticker only measures/animates while in view and respects reduced motion. It's also fully keyboard-accessible. Tab into and out of the ticker with one keypress, and navigate between focusable items with the arrow keys. This is no tab-hog!

Ticker features an optimal cloning strategy. Most tickers rely on manual cloning, or auto-cloning too many items (img 1) When items leave the viewable area, they get thrown to the other end of the carousel. This can eliminate cloning entirely (img 2 & 3)

πŸ“ Introducing resize() in Motion 12.16! This tiny utility has a simple API for tracking changes to viewport and element size. Element tracking uses a single shared ResizeObserver for optimal performance. πŸ”— motion.dev/docs/resize

motion.devresize | Motion for JavaScriptEfficiently monitor and react to size changes of the viewport, or HTML and SVG elements, with resize. This function uses the ResizeObserver API to provide performant, per-element resize event handling...