Skip to content
Macneil Shonle’s Blog

Squircles and Sparkles

You know what's easy to find in app icons these days? Squircles and "AI sparkle" stars.

How do you get the squircle? Well, we know the formula for the unit circle is

x2+y2=1.x^2 + y^2 = 1.

Unit Circle
The Unit Circle

But we can generalize to any positive real power of dd, with a radius of rr:

xd+yd=rd|x|^d + |y|^d = r^d

Here's what you'll get when you let d=7d=7:

Unit Squircle
A 7th Power Unit Squircle

As dd goes higher, the shape becomes a closer approximation of a rectangle. (Interestingly, if you let d=1d=1 you get an actual rectangle, but tilted 45 degrees like a diamond.)

It's when dd is fractional that you get the sparkle. Here's what you'll get when you let d=0.4d=0.4:

Unit Sparkle
One of Many Sparkles

With the help of Claude Code, a made an Icon Builder Web App. It can export SVGs, a favicon.ico, and an iOS-ready PNG for the homescreen.

You can find the code on GitHub.