[csswg-drafts] [web-animations-2] procedure to convert a time-based animation to a proportional animation might yield a division by 0 (#11276)

graouts has just created a new issue for https://github.com/w3c/csswg-drafts:

== [web-animations-2] procedure to convert a time-based animation to a proportional animation might yield a division by 0 ==
The procedure to [convert a time-based animation to a proportional animation](https://drafts.csswg.org/web-animations-2/#animations) has the following sub-step:

> Let _total time_ be equal to [end time](https://drafts.csswg.org/web-animations-2/#end-time)

… and then several steps after that where we divide values by _total time_. However, _total time_ may be 0, for instance if the specified delay is the negative value of the specified iteration duration, as is the case in the WPT test [scroll-animations/scroll-timelines/effect-updateTiming.html](https://github.com/web-platform-tests/wpt/blob/d6ea893fddc33c9215d0a1c9b06066ff6a4d1bba/scroll-animations/scroll-timelines/effect-updateTiming.html#L47-L56):

```javascript
test(t => {
  const anim = createScrollLinkedAnimationWithTiming(t, {duration: 100, delay: -100})
  anim.play();
  anim.effect.updateTiming({ delay: -100 });
  assert_equals(anim.effect.getTiming().delay, -100, 'set delay -100');
  assert_equals(anim.effect.getComputedTiming().delay, -100,
                'getComputedTiming() after set delay -100');
  assert_percents_equal(anim.effect.getComputedTiming().endTime, 0,
                        'getComputedTiming().endTime after set delay -100');
}, 'Allows setting the delay to a negative number');
```

The spec needs a provision for computing the [start delay](https://drafts.csswg.org/web-animations-2/#start-delay), [end delay](https://drafts.csswg.org/web-animations-1/#end-delay) and [iteration duration](https://drafts.csswg.org/web-animations-1/#iteration-duration) in this case.

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/11276 using your GitHub account


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

Received on Tuesday, 26 November 2024 21:47:36 UTC