W3C home > Mailing lists > Public > public-css-archive@w3.org > December 2017

Re: [csswg-drafts] [web-animations-2] Idea: Custom Effects

From: Brian Birtles via GitHub <sysbot+gh@w3.org>
Date: Tue, 05 Dec 2017 04:44:31 +0000
To: public-css-archive@w3.org
Message-ID: <issue_comment.created-349194071-1512449070-sysbot+gh@w3.org>
_From @Martin-Pitt on August 11, 2016 12:26_

Do agree that in terms of flexibility/compat passing an options object makes more sense.

However still think we can go a level lower by not having the element as it is still implying a dependency with the DOM.

I noticed that computed timing options have a `progress` which is equivalent to the fraction from onsample, so this object does make a lot more sense and gives all the info needed.


Perhaps this then?
```javascript
const effectOptions = {
    onsample(timing) {
        let fraction = timing.progress;
    }
};
const timingOptions = {
    duration: 1250,
    easing: 'ease-in'
};
const effect = new WebEffect(effectOptions, timingOptions);
const animation = new Animation(effect, document.timeline);
animation.play();
```

-- 
GitHub Notification of comment by birtles
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/2063#issuecomment-349194071 using your GitHub account
Received on Tuesday, 5 December 2017 04:44:44 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 5 July 2022 06:41:21 UTC