CSS Trigonometry is surprisingly useful
Channel: Kevin Powell
Date: 2023-03-23

I'm working on a course that covers Sass in real world situations, and a lot more: https://beyondcss.dev

Trigonometry is here in CSS with sin(), cos(), and tan(), as well as a few others. I kept seeing a lot of people excited for these, but I didn't really get why for a long time, but I found a good use case for sin() and cos() and wanted to share it in this video.

I also take a look at how we can step things up with a Sass/SCSS loop and a little bit more than that as well.

🔗 Links 
✅ The finished code - first example: https://codepen.io/kevinpowell/pen/qBMQJVr?editors=1100
✅ The finished code - second example: https://codepen.io/kevinpowell/pen/MWqXwyE/5a86eb4081548272d1bcf3eab23de5dehttps://codepen.io/kevinpowell/pen/MWqXwyE/5a86eb4081548272d1bcf3eab23de5de
✅ A great breakdown of the basics of the trig functions on Codrops: https://tympanus.net/codrops/2021/06/01/trigonometry-in-css-and-javascript-introduction-to-trigonometry/
✅ More examples from web.dev: https://web.dev/css-trig-functions/ 

⌚ Timestamps
00:00 - Introduction
00:52 - A use case for sin() and cos() in CSS
01:25 - What we are starting with
02:00 - Basic styling for the outer circles
03:20 - Getting the outer circles centered
04:17 - Positioning the outer circles with magic numbers
05:30 - Positioning with sin() and cos()
08:04 - Improving things with custom properties
10:40 - Speeding things up with a Sass/SCSS loop
15:09 - Using sin() and cos() for animation delays

#css

--

Come hang out with other dev's in my Discord Community
💬 https://discord.gg/nTYCvrK

Keep up to date with everything I'm up to
✉ https://www.kevinpowell.co/newsletter

Come hang out with me live every Monday on Twitch!
📺 https://www.twitch.tv/kevinpowellcss

---

Help support my channel
👨‍🎓 Get a course: https://www.kevinpowell.co/courses
👕 Buy a shirt: https://teespring.com/stores/making-the-internet-awesome
💖 Support me on Patreon: https://www.patreon.com/kevinpowell

---

My editor: VS Code - https://code.visualstudio.com/

---

I'm on some other places on the internet too!

If you'd like a behind the scenes and previews of what's coming up on my YouTube channel, make sure to follow me on Instagram and Twitter.

Twitter: https://twitter.com/KevinJPowell
Codepen: https://codepen.io/kevinpowell/
Github: https://github.com/kevin-powell

---

And whatever you do, don't forget to keep on making your corner of the internet just a little bit more awesome!