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

Re: [csswg-drafts] [css-values] [css-fonts-4] Native interpolation function in CSS

From: Glen Maddern via GitHub <sysbot+gh@w3.org>
Date: Wed, 24 May 2017 23:43:15 +0000
To: public-css-archive@w3.org
Message-ID: <issue_comment.created-303883122-1495669394-sysbot+gh@w3.org>
Coming super late to this discussion I know but I _really_ like Tab's variation on the original proposal. I think you can do pretty much anything you need with it, correct?

```
interpolate(18px, 24px, calc((100vw - 400px) / 400px), ease-in-out);
interpolate(red, blue, var(--slider-position));
```

The form would be `interpolate(from, to, fraction, easing)` and `fraction` would be automatically clamped between 0 and 1. You'd need unit algebra to use `calc` in the first example but I'd be suggesting using `style.setProperty('--slider-position', mouseX / elWidth)` or something in JS for the second.

-- 
GitHub Notification of comment by geelen
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/581#issuecomment-303883122 using your GitHub account
Received on Wednesday, 24 May 2017 23:43:22 UTC

This archive was generated by hypermail 2.3.1 : Monday, 23 October 2017 10:12:54 UTC