You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Creates a rectangle with optional corner rounding.
33
+
Creates a rectangle with optional corner rounding. Defaults to a 2x2 rectangle centered at the origin. Use `perVertexRounding` to apply different rounding to each corner.
27
34
28
35
## `createStar`
29
36
30
37
```ts
31
38
createStar(
32
-
points: number,
33
-
outerRadius: number,
34
-
innerRadius: number,
35
-
rounding: CornerRounding
39
+
numVerticesPerRadius: number,
40
+
radius?:number,
41
+
innerRadius?:number,
42
+
rounding?:CornerRounding,
43
+
innerRounding?:CornerRounding|null,
44
+
perVertexRounding?:CornerRounding[] |null,
45
+
centerX?:number,
46
+
centerY?:number
36
47
): RoundedPolygon
37
48
```
38
49
39
-
Creates a star polygon. `innerRadius` is relative to `outerRadius` - a value of `0.5` means the inner points are halfway to the center.
50
+
Creates a star polygon. Defaults to radius 1, inner radius 0.5, centered at the origin. `innerRadius` is relative to `radius` - a value of `0.5` means the inner points are halfway to the center. Use `innerRounding` to apply different rounding to inner vertices.
Creates a regular polygon (triangle, pentagon, hexagon, etc.) with the given number of vertices.
65
+
Creates a regular polygon (triangle, pentagon, hexagon, etc.) with the given number of vertices. Defaults to radius 1, centered at the origin, with no rounding.
-**radius** (0–1): Fraction of edge length used for rounding. `0` is sharp, `1` rounds the entire edge.
58
-
-**smoothing** (0–1, default `0`): Cubic Bezier easing applied to the rounding. `0` gives circular arcs, higher values produce softer organic curves.
75
+
-**radius** (0-1): Fraction of edge length used for rounding. `0` is sharp, `1` rounds the entire edge.
76
+
-**smoothing** (0-1, default `0`): Cubic Bezier easing applied to the rounding. `0` gives circular arcs, higher values produce softer organic curves.
59
77
60
78
## `RoundedPolygon`
61
79
62
80
The base shape class. Key methods:
63
81
64
82
### `.normalized(): RoundedPolygon`
65
83
66
-
Returns a copy centered at the origin and scaled to fit within a unit circle. **Required before passing custom polygons to `Morph`.**
84
+
Returns a copy scaled to fit within a 0-1 coordinate space (unit square), centered within the bounding box. **Required before passing custom polygons to `Morph`.**
Converts cubics to a CSS `clip-path: path("...")` string. Preserves exact cubic Bezier curves. CSS **cannot** transition between two `path()` values, so use this only for static shapes.
44
+
Converts cubics to a CSS `clip-path: path("...")` string. Optional `size` scales the output (default 100). Preserves exact cubic Bezier curves. CSS **cannot** transition between two `path()` values, so use this only for static shapes.
@@ -80,4 +83,4 @@ const morph = new Morph(star.normalized(), rect.normalized());
80
83
const d =toPathD(morph.asCubics(0.5), 200);
81
84
```
82
85
83
-
`.normalized()`centers the shape at the origin and scales it to fit within a unit circle. This ensures both shapes share the same coordinate space for morphing.
86
+
`.normalized()`scales the shape to fit within a 0-1 coordinate space (unit square), centered within the bounding box. This ensures both shapes share the same coordinate space for morphing.
0 commit comments