Skip to content

Commit ecc8317

Browse files
committed
fix: enhance highlight text rendering and documente skills
1 parent 9ce9b07 commit ecc8317

File tree

11 files changed

+186
-150
lines changed

11 files changed

+186
-150
lines changed

.claude/skills/rustmotion/SKILL.md

Lines changed: 65 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ Read individual rule files for detailed explanations, GOOD/BAD examples, and con
5454
- [rules/prefer-presets.md](rules/prefer-presets.md) - Prefer presets over manual keyframes (31 built-in presets)
5555
- [rules/hex-colors.md](rules/hex-colors.md) - Colors in hex format only (#RRGGBB or #RRGGBBAA)
5656
- [rules/easing-guidelines.md](rules/easing-guidelines.md) - Easing guidelines for motion design
57+
- [rules/text-background.md](rules/text-background.md) - text-background renders a colored rectangle behind text
5758

5859
---
5960

@@ -80,7 +81,7 @@ Read individual rule files for detailed explanations, GOOD/BAD examples, and con
8081
"angle": 135
8182
},
8283
"border-radius": 32,
83-
"animation": { "name": "scale_in", "duration": 0.6 }
84+
"animation": [{ "name": "scale_in", "duration": 0.6 }]
8485
}
8586
},
8687
{
@@ -89,7 +90,7 @@ Read individual rule files for detailed explanations, GOOD/BAD examples, and con
8990
"size": { "width": 80, "height": 80 },
9091
"style": {
9192
"color": "#FFFFFF",
92-
"animation": { "name": "fade_in_up", "delay": 0.3, "duration": 0.6 }
93+
"animation": [{ "name": "fade_in_up", "delay": 0.3, "duration": 0.6 }]
9394
}
9495
},
9596
{
@@ -100,7 +101,7 @@ Read individual rule files for detailed explanations, GOOD/BAD examples, and con
100101
"color": "#FFFFFF",
101102
"font-weight": "bold",
102103
"text-align": "center",
103-
"animation": { "name": "fade_in_up", "delay": 0.5, "duration": 0.6 }
104+
"animation": [{ "name": "fade_in_up", "delay": 0.5, "duration": 0.6 }]
104105
}
105106
},
106107
{
@@ -112,7 +113,7 @@ Read individual rule files for detailed explanations, GOOD/BAD examples, and con
112113
"color": "#CBD5E1",
113114
"text-align": "center",
114115
"line-height": 1.5,
115-
"animation": { "name": "fade_in_up", "delay": 0.7, "duration": 0.6 }
116+
"animation": [{ "name": "fade_in_up", "delay": 0.7, "duration": 0.6 }]
116117
}
117118
}
118119
]
@@ -139,7 +140,7 @@ Read individual rule files for detailed explanations, GOOD/BAD examples, and con
139140
"color": "#7AA2F7",
140141
"font-weight": "bold",
141142
"text-align": "center",
142-
"animation": { "name": "fade_in", "duration": 0.5 }
143+
"animation": [{ "name": "fade_in", "duration": 0.5 }]
143144
}
144145
},
145146
{
@@ -169,7 +170,7 @@ Read individual rule files for detailed explanations, GOOD/BAD examples, and con
169170
"font-size": 28,
170171
"color": "#9ECE6A",
171172
"text-align": "center",
172-
"animation": { "name": "fade_in_up", "delay": 0.0, "duration": 0.6 }
173+
"animation": [{ "name": "fade_in_up", "delay": 0.0, "duration": 0.6 }]
173174
}
174175
}
175176
]
@@ -191,12 +192,12 @@ Read individual rule files for detailed explanations, GOOD/BAD examples, and con
191192
{
192193
"type": "text",
193194
"content": "2024 Results",
194-
"style": { "font-size": 72, "color": "#FFFFFF", "font-weight": "bold", "text-align": "center", "animation": { "name": "fade_in_up" } }
195+
"style": { "font-size": 72, "color": "#FFFFFF", "font-weight": "bold", "text-align": "center", "animation": [{ "name": "fade_in_up" }] }
195196
},
196197
{
197198
"type": "text",
198199
"content": "Year in Review",
199-
"style": { "font-size": 36, "color": "#94A3B8", "text-align": "center", "animation": { "name": "fade_in_up", "delay": 0.3, "duration": 0.6 } }
200+
"style": { "font-size": 36, "color": "#94A3B8", "text-align": "center", "animation": [{ "name": "fade_in_up", "delay": 0.3, "duration": 0.6 }] }
200201
}
201202
]
202203
},
@@ -217,7 +218,7 @@ Read individual rule files for detailed explanations, GOOD/BAD examples, and con
217218
{
218219
"type": "text",
219220
"content": "Users Reached",
220-
"style": { "font-size": 36, "color": "#CBD5E1", "text-align": "center", "animation": { "name": "fade_in_up", "delay": 0.5, "duration": 0.6 } }
221+
"style": { "font-size": 36, "color": "#CBD5E1", "text-align": "center", "animation": [{ "name": "fade_in_up", "delay": 0.5, "duration": 0.6 }] }
221222
},
222223
{
223224
"type": "card",
@@ -228,7 +229,7 @@ Read individual rule files for detailed explanations, GOOD/BAD examples, and con
228229
"padding": 24,
229230
"background": "#1E293B",
230231
"border-radius": 20,
231-
"animation": { "name": "fade_in_up", "delay": 0.8, "duration": 0.6 }
232+
"animation": [{ "name": "fade_in_up", "delay": 0.8, "duration": 0.6 }]
232233
},
233234
"children": [
234235
{
@@ -255,13 +256,10 @@ Read individual rule files for detailed explanations, GOOD/BAD examples, and con
255256
"content": "Thank You",
256257
"style": {
257258
"font-size": 80, "color": "#FFFFFF", "font-weight": "bold", "text-align": "center",
258-
"animation": {
259-
"name": "scale_in",
260-
"duration": 0.8,
261-
"wiggle": [
262-
{ "property": "translate_y", "amplitude": 4, "frequency": 1.5, "seed": 7 }
263-
]
264-
}
259+
"animation": [
260+
{ "name": "scale_in", "duration": 0.8 },
261+
{ "name": "wiggle", "property": "translate_y", "amplitude": 4, "frequency": 1.5, "seed": 7 }
262+
]
265263
}
266264
},
267265
{
@@ -270,13 +268,10 @@ Read individual rule files for detailed explanations, GOOD/BAD examples, and con
270268
"size": { "width": 64, "height": 64 },
271269
"style": {
272270
"color": "#F43F5E",
273-
"animation": {
274-
"name": "fade_in",
275-
"delay": 0.5,
276-
"wiggle": [
277-
{ "property": "scale", "amplitude": 0.1, "frequency": 2, "seed": 42 }
278-
]
279-
}
271+
"animation": [
272+
{ "name": "fade_in", "delay": 0.5 },
273+
{ "name": "wiggle", "property": "scale", "amplitude": 0.1, "frequency": 2, "seed": 42 }
274+
]
280275
}
281276
}
282277
]
@@ -390,52 +385,43 @@ All components are discriminated by `"type"`. Rendered in array order (first = b
390385
| `opacity` | f32 | `1.0` | 0.0 to 1.0 |
391386
| `padding` | f32 or {top,right,bottom,left} | `null` | Inner spacing |
392387
| `margin` | f32 or {top,right,bottom,left} | `null` | Outer spacing |
393-
| `glow` | object | `null` | Luminous halo effect |
394-
| `animation` | object | `null` | Animation config (see Animation section) |
388+
| `animation` | array or object | `[]` | Animation effects array (see below) |
395389

396390
#### Animation Style (inside `"style"`)
397391

398-
All animation configuration lives under `style.animation`:
392+
`style.animation` is a **typed array** of animation effects, each discriminated by `"name"`. A single effect (without array) is also accepted.
399393

400394
```json
401395
{
402396
"style": {
403-
"animation": {
404-
"name": "fade_in_up",
405-
"delay": 0.2,
406-
"duration": 0.8,
407-
"loop": false,
408-
"keyframes": [],
409-
"wiggle": [],
410-
"motion_blur": null
411-
}
397+
"animation": [
398+
{ "name": "fade_in_up", "delay": 0.2, "duration": 0.8 },
399+
{ "name": "glow", "color": "#6366F1", "radius": 20, "intensity": 2.0 },
400+
{ "name": "wiggle", "property": "translate_y", "amplitude": 5, "frequency": 0.8, "seed": 42 }
401+
]
412402
}
413403
}
414404
```
415405

406+
**Effect types:**
407+
408+
| Effect name | Fields | Description |
409+
| --- | --- | --- |
410+
| *preset name* | `delay`, `duration`, `loop` | Any of the 31 presets (e.g. `fade_in_up`, `scale_in`) |
411+
| `glow` | `color`, `radius`, `intensity` | Luminous halo effect |
412+
| `wiggle` | `property`, `amplitude`, `frequency`, `mode`, `seed`, ... | Procedural noise animation |
413+
| `keyframes` | `keyframes`, `delay`, `duration` | Custom keyframe animations |
414+
| `motion_blur` | `intensity` | Motion blur effect |
415+
416+
**Preset fields:**
417+
416418
| Field | Type | Default | Description |
417419
| --- | --- | --- | --- |
418-
| `name` | string | `null` | Animation preset name (e.g. `"fade_in_up"`) |
419420
| `delay` | f64 | `0` | Delay before animation starts (seconds) |
420421
| `duration` | f64 | `0.8` | Animation duration (seconds) |
421422
| `loop` | bool | `false` | Loop the animation continuously |
422-
| `keyframes` | array | `[]` | Custom keyframe animations |
423-
| `wiggle` | array | `null` | Procedural noise-based animation |
424-
| `motion_blur` | f32 | `null` | Motion blur intensity |
425423

426-
#### Glow Effect
427-
428-
```json
429-
{
430-
"style": {
431-
"glow": {
432-
"color": "#5C39EE",
433-
"radius": 20,
434-
"intensity": 2.0
435-
}
436-
}
437-
}
438-
```
424+
**Glow fields:**
439425

440426
| Field | Type | Default | Description |
441427
| --- | --- | --- | --- |
@@ -819,18 +805,21 @@ Code block with syntax highlighting, chrome, reveal animations, and animated dif
819805
```json
820806
{
821807
"style": {
822-
"animation": {
823-
"keyframes": [
824-
{
825-
"property": "opacity",
826-
"keyframes": [
827-
{ "time": 0.0, "value": 0.0 },
828-
{ "time": 0.5, "value": 1.0 }
829-
],
830-
"easing": "ease_out"
831-
}
832-
]
833-
}
808+
"animation": [
809+
{
810+
"name": "keyframes",
811+
"keyframes": [
812+
{
813+
"property": "opacity",
814+
"keyframes": [
815+
{ "time": 0.0, "value": 0.0 },
816+
{ "time": 0.5, "value": 1.0 }
817+
],
818+
"easing": "ease_out"
819+
}
820+
]
821+
}
822+
]
834823
}
835824
}
836825
```
@@ -854,7 +843,7 @@ See Rule 13 for usage guidance.
854843
```json
855844
{
856845
"style": {
857-
"animation": { "name": "fade_in_up", "delay": 0.2, "duration": 0.8, "loop": false }
846+
"animation": [{ "name": "fade_in_up", "delay": 0.2, "duration": 0.8, "loop": false }]
858847
}
859848
}
860849
```
@@ -870,28 +859,27 @@ See Rule 13 for usage guidance.
870859

871860
#### Wiggle (Procedural Noise)
872861

873-
See Rule 12 for combining with presets.
862+
See Rule 12 for combining with presets. Wiggle is an animation effect with `"name": "wiggle"` in the `style.animation` array.
874863

875864
```json
876865
{
877866
"style": {
878-
"animation": {
879-
"wiggle": [
880-
{ "property": "translate_x", "amplitude": 5, "frequency": 3, "seed": 42 },
881-
{ "property": "rotation", "amplitude": 8, "frequency": 4, "seed": 13, "decay": 0.6 }
882-
]
883-
}
867+
"animation": [
868+
{ "name": "wiggle", "property": "translate_x", "amplitude": 5, "frequency": 3, "seed": 42 },
869+
{ "name": "wiggle", "property": "rotation", "amplitude": 8, "frequency": 4, "seed": 13, "decay": 0.6 }
870+
]
884871
}
885872
}
886873
```
887874

888875
| Field | Type | Default | Description |
889876
| --- | --- | --- | --- |
890877
| `property` | string | required | Property to wiggle (same as animatable properties) |
891-
| `amplitude` | f64 | required | Maximum deviation |
892-
| `frequency` | f64 | required | Oscillations per second |
893-
| `seed` | u64 | `0` | Random seed for reproducible results |
894-
| `octaves` | u32 | `3` | Noise complexity |
878+
| `amplitude` | f64 | required | Maximum deviation (pixels for translate, degrees for rotation) |
879+
| `frequency` | f64 | required | Cycles per second (Hz). 0.8 = gentle float, 3 = wobble, 90 = vibration |
880+
| `mode` | string | `"noise"` | `"noise"` (layered simplex) or `"sine"` (pure sine wave) |
881+
| `seed` | u64 | `0` | Random seed for reproducible results (noise mode only) |
882+
| `octaves` | u32 | `3` | Noise complexity (noise mode only) |
895883
| `phase` | f64 | `0.0` | Phase offset |
896884
| `decay` | f64 | `null` | Exponential decay rate |
897885
| `easing` | string | `null` | Remap noise through an easing curve |
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
# Rule: Continuous Presets Need loop: true
22

3-
The presets `pulse`, `float`, `shake`, and `spin` are continuous animations. Without `"loop": true` in `preset_config`, they play once and stop.
3+
The presets `pulse`, `float`, `shake`, and `spin` are continuous animations. Without `"loop": true`, they play once and stop.
44

55
**GOOD:**
66
```json
7-
{ "preset": "float", "preset_config": { "loop": true } }
7+
{ "style": { "animation": [{ "name": "float", "loop": true }] } }
88
```
99

1010
**BAD:**
1111
```json
12-
{ "preset": "float" }
12+
{ "style": { "animation": [{ "name": "float" }] } }
1313
```
1414

1515
Continuous presets: `pulse`, `float`, `shake`, `spin`.

.claude/skills/rustmotion/rules/prefer-presets.md

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,27 @@
11
# Rule: Prefer Presets Over Manual Keyframes
22

3-
Presets are simpler, less error-prone, and produce consistent motion design. Only use manual `animations` keyframes for custom behavior not covered by the 31 built-in presets.
3+
Presets are simpler, less error-prone, and produce consistent motion design. Only use `keyframes` animation effects for custom behavior not covered by the 31 built-in presets.
44

55
**GOOD:**
66
```json
7-
{ "preset": "fade_in_up", "preset_config": { "delay": 0.3, "duration": 0.8 } }
7+
{ "style": { "animation": [{ "name": "fade_in_up", "delay": 0.3, "duration": 0.8 }] } }
88
```
99

1010
**BAD** (over-engineering a simple fade-in):
1111
```json
1212
{
13-
"animations": [
14-
{ "property": "opacity", "keyframes": [{ "time": 0.3, "value": 0.0 }, { "time": 1.1, "value": 1.0 }], "easing": "ease_out" },
15-
{ "property": "translate_y", "keyframes": [{ "time": 0.3, "value": 30.0 }, { "time": 1.1, "value": 0.0 }], "easing": "ease_out" }
16-
]
13+
"style": {
14+
"animation": [{
15+
"name": "keyframes",
16+
"keyframes": [
17+
{ "property": "opacity", "keyframes": [{ "time": 0.3, "value": 0.0 }, { "time": 1.1, "value": 1.0 }], "easing": "ease_out" },
18+
{ "property": "translate_y", "keyframes": [{ "time": 0.3, "value": 30.0 }, { "time": 1.1, "value": 0.0 }], "easing": "ease_out" }
19+
]
20+
}]
21+
}
1722
}
1823
```
1924

20-
Note: explicit `animations` override preset animations on the same property.
21-
2225
## 31 Available Presets
2326

2427
| Category | Presets |

.claude/skills/rustmotion/rules/stagger-animations.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ To create sequential entrance effects (items appearing one by one), use `style.a
55
**GOOD:**
66
```json
77
[
8-
{ "type": "text", "content": "First", "style": { "font-size": 48, "color": "#FFFFFF", "animation": { "name": "fade_in_up", "delay": 0.0, "duration": 0.6 } } },
9-
{ "type": "text", "content": "Second", "style": { "font-size": 48, "color": "#FFFFFF", "animation": { "name": "fade_in_up", "delay": 0.2, "duration": 0.6 } } },
10-
{ "type": "text", "content": "Third", "style": { "font-size": 48, "color": "#FFFFFF", "animation": { "name": "fade_in_up", "delay": 0.4, "duration": 0.6 } } }
8+
{ "type": "text", "content": "First", "style": { "font-size": 48, "color": "#FFFFFF", "animation": [{ "name": "fade_in_up", "delay": 0.0, "duration": 0.6 }] } },
9+
{ "type": "text", "content": "Second", "style": { "font-size": 48, "color": "#FFFFFF", "animation": [{ "name": "fade_in_up", "delay": 0.2, "duration": 0.6 }] } },
10+
{ "type": "text", "content": "Third", "style": { "font-size": 48, "color": "#FFFFFF", "animation": [{ "name": "fade_in_up", "delay": 0.4, "duration": 0.6 }] } }
1111
]
1212
```
1313

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Rule: text-background Renders Behind Text
2+
3+
`text-background` adds a colored rectangle behind text content. The background is positioned to tightly wrap the text glyphs with configurable padding and corner radius.
4+
5+
**GOOD:**
6+
```json
7+
{
8+
"type": "text",
9+
"content": " Highlighted text ",
10+
"style": {
11+
"font-size": 36,
12+
"color": "#FFFFFF",
13+
"text-align": "center",
14+
"text-background": {
15+
"color": "#6366F1",
16+
"padding": 12,
17+
"corner_radius": 8
18+
}
19+
}
20+
}
21+
```
22+
23+
## Fields
24+
25+
| Field | Type | Default | Description |
26+
| --- | --- | --- | --- |
27+
| `color` | string | required | Background color (hex) |
28+
| `padding` | f32 | `4` | Padding around text |
29+
| `corner_radius` | f32 | `4` | Rounded corners radius (0 = square) |
30+
31+
## Tips
32+
33+
- Add spaces around `content` (e.g. `" text "`) for visual breathing room beyond padding
34+
- Works with multi-line text: each line gets its own background rectangle
35+
- Combines with other text styles (`text-shadow`, `stroke`, etc.)

0 commit comments

Comments
 (0)