@rogieking/figui3 9.0.0 → 9.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +34 -3
- package/components.css +2 -4
- package/dist/components.css +1 -1
- package/dist/fig.css +1 -1
- package/dist/fig.js +5 -5
- package/fig.js +259 -53
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -829,11 +829,41 @@ An interactive bezier or spring easing curve editor with a preset dropdown and m
|
|
|
829
829
|
|
|
830
830
|
| Attribute | Type | Default | Description |
|
|
831
831
|
|---|---|---|---|
|
|
832
|
-
| `value` | string | — | Bezier
|
|
832
|
+
| `value` | string | — | Bezier/spring shorthand or a serialized easing object |
|
|
833
833
|
| `mode` | string | — | Optional `"bezier"` or `"spring"` constraint; filters presets and rejects the other value type |
|
|
834
834
|
| `precision` | number | `2` | Decimal places |
|
|
835
835
|
| `aspect-ratio` | string | — | Editor aspect ratio |
|
|
836
836
|
| `edit` | boolean | `true` | Show the editor and custom bezier/spring options; set to `"false"` for preset-only |
|
|
837
|
+
| `presets` | boolean | `true` | Show the preset selector; set to `"false"` to hide it |
|
|
838
|
+
| `text` | boolean | `true` | Show the bezier value or normalized spring bounce input; set to `"false"` to hide it |
|
|
839
|
+
|
|
840
|
+
The `value` property also accepts a structured object. Structured values require a `type` unless the `mode` attribute supplies it. If both are present, they must agree.
|
|
841
|
+
|
|
842
|
+
```js
|
|
843
|
+
curve.value = {
|
|
844
|
+
type: "spring",
|
|
845
|
+
mass: 1,
|
|
846
|
+
stiffness: 200,
|
|
847
|
+
damping: 12,
|
|
848
|
+
initialVelocity: 0,
|
|
849
|
+
};
|
|
850
|
+
|
|
851
|
+
curve.spring; // A cloned { mass, stiffness, damping, initialVelocity } object
|
|
852
|
+
curve.value; // "spring(200, 12, 1)"
|
|
853
|
+
```
|
|
854
|
+
|
|
855
|
+
The same data can be supplied declaratively. With `mode="spring"`, `type` is optional:
|
|
856
|
+
|
|
857
|
+
```html
|
|
858
|
+
<fig-easing-curve
|
|
859
|
+
mode="spring"
|
|
860
|
+
value='{"mass":1,"stiffness":200,"damping":12,"initialVelocity":0}'
|
|
861
|
+
></fig-easing-curve>
|
|
862
|
+
```
|
|
863
|
+
|
|
864
|
+
Bezier objects use `{ type: "bezier", x1, y1, x2, y2 }`. Spring shorthand accepts an optional fourth initial-velocity value: `spring(stiffness, damping, mass, initialVelocity)`.
|
|
865
|
+
|
|
866
|
+
In spring mode, the compact number input edits normalized bounce from `0` (critically damped) to `1` (undamped). Bounce is converted to the equivalent damping value in the structured spring configuration.
|
|
837
867
|
|
|
838
868
|
**Static:** `FigEasingCurve.PRESETS` — built-in preset array. `FigEasingCurve.curveIcon(value)` — SVG icon helper.
|
|
839
869
|
|
|
@@ -841,12 +871,13 @@ An interactive bezier or spring easing curve editor with a preset dropdown and m
|
|
|
841
871
|
|
|
842
872
|
| Event | Detail |
|
|
843
873
|
|---|---|
|
|
844
|
-
| `input` | `{ mode, value, cssValue, preset }` — while dragging |
|
|
845
|
-
| `change` | `{ mode, value, cssValue, preset }` — on release |
|
|
874
|
+
| `input` | `{ mode, value, cssValue, preset, spring? }` — while dragging |
|
|
875
|
+
| `change` | `{ mode, value, cssValue, preset, spring? }` — on release |
|
|
846
876
|
|
|
847
877
|
```html
|
|
848
878
|
<fig-easing-curve value="0.42, 0, 0.58, 1"></fig-easing-curve>
|
|
849
879
|
<fig-easing-curve value="spring(200, 15, 1)" edit="false"></fig-easing-curve>
|
|
880
|
+
<fig-easing-curve value="0.42, 0, 0.58, 1" presets="false" text="false"></fig-easing-curve>
|
|
850
881
|
```
|
|
851
882
|
|
|
852
883
|
Editable bezier and spring handles are keyboard operable. Bezier handles keep tab order aligned with the visual handle order.
|
package/components.css
CHANGED
|
@@ -1924,8 +1924,9 @@ fig-easing-curve {
|
|
|
1924
1924
|
|
|
1925
1925
|
width: 100%;
|
|
1926
1926
|
.fig-easing-curve-svg {
|
|
1927
|
+
display: block;
|
|
1927
1928
|
width: 100%;
|
|
1928
|
-
|
|
1929
|
+
height: 100%;
|
|
1929
1930
|
overflow: visible;
|
|
1930
1931
|
}
|
|
1931
1932
|
.fig-easing-curve-svg-container {
|
|
@@ -1934,9 +1935,6 @@ fig-easing-curve {
|
|
|
1934
1935
|
padding: var(--spacer-4);
|
|
1935
1936
|
aspect-ratio: var(--aspect-ratio);
|
|
1936
1937
|
overflow: hidden;
|
|
1937
|
-
&:is(:hover, :active, :focus, :focus-visible, :focus-within) {
|
|
1938
|
-
overflow: visible;
|
|
1939
|
-
}
|
|
1940
1938
|
}
|
|
1941
1939
|
&.spring-mode {
|
|
1942
1940
|
.fig-easing-curve-svg-container,
|