{"id":377074,"date":"2023-03-08T06:05:52","date_gmt":"2023-03-08T14:05:52","guid":{"rendered":"https:\/\/css-tricks.com\/?p=377074"},"modified":"2023-03-08T06:06:03","modified_gmt":"2023-03-08T14:06:03","slug":"creating-a-clock-with-the-new-css-sin-and-cos-trigonometry-functions","status":"publish","type":"post","link":"https:\/\/css-tricks.com\/creating-a-clock-with-the-new-css-sin-and-cos-trigonometry-functions\/","title":{"rendered":"Creating a Clock with the New CSS sin() and cos() Trigonometry Functions"},"content":{"rendered":"\n

CSS trigonometry functions are here! Well, they are if you\u2019re using the latest versions of Firefox and Safari, that is. Having this sort of mathematical power in CSS opens up a whole bunch of possibilities. In this tutorial, I thought we\u2019d dip our toes in the water to get a feel for a couple of the newer functions: sin()<\/code><\/a> and cos()<\/code><\/a>.<\/p>\n\n\n\n

There are other trigonometry functions in the pipeline \u2014 including tan()<\/code><\/a> \u2014 so why focus just on sin()<\/code> and cos()<\/code>? They happen to be perfect for the idea I have in mind, which is to place text along the edge of a circle. That\u2019s been covered here on CSS-Tricks when Chris shared an approach that uses a Sass mixin<\/a>. That was six years ago, so let\u2019s give it the bleeding edge treatment.<\/p>\n\n\n\n\n\n\n\n

Here\u2019s what I have in mind. Again, it\u2019s only supported in Firefox and Safari at the moment:<\/p>\n\n\n\n