Re: [csswg-drafts] [css-view-transitions-2] Ignore offscreen elements from participating in transitions (#8282)

> It could be that a customizable margin property in addition would fix that

We could use insets to determine the capture area? Positive values for insets go inwards and negative ones go outwards.

Making up properties as I go, it would result in something like this:

```css
view-transition-capture-inset: auto | <percentage-length>{1,4}; /* To be set on the transition root upon which you call startViewTransition(). For `document`, set this on `:root` */
view-transition-visibility: always | not-clipped; /* To be set on individual elements */
```

An alternative to `view-transition-visibility` as suggested a few times here is to determine the “capture things or not” on the transition root itself. Something like:

```css
view-transition-capture-inset: auto | <percentage-length>{1,4};
view-transition-capture-mode: all | not-clipped;
```

The case against `view-transition-visibility` is that you need to do this on a per-element basis. OTOH is does give you fine-grained control.

The case against `view-transition-capture-mode` is that it’s _“all or nothing”_. OTOH it’s “set once and you’re good”.

_Side note: a hack would be to use scroll-driven animations to unset the `view-transition-name` when an element out of view, but that’s a hack that we shouldn’t really rely on here._

-- 
GitHub Notification of comment by bramus
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/8282#issuecomment-2163827885 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Wednesday, 12 June 2024 20:18:29 UTC