arkaos 5.5.0 → 5.7.0

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.
Files changed (65) hide show
  1. package/README.md +2 -2
  2. package/THE-ARKAOS-GUIDE.md +1 -1
  3. package/VERSION +1 -1
  4. package/arka/SKILL.md +1 -1
  5. package/config/skills-provenance.yaml +17 -0
  6. package/departments/brand/skills/design-system/SKILL.md +4 -2
  7. package/departments/brand/skills/motion-design/SKILL.md +362 -0
  8. package/departments/brand/skills/motion-design/references/director/choreography.md +93 -0
  9. package/departments/brand/skills/motion-design/references/director/context-adaptation.md +83 -0
  10. package/departments/brand/skills/motion-design/references/director/core-philosophy.md +53 -0
  11. package/departments/brand/skills/motion-design/references/director/decision-framework.md +91 -0
  12. package/departments/brand/skills/motion-design/references/director/disney-principles.md +102 -0
  13. package/departments/brand/skills/motion-design/references/director/emotion-mapping.md +71 -0
  14. package/departments/brand/skills/motion-design/references/director/motion-personality.md +89 -0
  15. package/departments/brand/skills/motion-design/references/director/narrative-structure.md +62 -0
  16. package/departments/brand/skills/motion-design/references/motion-design-skill.LICENSE +21 -0
  17. package/departments/brand/skills/motion-design/references/patterns/ambient-continuous.md +81 -0
  18. package/departments/brand/skills/motion-design/references/patterns/entrance-exit.md +82 -0
  19. package/departments/brand/skills/motion-design/references/patterns/multi-element.md +69 -0
  20. package/departments/brand/skills/motion-design/references/patterns/state-feedback.md +96 -0
  21. package/departments/brand/skills/motion-design/references/reference/property-selection.md +95 -0
  22. package/departments/brand/skills/motion-design/references/reference/quality-checklist.md +67 -0
  23. package/departments/brand/skills/motion-design/references/reference/timing-easing-tables.md +106 -0
  24. package/departments/brand/skills/motion-design/references/reference/troubleshooting.md +73 -0
  25. package/departments/dev/skills/canvas-generative/SKILL.md +3 -3
  26. package/departments/dev/skills/threejs/SKILL.md +173 -0
  27. package/departments/dev/skills/threejs/references/genjutsu.LICENSE +21 -0
  28. package/departments/dev/skills/threejs/references/r3f.md +249 -0
  29. package/departments/dev/skills/threejs/references/scene-setup.md +404 -0
  30. package/departments/dev/skills/threejs/references/shaders.md +452 -0
  31. package/harness/codex/AGENTS.md +1 -1
  32. package/harness/copilot/copilot-instructions.md +1 -1
  33. package/harness/cursor/rules/arkaos.mdc +2 -2
  34. package/harness/gemini/GEMINI.md +1 -1
  35. package/harness/opencode/AGENTS.md +1 -1
  36. package/harness/opencode/agents/arka-architect-gabriel.md +1 -1
  37. package/harness/opencode/agents/arka-brand-director-valentina.md +1 -1
  38. package/harness/opencode/agents/arka-cfo-helena.md +1 -1
  39. package/harness/opencode/agents/arka-chief-of-staff-afonso.md +1 -1
  40. package/harness/opencode/agents/arka-community-strategist-beatriz.md +1 -1
  41. package/harness/opencode/agents/arka-content-strategist-rafael.md +1 -1
  42. package/harness/opencode/agents/arka-conversion-strategist-ines.md +1 -1
  43. package/harness/opencode/agents/arka-coo-sofia.md +1 -1
  44. package/harness/opencode/agents/arka-copy-director-eduardo.md +1 -1
  45. package/harness/opencode/agents/arka-cqo-marta.md +1 -1
  46. package/harness/opencode/agents/arka-cto-marco.md +1 -1
  47. package/harness/opencode/agents/arka-design-ops-lead-iris.md +1 -1
  48. package/harness/opencode/agents/arka-ecom-director-ricardo.md +1 -1
  49. package/harness/opencode/agents/arka-knowledge-director-clara.md +1 -1
  50. package/harness/opencode/agents/arka-leadership-director-rodrigo.md +1 -1
  51. package/harness/opencode/agents/arka-marketing-director-luna.md +1 -1
  52. package/harness/opencode/agents/arka-ops-lead-daniel.md +1 -1
  53. package/harness/opencode/agents/arka-pm-director-carolina.md +1 -1
  54. package/harness/opencode/agents/arka-revops-lead-vicente.md +1 -1
  55. package/harness/opencode/agents/arka-saas-strategist-tiago.md +1 -1
  56. package/harness/opencode/agents/arka-sales-director-miguel.md +1 -1
  57. package/harness/opencode/agents/arka-strategy-director-tomas.md +1 -1
  58. package/harness/opencode/agents/arka-tech-director-francisca.md +1 -1
  59. package/harness/opencode/agents/arka-tech-lead-paulo.md +1 -1
  60. package/harness/opencode/agents/arka-video-producer-simao.md +1 -1
  61. package/harness/zed/.rules +1 -1
  62. package/knowledge/commands-registry.json +1 -1
  63. package/knowledge/skills-manifest.json +31 -1
  64. package/package.json +1 -1
  65. package/pyproject.toml +1 -1
