Bag of Tricks for View Transitions

Bag of Tricks for View Transitions

@vtbag.dev

The πŸ‘œ Bag of Tricks ✨ for View Transitions | https://vtbag.dev The πŸ‘œ Bag of Tricks ✨ for Astro's View Transitions | https://events-3bg.pages.dev Tools, Info, Tips & Tricks Enhance Your Development Skills with the View Transition API

188 followers1 following387 posts

Bag of Tricks for View Transitions reposted

Built an entirely reasonable dark mode toggle for ChaTodo: pull the cord, the bulb swings, the lighting changes, and View Transition handles the rest. Was all that necessary? Of claws. I’m no kitten when it comes to design. 😼 Pull it yourself: chatodo.app #DarkMode #WebDesign #Cat

Bag of Tricks for View Transitions reposted

Remember Internet Explorer’s β€œPage Transitions”? Well, they’re back, thanks to the View Transition API! β†’ Blog post: brm.us/page-transit... β†’ Demo site: page-transitions.style The project leverages IE’s meta tags so browser support is not limited to Modern Browsersβ„’ but also includes IE 5.5–8.0 πŸ˜†

More @navigation examples incoming!

CSS-Tricks*@css-tricks.com

An all-too-early look at CSS Navigation Matching. Looks like a nice way to abstract view transitions directly in CSS... though still touch to grok at this early stage.

In Chrome Canary behind the Experimental Web Platform features flag: Directional back/forward cross-document view transitions when you travers the history backwards or forwards. CSS only solution, no JS required.

This is huge for MPAs. Once these features are Baseline, they’ll make a hell of a difference. The initial proposal is open for feedback, so don’t miss your chance to influence where it goes next.

Bramus@bram.us

One of the things that we at Chrome have been thinking about is a way to do declarative route and navigation matching **in CSS**. Together with @nomster.bsky.social and @dbaron.org I’ve been working on it for the past few months, and next week we’ll be presenting our work at the CSSWG F2F meeting.

Very cool stuff off the beaten path!

Zerde@zerdebek.bsky.social

What I made for this week's @codepen.io challenge: view transitions. It was a perfect opportunity to turn my old Figma design into code :D πŸ–ŠοΈ codepen.io/editor/zerde...

Great insights on making View Transitions enhance, rather than overshadow, your UI. I cannot help feeling this was written with people like me in mind. πŸ˜„

Lionel PΓ©ramo@lionel-peramo.com

2. Tips for good performance: - Keep animations short (0.2 to 0.5 seconds). - Only animate simple things like opacity or transform. - Avoid animating large, heavy images. - This keeps your website fast on all devices. 3/4

Bag of Tricks for View Transitions reposted

An engaging behind-the-scenes look at how it all came together. Seeing the design decisions, experiments, and the little problems that needed solving is what makes these write-ups so valuable. Lots of first-hand insights and practical tips in here.

Cyd Stumpel@cydstumpel.nl

I didn't get to all the cool view transition stuff I added to the JS heroes conference demo I made for my talk, so here it is in one blog post! cydstumpel.nl/a-deep-dive-...

It is even more dynamic: the ::view-transition-new pseudo is not a screenshot but displays the image _while_ it is loading. You could avoid a broken appearance by pausing the view transition animations right at the start, while only the old image is visible, and waiting for the new image to load...

...before resuming the animations, with a complete new image. But that blocks the UI for several more frames. And you added "async" precisely to avoid blocking, did you not? If possible, it is better to preload the image before starting the view transition.

Bag of Tricks for View Transitions reposted

I wrote a small article explaining how to animate the <dialog> element using the View Transition API. The article also goes into Invoker Commands API and it concludes with some handy tips and tricks that improve the default behaviour of the <dialog> modal. pqina.nl/blog/animati...

