W3C home > Mailing lists > Public > public-css-archive@w3.org > February 2018

Re: [csswg-drafts] [css-values] Trigonometric functions

From: Amelia Bellamy-Royds via GitHub <sysbot+gh@w3.org>
Date: Sun, 18 Feb 2018 05:13:20 +0000
To: public-css-archive@w3.org
Message-ID: <issue_comment.created-366493254-1518930799-sysbot+gh@w3.org>
I also periodically come across situations in CSS -- and very often in SVG -- where trig functions would be very helpful for converting between angles and x/y dimensions.

In static markup, the solution is to hard-code approximate values, but that often leaves pixel gaps or discontinuities from rounding errors. In dynamic situations, as others have mentioned, the only solution is JavaScript (with lots of converting back and forth between radians for the JS functions and degrees or turns for my design and for SVG properties, which is the only time I usually need `Math.PI`!).

I would argue for adding the trig functions and then wait and see how much demand there is for pi constant, or a root-2 constant. As Liam notes, an author could always define an arbitrary-precision constant as a custom property. 

And most importantly, separating out the two features means that we could move ahead with functions without having to first decide the best syntax for constants.

GitHub Notification of comment by AmeliaBR
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/2331#issuecomment-366493254 using your GitHub account
Received on Sunday, 18 February 2018 05:13:26 UTC

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