@@ -0,0 +1,96 @@
1
+ # State & Feedback Patterns
2
+
3
+ ## Button Press
4
+
5
+ ### Playful
6
+ - Press: scale 0.95 (60ms, ease-out); Release: overshoot 1.05 (80ms); Settle: 1.0 (120ms, spring)
7
+ - Secondary: shadow shrinks/grows; color darkens/brightens. Total ~260ms
8
+
9
+ ### Premium
10
+ - Press: scale 0.98 (80ms); Release: 1.0 (150ms, no overshoot)
11
+ - Opacity dims to 90% on press. Total ~230ms
12
+
13
+ ### Corporate
14
+ - Press: scale 0.97 (60ms); Release: 1.0 (100ms); overshoot 0-2%
15
+ - Background darkens 10%. Total ~160ms
16
+
17
+ ## Hover States
18
+
19
+ | Element | Effect | Duration |
20
+ |---------|--------|----------|
21
+ | Button | Scale 1.02-1.05 | <100ms |
22
+ | Card | Scale 1.01-1.02 + shadow lift | <100ms |
23
+ | Link | Color change + underline | <100ms |
24
+ | Icon | Scale 1.1 + rotation 2-5° | <100ms |
25
+ | Image | Scale 1.03 (overflow hidden) | 150ms |
26
+
27
+ Hover enter <100ms; hover exit 150-200ms (slower = polished).
28
+
29
+ ## Toggle / Switch
30
+ - Thumb slides (120-180ms, ease-in-out); track color transitions simultaneously
31
+ - Slight squash in movement direction
32
+ - Playful: bounce at destination; Premium: smooth, no overshoot
33
+
34
+ ## Success State
35
+
36
+ ### Checkmark Success
37
+ 1. Container: scale 0.9→1.0 (200ms, ease-out-back, 5-10% overshoot)
38
+ 2. Checkmark: stroke draw (150ms, ease-out, 100ms delay)
39
+ 3. Color: to green (200ms); ambient glow/particles (300ms)
40
+ 4. Total: 400-500ms
41
+
42
+ ### Confirmation Badge
43
+ 1. Badge scales from 0 (200ms, ease-out-back)
44
+ 2. Text fades in (150ms, 50ms delay)
45
+ 3. Background pulse (300ms, sine)
46
+
47
+ ### Payment Success
48
+ 1. Spinner → checkmark crossfade (200ms)
49
+ 2. Checkmark draws (200ms); container → success color (200ms)
50
+ 3. Text fades in (200ms, 100ms delay); optional confetti (300-500ms)
51
+
52
+ ## Error State
53
+
54
+ ### Error Shake
55
+ - Horizontal oscillation ±10-15px, 2-3 cycles decreasing amplitude
56
+ - ease-in-out, 300-400ms total; red tint; no overshoot; settles at origin
57
+
58
+ ### Inline Validation
59
+ 1. Error text slides down + fades in (200ms)
60
+ 2. Border → red (150ms); icon scales in (150ms, 50ms delay)
61
+ 3. Optional single shake (200ms)
62
+
63
+ ### Form Submission Error
64
+ 1. Button returns to normal (200ms)
65
+ 2. Error message slides in (250ms)
66
+ 3. Affected fields highlight red (150ms, staggered 30ms)
67
+ 4. Smooth scroll to first error (300ms, ease-in-out)
68
+
69
+ ## Loading States
70
+
71
+ ### Spinner
72
+ - Continuous 360°, linear, 1000-1500ms/rev; optional breathing pulse (2-3s)
73
+
74
+ ### Skeleton
75
+ - Gradient sweep L→R, 1500-2000ms; base 10-20% opacity, peak 30-40%
76
+
77
+ ### Progress Bar
78
+ - Width/transform, ease-in-out; optional color milestones + shimmer
79
+
80
+ ### Indeterminate
81
+ - Oscillating position/width, 1500-2500ms, ease-in-out; continuous, never frantic
82
+
83
+ ## Warning State
84
+ 1. Yellow/amber border (150ms)
85
+ 2. Warning icon scales in (150ms, subtle overshoot)
86
+ 3. Optional icon pulse (2-3s, sine); text fades in (200ms, 50ms delay)
87
+
88
+ ## Disabled / Enabled
89
+
90
+ - **Disabling**: opacity to 50-60% (200ms); optional scale to 98%
91
+ - **Enabling**: opacity to 100% (200ms); optional scale pulse 98%→100%
92
+
93
+ ## Focus States
94
+ - Focus ring: scale 95%→100% + opacity (150ms)
95
+ - Card focus: scale 1.01, shadow increase (150ms)
96
+ - Tab nav focus: <100ms; must work with reduced-motion
@@ -0,0 +1,95 @@
1
+ # Property Selection
2
+
3
+ ## Position
4
+
5
+ | Direction | Meaning |
6
+ |-----------|---------|
7
+ | Upward | Growth, improvement, aspiration |
8
+ | Downward | Settling, completion, grounding |
9
+ | Leftward | Regression, backward, departure |
10
+ | Rightward | Progression, forward, arrival |
11
+ | Toward center | Focus, convergence |
12
+ | Away from center | Distribution, expansion |
13
+
14
+ ## Scale
15
+
16
+ | Direction | Meaning |
17
+ |-----------|---------|
18
+ | Scale up | Importance, activation, proximity |
19
+ | Scale down | Deprioritization, distance |
20
+ | Pulse | Attention, heartbeat, life |
21
+ | Breathing | Presence, waiting |
22
+
23
+ ## Rotation
24
+
25
+ | Range | Meaning |
26
+ |-------|---------|
27
+ | Small (5-15°) | Subtle adjustment |
28
+ | Medium (45-90°) | Transformation |
29
+ | Full (360°) | Completion, processing |
30
+ | Continuous | Ongoing activity |
31
+
32
+ ## Opacity
33
+
34
+ | Direction | Meaning |
35
+ |-----------|---------|
36
+ | Fade in | Arrival, enablement |
37
+ | Fade out | Departure, disablement |
38
+ | Partial | Secondary, disabled state |
39
+
40
+ **Rule**: NEVER opacity alone for important state changes. Combine with position or scale.
41
+
42
+ ## Color
43
+
44
+ | Transition | Meaning |
45
+ |-----------|---------|
46
+ | To green | Success, go |
47
+ | To red | Error, stop |
48
+ | To blue | Trust, active |
49
+ | To gray | Disabled, inactive |
50
+ | Brightening | Activation, focus |
51
+ | Dimming | Deactivation, background |
52
+
53
+ ## Combined Properties
54
+
55
+ | Combination | Best For |
56
+ |-------------|----------|
57
+ | Position + Opacity | Content appearing/disappearing |
58
+ | Scale + Opacity | Cards, modals, notifications |
59
+ | Position + Scale | Selected items, focused content |
60
+ | Rotation + Scale | Celebrations, playful activation |
61
+ | Position + Rotation | Organic transitions |
62
+ | Color + Scale | State emphasis |
63
+
64
+ Primary property carries meaning; secondary adds polish. Two properties is the sweet spot.
65
+
66
+ ## Property Selection by Goal
67
+
68
+ | Goal | Primary | Secondary | Avoid |
69
+ |------|---------|-----------|-------|
70
+ | Entrance | position | opacity | rotation |
71
+ | Exit | position | opacity | scale up |
72
+ | Button press | scale | color | position |
73
+ | Hover | scale or color | opacity | position |
74
+ | Success | scale | color + opacity | position |
75
+ | Error | position (shake) | color | scale |
76
+ | Loading | rotation | opacity | position |
77
+ | Toggle | position | color | rotation |
78
+ | Notification | position + scale | opacity | rotation |
79
+ | Delete | scale + opacity | position | grow |
80
+ | Selection | scale | color, opacity | rotation |
81
+ | Progress | position or scale | color | opacity |
82
+
83
+ ## Performance
84
+
85
+ | Property | Performance |
86
+ |----------|-------------|
87
+ | transform (translate, scale, rotate) | Excellent — GPU-accelerated |
88
+ | opacity | Excellent — GPU-accelerated |
89
+ | color / background-color | Good — triggers paint |
90
+ | clip-path | Good — GPU on modern browsers |
91
+ | width / height | Poor — triggers layout |
92
+ | margin / padding | Poor — triggers layout |
93
+ | box-shadow | Poor — expensive paint |
94
+
95
+ **Rule**: Prefer transform + opacity for all motion.
@@ -0,0 +1,67 @@
1
+ # Quality Checklist
2
+
3
+ ## Visual Quality
4
+ - [ ] Elements >40px for motion, >100px for detail
5
+ - [ ] Readable at full speed without slow-motion
6
+ - [ ] Clear primary, secondary, ambient layers
7
+ - [ ] Counter-motion for balance where needed
8
+ - [ ] Natural arcs (unless intentionally mechanical)
9
+ - [ ] 1/3 rule (distance): no unbroken motion >1/3 container
10
+ - [ ] 1/3 rule (density): max 1/3 elements active simultaneously
11
+
12
+ ## Technical Quality
13
+ - [ ] No linear easing on spatial movement
14
+ - [ ] Duration matches element type table
15
+ - [ ] Ease-out entrances, ease-in exits
16
+ - [ ] Duration proportional to distance
17
+ - [ ] Entrance duration >= exit duration
18
+ - [ ] Not opacity-only for important state changes
19
+ - [ ] Stagger total <500ms
20
+ - [ ] Follow-through: child elements offset 50-150ms
21
+
22
+ ## Emotional Quality
23
+ - [ ] Target emotion identified before properties
24
+ - [ ] Personality archetype matches brand
25
+ - [ ] Setup → action → resolution structure
26
+ - [ ] Intensity matches interaction importance
27
+ - [ ] Consistent: same interaction = same motion
28
+ - [ ] Appropriate on 100th viewing
29
+
30
+ ## Performance Quality
31
+ - [ ] Primary motion uses transform + opacity
32
+ - [ ] <20 animated elements per viewport
33
+ - [ ] No layout-triggering properties animated
34
+ - [ ] Elements staggered, not simultaneous
35
+ - [ ] Maintains 60fps (30fps acceptable for ambient)
36
+
37
+ ## Accessibility Quality
38
+ - [ ] prefers-reduced-motion alternative provided
39
+ - [ ] No vestibular triggers without alternative
40
+ - [ ] Same interaction = same animation
41
+ - [ ] Critical info not motion-only
42
+ - [ ] Animations >5s are pausable
43
+
44
+ ## Severity Tiers
45
+
46
+ ### CRITICAL
47
+ - Linear easing on spatial movement
48
+ - Opacity-only for important states
49
+ - Exceeds 1/3 screen rule
50
+ - Missing primary layer
51
+ - Stagger >500ms
52
+ - Layout property animation causing jank
53
+
54
+ ### HIGH
55
+ - Missing secondary layer
56
+ - Duration mismatch with element type
57
+ - Wrong directional easing
58
+ - Inconsistent personality
59
+ - No follow-through
60
+ - Missing reduced-motion alternative
61
+
62
+ ### MEDIUM
63
+ - Missing ambient layer
64
+ - No anticipation phase
65
+ - Overshoot mismatch
66
+ - Could use better arcs
67
+ - Missing counter-motion
@@ -0,0 +1,106 @@
1
+ # Timing & Easing Tables
2
+
3
+ ## Duration by Element Type
4
+
5
+ | Element | Duration |
6
+ |---------|----------|
7
+ | Tooltip / micro-feedback | 80-120ms |
8
+ | Button / toggle | 120-180ms |
9
+ | Icon transition | 150-250ms |
10
+ | Card enter/exit | 200-350ms |
11
+ | Modal / dialog | 300-400ms |
12
+ | Page transition | 400-600ms |
13
+ | Dramatic reveal | 600-1200ms |
14
+ | Ambient | 2000-20000ms |
15
+
16
+ ## Distance-Duration Scaling
17
+
18
+ 50px=0.8x | 100px=1.0x | 200px=1.3x | 300px=1.5x | 400px=1.6x | Full screen=1.8-2.0x
19
+
20
+ ## Enter vs. Exit
21
+ Entrance = base (100%). Exit = 65-75% of entrance.
22
+
23
+ ## Interactive Feedback
24
+
25
+ | Interaction | Max Latency |
26
+ |------------|-------------|
27
+ | Hover | <100ms |
28
+ | Press/tap | <150ms |
29
+ | Release/settle | 200-300ms |
30
+ | Error shake | 300-400ms |
31
+ | Long press | 500-800ms |
32
+ | Drag start | <50ms |
33
+
34
+ ## Duration by Personality
35
+
36
+ | Personality | Quick | Standard | Slow |
37
+ |------------|-------|----------|------|
38
+ | Playful | 150ms | 250ms | 400ms |
39
+ | Premium | 350ms | 500ms | 800ms |
40
+ | Corporate | 200ms | 300ms | 450ms |
41
+ | Energetic | 100ms | 180ms | 300ms |
42
+
43
+ ## Easing: Directional Rules
44
+
45
+ Entrance=ease-out | Exit=ease-in | On-screen=ease-in-out | Looping=sine | Rotation/progress=linear
46
+
47
+ ## Easing: Industry Standards
48
+
49
+ | Name | Cubic Bezier | Use |
50
+ |------|-------------|-----|
51
+ | MD3 Standard | (0.2, 0, 0, 1) | Default on-screen |
52
+ | MD3 Emphasized | (0.05, 0.7, 0.1, 1) | Entrances |
53
+ | MD3 Accelerate | (0.3, 0, 1, 1) | Exits |
54
+ | MD3 Decelerate | (0, 0, 0, 1) | Entering |
55
+ | Apple HIG | (0.25, 0.1, 0.25, 1) | iOS default |
56
+ | Apple Spring | stiffness:300 damping:20 | Interactive |
57
+ | Snappy UI | (0.2, 0, 0, 1) | Fast, decisive |
58
+ | Gentle float | (0.4, 0, 0.2, 1) | Ambient |
59
+ | Bounce settle | (0.175, 0.885, 0.32, 1.275) | Playful |
60
+ | Elastic snap | (0.68, -0.55, 0.265, 1.55) | Dramatic |
61
+
62
+ ## Material-Based Easing
63
+
64
+ | Material | Duration Scale | Overshoot |
65
+ |----------|---------------|-----------|
66
+ | Rigid (metal) | 1.2x | 0% |
67
+ | Elastic (rubber) | 0.8x | 15-25% |
68
+ | Fluid (water) | 1.5x | 5% |
69
+ | Paper (cards) | 1.0x | 3-5% |
70
+ | Gas (smoke) | 2.0x | 0% |
71
+ | Glass | 0.9x | 0% |
72
+
73
+ ## Spring Parameters
74
+
75
+ | Feel | Stiffness | Damping |
76
+ |------|-----------|---------|
77
+ | Very stiff | 400+ | 25-30 |
78
+ | Standard | 250-350 | 18-24 |
79
+ | Bouncy | 150-250 | 10-15 |
80
+ | Very bouncy | 100-200 | 5-10 |
81
+ | Gentle | 100-150 | 20-25 |
82
+
83
+ Damping: <1.0=oscillates, 1.0=fastest no-oscillation, >1.0=slow settle.
84
+
85
+ ## Stagger Patterns
86
+
87
+ | Pattern | Delay | Budget |
88
+ |---------|------|--------|
89
+ | Micro cascade | 20-40ms | <200ms |
90
+ | Standard | 50-100ms | <400ms |
91
+ | Dramatic | 100-200ms | <600ms |
92
+ | Wave | 30-60ms | <500ms |
93
+
94
+ Direction: top-to-bottom (lists) | L-to-R (horizontal) | center-out (hero) | random (organic) | reverse (exits)
95
+
96
+ Total stagger MUST stay <500ms.
97
+
98
+ ## Overshoot Budget
99
+
100
+ | Context | Overshoot |
101
+ |---------|-----------|
102
+ | Success | 5-10% |
103
+ | Error | 0% |
104
+ | Feedback | 2-5% |
105
+ | Celebration | 15-25% |
106
+ | Premium | 0% |
@@ -0,0 +1,73 @@
1
+ # Troubleshooting
2
+
3
+ ## Looks Robotic
4
+ - Linear easing → use ease-out (entrance) or ease-in-out
5
+ - Straight paths → add 10-20px arc at midpoint
6
+ - Uniform timing → stagger 50-100ms between elements
7
+ - Everything synced → offset start/stop 50-150ms
8
+ - No secondary → add shadow, icon reaction, ambient
9
+
10
+ ## Feels Too Slow
11
+ - Duration exceeds type budget → check duration table
12
+ - ease-in-out when ease-out works → ease-out feels faster
13
+ - Too much anticipation → reduce to 10% or remove
14
+ - Stagger exceeded → total <500ms
15
+ - Overshoot settle too long → increase damping
16
+
17
+ ## Feels Too Fast / Jarring
18
+ - Duration below minimum → modals 300ms+, pages 400ms+
19
+ - No easing → add ease-out minimum
20
+ - Missing resolution → add 50-100ms settle
21
+ - No anticipation on large motion → add 100-200ms wind-up
22
+
23
+ ## Feels Cheap / Flat
24
+ - Only primary motion → add secondary + ambient
25
+ - Opacity-only → combine with position or scale
26
+ - Same easing everywhere → vary primary vs secondary
27
+ - No follow-through → child elements trail 50-150ms
28
+ - No overshoot → add 3-10%
29
+
30
+ ## Too Distracting
31
+ - Too many moving → 1/3 rule
32
+ - Amplitude too large → reduce to minimum
33
+ - Competing heroes → one per moment, dim rest
34
+ - Ambient too prominent → 10-20% amplitude, slower
35
+ - No breathing room → 100-200ms pause between beats
36
+
37
+ ## No Personality
38
+ - Default easing → apply archetype's signature
39
+ - Same duration for all → use personality palette
40
+ - No consistent entrance → define one for project
41
+ - Mixed archetypes → pick one for 90%+
42
+
43
+ ## Inconsistent Feel
44
+ - Different easing same-type → standardize per motion type
45
+ - Duration varies same type → use palette consistently
46
+ - Entry direction changes → one origin everywhere
47
+ - Overshoot inconsistent → apply rules consistently
48
+
49
+ ## Performance (Dropped Frames)
50
+ - Animating width/height/margin → use transform
51
+ - Too many elements → <20 per viewport
52
+ - Complex shadows/filters → simplify or pre-render
53
+ - No GPU acceleration → transform + opacity
54
+ - All simultaneous → stagger to spread load
55
+
56
+ ## Quick Diagnostic
57
+
58
+ 1. No linear on spatial movement
59
+ 2. Duration matches element type
60
+ 3. Primary + secondary layers
61
+ 4. Consistent personality
62
+ 5. Directional easing correct
63
+ 6. 1/3 screen rule
64
+ 7. 1/3 element rule
65
+ 8. Follow-through present
66
+ 9. Every motion has purpose
67
+ 10. Fine on 100th viewing
68
+
69
+ ## Personality Mistakes
70
+ - **Playful**: overshoot >25% = broken; not everything bounces; short+bounce = glitchy
71
+ - **Premium**: too subtle = invisible; too slow = waiting; zero = broken
72
+ - **Corporate**: too conservative = boring; playful easing breaks trust; identical = monotonous
73
+ - **Energetic**: max everywhere = nothing stands out; too many particles; no settle = chaos
@@ -8,8 +8,8 @@ description: >
8
8
  TRIGGER: "generative art", "arte generativa", "particles background",