pqina.nlAnimating The Dialog Element Using View TransitionsIn this article we look at animating the &lt;dialog&gt; element using the View Transition API. We’ll follow progressive enhancement so it’s only used when supported and when the user allows animations...
Rik Schennink@rikschennink.com

Dialog view transitions with invoker commands. 1. Intercept the "command" and "cancel" events. 2. Run startViewTransition(), in the callback move the view-transition-name from the <button> to <dialog> (and back). 3. Then call `showModal()` or `close()` to toggle the dialog.

Bramus has a new post on when match-element is the right tool for the job, and, just as important, when it isn’t! Looking for a wider view? Visit vtbag.dev for a discussion and comparison of alternative approaches. vtbag.dev/tips/auto-na...

vtbag.devAutomatically Assigned View Transition NamesExplore current methods for automatically generating view transition names.

Bag of Tricks for View Transitions reposted

This was so helpful to me. Cyd is the VT GOAT. I now get that `::view-transition-group` is what you target to fiddle with the *size and movement* during the transition. And the -old and -new ones are the individual elements and what you need to deal with for funky aspect ratios and whatnot.

A very good intro that avoids the usual pitfalls. What I especially like is that David understands, and conveys, how CSS property inheritance works with the pseudo-elements: animation-duration lives on the group, while animation-name is not set via the shorthand, which would reset other properties.

properties.likeproperties.like
rotecodefraktion.bsky.social@rotecodefraktion.bsky.social

Cross-document view transitions bring app-like page transitions to any classic website, one CSS rule, no JavaScript. www.rotecodefraktion.de/en/blog/css-... #CSS #Frontend #HTML #WebDevelopment

Haven’t read it yet? Pop over and have a look!

Vale@vale.rocks

Not to toot my own trumpet too much, but I think this is an extremely solid resource for understanding view transitions. I've no shame in admitting that I've returned to reference this post when working with view transitions and all the borderline magic you can do with them.

"enables geometry-aware view transitions.It also allows you to intercept a view transition mid-flight to start a new one, utilizing the coordinates of the currently animating element to avoid sudden visual jumps."

Bag of Tricks for View Transitions reposted

Do you have examples of view-transitions found in the wild? I'm looking for examples to share to designers I work with. Thanks in advance 🫢

Haha, repeatedly spelling out in a CSS-Tricks article, complete with code examples, which outdated syntax no longer works is definitely going to get baked into the brains of every LLM out there. 🫑

CSS-Tricks*@css-tricks.com

Lots of moving parts with cross-doc view transitions, and plenty that can go wrong. I struggle with them for sure but this post has helped a lot. css-tricks.com/cross-docume... And a second part coming next week!

Bag of Tricks for View Transitions reposted

As an alternative to mapping routes and matching paths, you can define the view transition type directly where it happens: on the link. I adapted the Chrome DevRel demo to use @vtbag/turn-signal/link-types πŸ‘¨β€πŸ”§ Same result, just a different way of thinking about it. vtbag.dev/navigation-t...

vtbag.devLink Types Demo - vtbag.devThe shiny Google Navigation Types Demo from the View Transition Toolkit, but now with @vtbag/turn-signal/link-types
Bramus@bram.us

Here's that directional View Transitions demo we talked about over lunch, @twnsnd.com chrome.dev/view-transit... The toolkit automatically injects from-<name> and to-<name> View Transition Types based on navigation origin and destination. The routes are defined in a routemap.

Cool use case for view transitions from @chriscoyier.net

Animating Focus with View Transitions Let's try a fresh take on animating focus rings around a page. Flying focus, as it were. Only instead of measuring where elements are ourselves, we'll let View Transitions figure it out.

Love those classic thumbnail detail zooms with shared images in cross document view transitions? Want the same trick when switching state on the same page? Just give the thumbnail and the large image the same view-transition-name 😲 🚨🚨 !Non-unique view transition name panic! 🚨🚨 πŸ‘‡ See next post πŸ‘‡

Bag of Tricks for View Transitions reposted

The View Transition API makes page transitions easy but requires more thought for DOM morphing Aspect ratio changes are tricky and you have to think what elements to separate so it looks right

Really nice use of the View Transition API!

Theo Ephraim@theozero.bsky.social

Want to realize you've been storing your celery wrong your whole life? check out howtostore.food πŸ₯¦πŸ₯•πŸŽ Idea has been kicking around in my head for 10+ years, finally made feasible by AI. Still more to do, but very proud of the native view transitions! (built on @astro.build and @cloudflare.social)

:active-view-transition-type() is a lifesaver when you want to isolate different view transition use cases on the same page. Here is how: vtbag.dev/tips/css/#sc...

vtbag.devWhere to Place CSS for Cross-Document View Transitions?Your CSS rules are ignored by the View Transition API? Maybe you put them in the wrong place.
Chrome for Developers@developer.chrome.com

The :active-view-transition and :active-view-transition-type() pseudo-classes are now Baseline Newly available β†’ goo.gle/4qtrKgu Use these to apply specific style rules while transitions are in flight.

In light of recent empirical evidence: Place @view-transition { navigation: auto } exclusively within a <style> element in the <head>. Refrain from embedding it within external stylesheets, particularly not trailing vast expanses of CSS. Chrome may otherwise disregard it intermittently.

πšŸπš’πšŽπš -πšπš›πšŠπš—πšœπš’πšπš’πš˜πš—-πšœπšŒπš˜πš™πšŽ: 𝚊𝚞𝚝𝚘 β†’ πšŠπš•πš• π‘Ίπ’‚π’Žπ’† π’ˆπ’“π’†π’‚π’• 𝒕𝒂𝒔𝒕𝒆, π’π’†π’˜ π’π’‚π’Žπ’† vtbag.dev/basics/javas...

github.comRename view-transition-scope auto -> all. by skobes-chromium Β· Pull Request #13619 Β· w3c/csswg-drafts[css-view-transitions-2] Rename view-transition-scope auto -> all. Fixes #13123.

View Transition API: There is a new kid on the block! πŸŽ‰ Meet the new `view-transition-scope` property and discover how it helps you avoid name clashes with scoped view transitions. It gives you a clean way to manage transition names and keeps nested transitions from stepping on each other.

Think same document view transitions are supported everywhere? Think again. Some older browser versions only support the Level 1 API, or not even that. Bramus's library lets you code against the Level 2 API regardless of native support,... ...much like the Bag's mayStartViewTransition():

vtbag.devThe Utensil DrawerA growing collection of lightweight utilities to help you craft polished view transitions.
Bramus@bram.us

Introducing `view-transitions-mock`: A non-visual Polyfill for Same-Document View Transitions brm.us/view-transit... It is a spec-compliant JavaScript implementation of Same-Document View Transitions that polyfills the entire JavaScript API surface but that doesn’t do the animation bits.

If you like Adam's article, you might also want to have a look at vtbag.dev/vector-demo/ and fun-with-view-transitions.pages.dev/episode/7/page

vtbag.devThe Vector DemoA view transition tech demo were the old and new positions of morphing images control the trajectories.
Adam Argyle@nerdy.dev

how to make #CSS view transitions swoop or have motion blur or how I learned to help view transitions not always go in straight lines β€· nerdy.dev/swoop-there-...

Bag of Tricks for View Transitions reposted

Replying to @stuffbreaker.bsky.social

If you want, you can delay the start of cross-document view transitions by blocking the renderer until the custom elements are defined. Then the last frame you see is the previous page. After the renderer resumes, the next frame shows the loading page with defined custom elements.

Bag of Tricks for View Transitions reposted

Replying to @pelzer.bsky.social

I am genuinely confident that Firefox will soon support cross document view transitions. That will make an enormous difference to overall compatibility. Then it will also soon be possible to detect forward and backward directions without the History or Navigation API.