-
Notifications
You must be signed in to change notification settings - Fork 657
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-shapes-2] corner-shape support for superellipsis #10993
Comments
pinging some folks that talked to me about this at some point @tabatkins @fantasai @smfr @vmpstr @LeaVerou @stubbornella @progers |
I quite like this! The fact that it directly handles straight lines (bevel), round corners, squircles, and square corners (and the inversions of all of them; scoop and notch) is great; it also gives us an unexpected new ability to animate between these shapes, which kinda rules. I don't think it's a problem that the function takes numerical value with "magic numbers". That's just a result of making anything parametrized. The fact that all the "meaningful" behaviors (those common enough to be granted names) are the integer values 0, ±1, and ±2, and ±∞ means, imo, that the argument is meaningful enough. I definitely agree with log-rescaling the parameter. It makes the function substantially easier to use and understand, with amazing symmetry (positive and negative values are the exact same shape, just convex or concave). It also makes "large enough to look square" a much more achievable value, and thus much friendlier to animation; going from Quick note about animation - I suspect we want to have keywords compute to themselves, but convert to an equivalent And yeah, as you mention (and is also mentioned by Simon and me in #8591 (comment)), we'll need to define how concave corners (negative Unfortunately I do not have a better name suggestion. However, maybe we can simply avoid the issue entirely, and just represent it as a naked |
I really like this. Just one check, following up on a discussion we had at TPAC: does this formulation deal well with "/" version of |
I think you're asking if superellipses support an elliptical corner (different absolute lengths for x and y radius)? If so, yes, it's a superellipse after all. ^_^ |
Okay, I know I said I no longer think |
|
How is that the opposite? It sounds like exactly the same? 🤔 |
Tab says to convert keywords to equivalent numeric only for interpolation. |
I worked a bit on trying to find an option for
corner-shape
on the new API that supported squircles and had inner/outer symmetry.After a bit of work I'm proposing we add a value
se(x)
(name TBD) that exposes a superellipse:Where$a$ and $b$ are the width and height of the shape. And the default parameter $n$ works in the interval $[0,\infty)$ where:
My proposal would be to use$x$ as a parameter where $n=2^x$ . This leads to a function that is symmetrical on $0$ where positive values are outside the bevel and negative values are inside, such as:
I've wrote a small demo with this function here.
The superellipse is very easily parameterizable (both angular and$[0,1]$ ), so I'm guessing it shouldn't be a problem to implement it in an efficient way. There's a small issue where if we are "inside the bevel" the corners can sometimes overlap. For those cases, we will have to do some math and limit the size of the corners to prevent it from happening (the demo currently doesn't handle those cases).
There are other available squircle formulations (like the Fernandez-Guasti squircles) where the parameter is more intuitive ($0$ means circle, $0.5$ is squircle, and $1$ is square). Unfortunately, those formulations don't extend to inwards the bevel, so we would lose some expressiveness.
We could, together with this, also provide certain easy-to-use values (like$[0,1]$ to $[1,\infty) $ ).
squircle
meaningse(2)
, orbevel
meaningse(0)
, etc...). And they could also contain parameters (i.e.squircle(y)
mappingHighlights:
Lowlights:
The text was updated successfully, but these errors were encountered: