Get the latest tech news

The "most hated" CSS feature: cos() and sin()


I want to look at practical uses for CSS trigonometric functions. And we'll start with what may be the most popular functions of the "worst" feature: sin() and cos().

We’ll multiply an item’s index by a certain angle that is passed into the sin() function, and that will return a ratio that describes how high or low the element should be on the wave. I’ve learned that perfect oscillatory movement — like a pendulum that swings back and forth in perpetuity, or a ball that never stops bouncing — doesn’t really exist. Also, before I forget, here is another demo I made using cos() and sin() that didn’t make the cut in this article, but it is still worth checking out because it dials up the swirly-ness from the last example to show how wacky we can get.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of Sin

Sin

Photo of cos

cos

Photo of css feature

css feature

Related news:

News photo

The Christians Who Believe Empathy Is a Sin

News photo

T * sin (t)' ≈ Ornamented Christmas Tree (2013)

News photo

Sin taxes are suffering from a shortage of sinners