9
9
  "fundo de partículas", "noise field", "flow field", "canvas animation",
10
10
  "fundo processual", "creative coding em canvas", "/dev canvas-generative".
11
- SKIP: real-time 3D or shader work -> no dedicated skill yet, use the
12
- frontend workflows; a pre-rendered 3D world scrubbed by scroll ->
11
+ SKIP: real-time 3D or shader work -> dev/threejs; a pre-rendered 3D
12
+ world scrubbed by scroll ->
13
13
  dev/scroll-world; turning an existing video into a scroll site ->
14
14
  dev/animated-website; charts and data graphics -> the dataviz skill.
15
15
  allowed-tools: [Read, Write, Edit, Bash, Grep, Glob]
@@ -352,7 +352,7 @@ function update() {
352
352
  |---|---|
353
353
  | Noise implementations, particle pool, flow field, L-system, attractors | `references/algorithms.md` |
354
354
  | Timing and easing for animated transitions | the brand guidelines' Motion System (§06), reached via the source-of-truth table in `departments/brand/references/uiux-knowledge-and-tools.md` |
355
- | 3D generative (shaders, GPU particles) | out of this skill's scope — Canvas 2D only; scope a WebGL approach with the frontend squad |
355
+ | 3D generative (shaders, GPU particles) | `departments/dev/skills/threejs/SKILL.md` |
356
356
 
357
357
  ## Output
358
358
 
@@ -0,0 +1,173 @@
1
+ ---
2
+ name: dev/threejs
3
+ description: >
4
+ Real-time 3D in the browser with three.js and React Three Fiber: modern
5
+ setup (import maps, WebGL vs WebGPU renderer choice, TSL), the
6
+ scene-camera-renderer wiring, geometries, materials and lights, loaders,
7
+ disposal discipline against GPU memory leaks, performance budgets — and
8
+ the R3F layer (hooks, drei, postprocessing) for React projects.
9
+ TRIGGER: "three.js", "threejs", "react three fiber", "r3f", "webgl",
10
+ "webgpu", "shader", "GLSL", "cena 3D", "3D interativo no browser",
11
+ "drei", "/dev threejs".
12
+ SKIP: a pre-rendered 3D world scrubbed by scroll (no real-time engine)
13
+ -> dev/scroll-world; generative 2D canvas -> dev/canvas-generative;
14
+ generating a 3D asset (GLB mesh) from an image -> the higgsfield-generate
15
+ skill; React motion without 3D -> dev/framer-motion.
16
+ allowed-tools: [Read, Write, Edit, Bash, Grep, Glob]
17
+ metadata:
18
+ origin: community
19
+ source: https://github.com/AThevon/genjutsu
20
+ license: MIT
21
+ ---
22
+
23
+ <!-- arka:kb-first-prefix begin -->
24
+ > **KB-first:** query `mcp__obsidian__search_notes` (and
25
+ > `mcp__graphify__query_graph` when configured) and cite `[[wikilinks]]`
26
+ > or graph nodes — or declare the gap — BEFORE any external research.
27
+ > Full doctrine: `arka/SKILL.md` (KB-First Research).
28
+ <!-- arka:kb-first-prefix end -->
29
+
30
+ # Three.js — `/dev threejs`
31
+
32
+ > **Agent:** Diana (Frontend Dev) | **Framework:** three.js (MIT) + React Three Fiber
33
+ > Core authored from the three.js project's own LLM guidance
34
+ > (`docs/llms.txt`, MIT); the R3F layer derives from genjutsu (MIT) — see
35
+ > `references/`.
36
+
37
+ ## Setup — the modern shape
38
+
39
+ Import maps, never legacy CDN script tags. Pin one version for `three`
40
+ and `three/addons/` together — mixing versions across the two specifiers
41
+ is the classic silent breaker:
42
+
43
+ ```html
44
+ <script type="importmap">
45
+ { "imports": {
46
+ "three": "https://cdn.jsdelivr.net/npm/three@<version>/build/three.module.js",
47
+ "three/webgpu": "https://cdn.jsdelivr.net/npm/three@<version>/build/three.webgpu.js",
48
+ "three/tsl": "https://cdn.jsdelivr.net/npm/three@<version>/build/three.tsl.js",
49
+ "three/addons/": "https://cdn.jsdelivr.net/npm/three@<version>/examples/jsm/" } }
50
+ </script>
51
+ ```
52
+
53
+ `WebGPURenderer` is not exported from `three` — it lives in the
54
+ `three/webgpu` entry, and it is async: `await renderer.init()` before the
55
+ first frame. The TSL node functions live in `three/tsl`, not in
56
+ `three/webgpu`. Omit either entry and the import fails at runtime.
57
+
58
+ In a bundled project, `npm i three` and import the same specifiers. Check
59
+ the installed version before writing code — the API moves, and the
60
+ project's lockfile outranks your memory of it.
61
+
62
+ **Renderer choice.** `WebGLRenderer` is the default and safe everywhere.
63
+ `WebGPURenderer` (with TSL node materials) is the forward path but needs
64
+ feature detection and a WebGL fallback; choose it only when the project
65
+ targets browsers you control or ships the fallback. Never mix GLSL
66
+ `ShaderMaterial` into a WebGPU pipeline — that renderer wants TSL
67
+ `NodeMaterial` classes.
68
+
69
+ ## The irreducible core
70
+
71
+ Scene, camera, renderer, loop — everything else hangs off these:
72
+
73
+ ```js
74
+ const scene = new THREE.Scene();
75
+ const camera = new THREE.PerspectiveCamera(75, w / h, 0.1, 100);
76
+ const renderer = new THREE.WebGLRenderer({ antialias: true });
77
+ renderer.setSize(w, h);
78
+ renderer.setPixelRatio(Math.min(devicePixelRatio, 2)); // cap DPR: 3x buys nothing visible and burns fill rate
79
+ renderer.setAnimationLoop(tick); // not a hand-rolled rAF: in XR it swaps to the session's loop; outside XR it is rAF with correct teardown via setAnimationLoop(null)
80
+ ```
81
+
82
+ On resize: update `camera.aspect`, call `camera.updateProjectionMatrix()`,
83
+ then `renderer.setSize`. Forgetting the middle step is why "resize
84
+ stretches everything".
85
+
86
+ **Animate with elapsed time, not the frame count.** A per-frame delta
87
+ keeps speed identical at 30 and 144 fps; per-frame increments do not.
88
+ Use `THREE.Timer` (`timer.update(); timer.getDelta()`) — `THREE.Clock`
89
+ is deprecated since r183 and warns at runtime.
90
+
91
+ ## Disposal — GPU memory does not garbage-collect
92
+
93
+ Removing a mesh from the scene frees nothing on the GPU. Every geometry,
94
+ material, texture and render target you create, you `dispose()` when its
95
+ life ends — and a material's textures are disposed separately from the
96
+ material. For a whole subtree, collect first, dispose once: `traverse`
97
+ visits Groups and Lights that have no material, and shared resources must
98
+ not be disposed per-mesh:
99
+
100
+ ```js
101
+ function disposeSubtree(root) {
102
+ const geometries = new Set(), materials = new Set(), textures = new Set();
103
+ root.traverse((obj) => {
104
+ if (!obj.isMesh && !obj.isPoints && !obj.isLine && !obj.isSprite) return;
105
+ // Sprites share one engine-owned quad geometry app-wide: never dispose it
106
+ if (obj.geometry && !obj.isSprite) geometries.add(obj.geometry);
107
+ const mats = Array.isArray(obj.material) ? obj.material : [obj.material];
108
+ for (const m of mats) {
109
+ if (!m) continue;
110
+ materials.add(m);
111
+ for (const v of Object.values(m)) if (v?.isTexture) textures.add(v);
112
+ // ShaderMaterial textures live in uniforms, not on the material —
113
+ // and a uniform's value can be an ARRAY of textures (atlas shape)
114
+ if (m.uniforms) for (const u of Object.values(m.uniforms)) {
115
+ const vals = Array.isArray(u?.value) ? u.value : [u?.value];
116
+ for (const v of vals) if (v?.isTexture) textures.add(v);
117
+ }
118
+ }
119
+ });
120
+ textures.forEach((t) => t.dispose());
121
+ materials.forEach((m) => m.dispose());
122
+ geometries.forEach((g) => g.dispose());
123
+ }
124
+ ```
125
+
126
+ This covers the shapes meshes ordinarily carry — geometries, material
127
+ maps, scalar and array texture uniforms. When a resource is shared
128
+ with meshes OUTSIDE the subtree — a texture atlas, a cached material —
129
+ exclude it: ownership is yours to model, and dispose belongs to the owner.
130
+
131
+ A single-page app that mounts and unmounts scenes without this leaks
132
+ until the tab dies. This is the number-one three.js production bug.
133
+
134
+ ## Performance budget
135
+
136
+ - **Draw calls first.** Hundreds of meshes sharing one geometry+material
137
+ belong in an `InstancedMesh`; thousands of distinct static meshes merge
138
+ via `BufferGeometryUtils.mergeGeometries`.
139
+ - Reuse geometries and materials across meshes; clone only when a
140
+ property must diverge.
141
+ - Textures: compressed formats (KTX2/Basis) for anything big, and never
142
+ larger than the screen area they cover; mipmaps come from the loader or
143
+ `generateMipmaps`, with no power-of-two constraint in WebGL 2.
144
+ - Lights are per-fragment cost: prefer one directional + ambient or an
145
+ environment map over a constellation of point lights. Bake what does
146
+ not move.
147
+ - Shadows are a render pass per caster: tight `shadow.camera` frustum,
148
+ modest map sizes, `castShadow` only where it is visible.
149
+
150
+ ## Loading models
151
+
152
+ `GLTFLoader` (with `DRACOLoader` or `KTX2Loader` when the asset uses
153
+ them) from `three/addons/`. Load asynchronously, add a loading state,
154
+ and dispose the loader's intermediates. glTF is the format; converting
155
+ from anything else happens in the asset pipeline, not at runtime.
156
+
157
+ ## React Three Fiber
158
+
159
+ For React projects, R3F replaces the imperative wiring: the component
160
+ tree IS the scene graph, `useFrame` is the loop, drei supplies the
161
+ controls/loaders/staging you would otherwise hand-write. The full layer —
162
+ hooks discipline, drei picks, postprocessing, and the Do-Nots (from
163
+ setState in useFrame to forgotten dispose) — lives
164
+ in [references/r3f.md](references/r3f.md), with canvas/scene wiring in
165
+ [references/scene-setup.md](references/scene-setup.md) and GLSL/TSL
166
+ patterns in [references/shaders.md](references/shaders.md).
167
+
168
+ ## Output
169
+
170
+ A working scene module (or R3F component tree) with the render loop,
171
+ resize handling and disposal wired, a stated performance budget (draw
172
+ calls, texture memory, DPR cap), and the renderer choice justified in one
173
+ line. Anything WebGPU/TSL states its fallback.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Adrien Thevon
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.