Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[css-backgrounds] Add support for squircle and superellipse to corner-shape #6296

Open
simevidas opened this issue May 19, 2021 · 2 comments

Comments

@simevidas
Copy link
Contributor

simevidas commented May 19, 2021

The corner-shape property is currently defined in the Backgrounds 4 module.

I’m posting this issue so that folks who want a simple way in CSS to make a box in the shape of a squircle or superellipse* can find this issue and upvote it.

The idea to add this feature to the corner-shape property was suggested by @AmeliaBR on Twitter.

squircle.mp4

*For more information, see Pavel Laptev’s article “Squircles on the Web — Houdini to the rescue.”

@Lorp
Copy link

Lorp commented May 19, 2021

How about allowing cubic-bezier() as an alternative to round? Syntax would be the same as in animation-timing-function, and it would be scaled and flipped appropriately for each corner.

@mikkorantalainen
Copy link

I think adding keyword superellipsis to property corner-shape would make a lot of sense. The visual difference between the default round and superellipsis would be small enough that there would be nice gradual take-off unlike with more complex corner shapes. In addition, having explicit support for superellipsis would allow keeping the author CSS simpler and browser engines could have special high-performance code path for the superellipsis.

I would expect that most authors would use corner-shape: superellipsis for most rectangular elements with rounded corners and corner-shape: round for elements that need to match with actual circles. I think the superellipsis should automatically use aspect ratio where the difference over the whole curve is minimal compared to round. Another option would be to make superellipsis(ratio) function but in that case, the suggestion about cubic-bezier() is already close enough in complexity.

The use cases for more complex corner shapes are rare enough so there isn't need for such clean solutions there and the authors can be expected to use more verbose syntax such as SVG paths for every corner.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants