Re: [csswg-drafts] [css-animations] Extend animation-play-state for triggering animations when an element is in viewport (#8942)

I think another way to tackle this is by imagining how this would be implemented today:

You'd have 2 IntersectionObservers: one for triggering on entry (`isIntersecting=true`) that flips the value to `true`, and a second one for triggering on exit (`isIntersecting=false`), with a range that *has* to be larger than the first one's, that flips the value to `false`.

So you end up with 2 ranges:

1. range for entry to flip to `true`
2. range for exit to flip to `false`

Then, it could become something along the line of:

```css
animation-trigger: view(block 15%) cover / view(block -10%) cover repeat;
```

And the second range is optional of course, and *has* to be larger than the first range (I think that's possible to validate, right?).

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


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

Received on Wednesday, 12 July 2023 15:22:14 UTC