Re: [csswg-drafts] [web-animations-1] Replace AnimationEffectTiming(ReadOnly) with setTiming() ?

Thinking aloud,
* The need to prefix some specified properties with `computed` and provide the specified as well seems a bit strange.
* The update/reset/set API's seem a bit hard to reason about. As far as I can tell, there is some internal state as to what has been overridden?

> But I think we can have a good answer to that if we make members of `AnimationEffectTimingProperties` optional and treating unspecified values as a way to *not* overwrite the current values.

As a strawman proposal along these lines, what if :
* `anim.effect.timing` are optional overrides for the animation timing (initially blank when getting a CSS animation).
* `anim.effect.getTiming()` returns a snapshot of specified properties (CSS + overrides from timing)
* `anim.effect.getComputedTiming()` returns a snapshot of the final values, including computed duration and fill.

Then you can easily override a property:
```js
anim.effect.timing.duration = 3000;
```
Copy an animations specified timing to another:
```js
anim2.effect.timing = anim1.getTiming();
// Optionally make additional modifications to timing
```
Revert to CSS values:
```js
anim.effect.timing.duration = null; // or undefined, or delete the member.
```

This is somewhat analogous to inline style, CSS style, and computed style, though making use of snapshots to avoid live objects.

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

Received on Tuesday, 16 January 2018 22:42:12 UTC