@istmx/skills 1.0.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.
- package/README.md +49 -0
- package/bin/cli.js +251 -0
- package/istm/SKILL.md +65 -0
- package/istm-animate/SKILL.md +87 -0
- package/istm-animate/animations/animation_utils.md +280 -0
- package/istm-animate/animations/animations.md +220 -0
- package/istm-animate/animations/core_motion.md +250 -0
- package/istm-animate/animations/examples/README.md +29 -0
- package/istm-animate/animations/examples/nuxt/app/app.vue +3 -0
- package/istm-animate/animations/examples/nuxt/app/composables/useGSAP.ts +91 -0
- package/istm-animate/animations/examples/nuxt/app/pages/index.vue +55 -0
- package/istm-animate/animations/examples/nuxt/nuxt.config.ts +4 -0
- package/istm-animate/animations/examples/nuxt/package.json +18 -0
- package/istm-animate/animations/examples/react/App.jsx +46 -0
- package/istm-animate/animations/examples/react/index.html +12 -0
- package/istm-animate/animations/examples/react/main.jsx +9 -0
- package/istm-animate/animations/examples/react/package.json +21 -0
- package/istm-animate/animations/examples/react/vite.config.js +7 -0
- package/istm-animate/animations/examples/vanilla/index.html +33 -0
- package/istm-animate/animations/examples/vanilla/main.js +36 -0
- package/istm-animate/animations/examples/vue/app.vue +47 -0
- package/istm-animate/animations/examples/vue/index.html +15 -0
- package/istm-animate/animations/examples/vue/main.js +9 -0
- package/istm-animate/animations/examples/vue/package.json +19 -0
- package/istm-animate/animations/examples/vue/vite.config.js +7 -0
- package/istm-animate/animations/framework_motion.md +262 -0
- package/istm-animate/animations/motion.csv +17 -0
- package/istm-animate/animations/motion.md +11 -0
- package/istm-animate/animations/motion_catalog.json +226 -0
- package/istm-animate/animations/motion_performance.md +75 -0
- package/istm-animate/animations/motion_plugins.md +429 -0
- package/istm-animate/animations/react_animations.md +132 -0
- package/istm-animate/animations/scroll_trigger_effects.md +291 -0
- package/istm-animate/animations/timeline_sequencing.md +103 -0
- package/istm-architecture/SKILL.md +109 -0
- package/istm-architecture/frameworks/angular.csv +51 -0
- package/istm-architecture/frameworks/astro.csv +54 -0
- package/istm-architecture/frameworks/avalonia.csv +57 -0
- package/istm-architecture/frameworks/flutter.csv +53 -0
- package/istm-architecture/frameworks/javafx.csv +76 -0
- package/istm-architecture/frameworks/jetpack-compose.csv +53 -0
- package/istm-architecture/frameworks/laravel.csv +51 -0
- package/istm-architecture/frameworks/nextjs.csv +53 -0
- package/istm-architecture/frameworks/nuxtjs.csv +59 -0
- package/istm-architecture/frameworks/react-native.csv +52 -0
- package/istm-architecture/frameworks/react.csv +54 -0
- package/istm-architecture/frameworks/svelte.csv +54 -0
- package/istm-architecture/frameworks/swiftui.csv +51 -0
- package/istm-architecture/frameworks/uwp.csv +56 -0
- package/istm-architecture/frameworks/vue.csv +50 -0
- package/istm-architecture/frameworks/winui.csv +60 -0
- package/istm-architecture/frameworks/wpf.csv +57 -0
- package/istm-architecture/templates/agents.md +229 -0
- package/istm-architecture/templates/architecture.md +111 -0
- package/istm-architecture/templates/design.md +138 -0
- package/istm-architecture/templates/project-overview.md +215 -0
- package/istm-awwward-designer/SKILL.md +43 -0
- package/istm-awwward-designer/libraries/threejs.csv +54 -0
- package/istm-awwward-designer/references/accessibility.md +774 -0
- package/istm-awwward-designer/references/anim-anti-patterns.md +576 -0
- package/istm-awwward-designer/references/animation-map.md +166 -0
- package/istm-awwward-designer/references/animation-standards.md +86 -0
- package/istm-awwward-designer/references/anti-patterns.md +191 -0
- package/istm-awwward-designer/references/color-systems.md +604 -0
- package/istm-awwward-designer/references/css-performance.md +477 -0
- package/istm-awwward-designer/references/descender-safety.md +490 -0
- package/istm-awwward-designer/references/design-audit.md +93 -0
- package/istm-awwward-designer/references/font-loading.md +378 -0
- package/istm-awwward-designer/references/image-optimization.md +440 -0
- package/istm-awwward-designer/references/invention-gate.md +356 -0
- package/istm-awwward-designer/references/micro-interactions.md +825 -0
- package/istm-awwward-designer/references/page-transitions.md +365 -0
- package/istm-awwward-designer/references/performance-standards.md +79 -0
- package/istm-awwward-designer/references/quality-gate.md +103 -0
- package/istm-awwward-designer/references/responsive-design.md +778 -0
- package/istm-awwward-designer/references/scoring-guide.md +201 -0
- package/istm-awwward-designer/references/scroll-patterns.md +668 -0
- package/istm-awwward-designer/references/stitch-brief.md +124 -0
- package/istm-awwward-designer/references/tech-stack.md +204 -0
- package/istm-awwward-designer/references/technical-audit.md +133 -0
- package/istm-awwward-designer/references/technique-families.md +293 -0
- package/istm-awwward-designer/references/testing.md +535 -0
- package/istm-awwward-designer/references/text-animation.md +585 -0
- package/istm-awwward-designer/references/typography.md +504 -0
- package/istm-awwward-designer/references/usability-audit.md +108 -0
- package/istm-awwward-designer/references/visual-standards.md +97 -0
- package/istm-design/SKILL.md +98 -0
- package/istm-design/colors/color_theory.md +293 -0
- package/istm-design/colors/colors.csv +193 -0
- package/istm-design/colors/colors_catalog.json +4034 -0
- package/istm-design/colors/palette.json +21 -0
- package/istm-design/styles/design_system.md +288 -0
- package/istm-design/styles/html-tailwind.csv +56 -0
- package/istm-design/styles/nuxt-ui.csv +71 -0
- package/istm-design/styles/product_design.md +55 -0
- package/istm-design/styles/shadcn.csv +61 -0
- package/istm-design/styles/style.md +12 -0
- package/istm-design/styles/styles.csv +85 -0
- package/istm-design/styles/styles_catalog.json +2018 -0
- package/istm-design/styles/ui-reasoning.csv +162 -0
- package/istm-design/styles/uno.csv +60 -0
- package/istm-design/typography/font_and_font.md +10 -0
- package/istm-design/typography/google-fonts.csv +1924 -0
- package/istm-design/typography/sans_serif_fonts.md +112 -0
- package/istm-design/typography/typography.csv +75 -0
- package/istm-design/typography/typography_catalog.json +964 -0
- package/istm-design/ux/app-interface.csv +31 -0
- package/istm-design/ux/charts.csv +26 -0
- package/istm-design/ux/icons.csv +106 -0
- package/istm-design/ux/landing.csv +35 -0
- package/istm-design/ux/products.csv +193 -0
- package/istm-design/ux/react-performance.csv +45 -0
- package/istm-design/ux/responsive_rules.md +62 -0
- package/istm-design/ux/storytelling.md +47 -0
- package/istm-design/ux/ux-guidelines.csv +100 -0
- package/istm-design/ux/ux_guidelines.json +1190 -0
- package/istm-system-design/SKILL.md +88 -0
- package/istm-system-design/principles/01-architecture-patterns.md +24 -0
- package/istm-system-design/principles/02-database-selection.md +32 -0
- package/istm-system-design/principles/03-api-design.md +25 -0
- package/istm-system-design/principles/04-authentication-security.md +23 -0
- package/istm-system-design/principles/05-caching-performance.md +21 -0
- package/istm-system-design/principles/06-asynchronous-processing.md +17 -0
- package/istm-system-design/principles/07-infrastructure-deployment.md +22 -0
- package/istm-system-design/principles/08-low-level-design.md +35 -0
- package/istm-system-design/principles/09-state-management.md +14 -0
- package/istm-system-design/principles/10-error-handling-and-logging.md +26 -0
- package/istm-system-design/principles/11-testing-strategy.md +18 -0
- package/istm-system-design/principles/12-seo-and-web-vitals.md +18 -0
- package/istm-system-design/stacks/SETUP.md +82 -0
- package/istm-system-design/stacks/STACK.md +67 -0
- package/istm-system-design/stacks/WORKFLOW.md +84 -0
- package/istm-system-design/templates/api-route.ts.template +32 -0
- package/istm-system-design/templates/migrations.md.template +30 -0
- package/istm-system-design/templates/schema.drizzle.ts.template +17 -0
- package/istm-system-design/templates/schema.prisma.template +28 -0
- package/istm-system-design/templates/trpc-router.ts.template +22 -0
- package/istm-system-design/templates/zod-validators.ts.template +14 -0
- package/istm-workflow/istm-audit/SKILL.md +108 -0
- package/istm-workflow/istm-audit/agent-prompt.md +393 -0
- package/istm-workflow/istm-audit/agents/openai.yaml +7 -0
- package/istm-workflow/istm-audit/modes/area.md +19 -0
- package/istm-workflow/istm-audit/modes/gapfill.md +12 -0
- package/istm-workflow/istm-audit/modes/greenfield.md +24 -0
- package/istm-workflow/istm-audit/modes/tool-skills.md +39 -0
- package/istm-workflow/istm-audit/modes/whole-repo.md +5 -0
- package/istm-workflow/istm-audit/patterns/clean-architecture.md +15 -0
- package/istm-workflow/istm-audit/patterns/domain-driven.md +16 -0
- package/istm-workflow/istm-audit/patterns/functional.md +16 -0
- package/istm-workflow/istm-audit/patterns/solid-oop.md +17 -0
- package/istm-workflow/istm-check/SKILL.md +52 -0
- package/istm-workflow/istm-check/agents/openai.yaml +7 -0
- package/istm-workflow/istm-check/modes/review.md +156 -0
- package/istm-workflow/istm-check/modes/verify.md +197 -0
- package/istm-workflow/istm-check/review-agent-prompt.md +57 -0
- package/istm-workflow/istm-check/review-guide.md +133 -0
- package/istm-workflow/istm-craft/SKILL.md +37 -0
- package/istm-workflow/istm-craft/agent-modes/architecture.md +73 -0
- package/istm-workflow/istm-craft/agent-modes/cross-cutting.md +65 -0
- package/istm-workflow/istm-craft/agent-modes/enhancement.md +45 -0
- package/istm-workflow/istm-craft/agent-modes/feature.md +85 -0
- package/istm-workflow/istm-craft/agent-prompt.md +249 -0
- package/istm-workflow/istm-craft/agents/openai.yaml +7 -0
- package/istm-workflow/istm-craft/internal/after-subagent.md +90 -0
- package/istm-workflow/istm-craft/internal/design-conversation.md +140 -0
- package/istm-workflow/istm-craft/internal/tool-discovery.md +58 -0
- package/istm-workflow/istm-craft/spec-template.md +278 -0
- package/istm-workflow/istm-debug/SKILL.md +102 -0
- package/istm-workflow/istm-debug/agents/openai.yaml +7 -0
- package/istm-workflow/istm-develop/SKILL.md +144 -0
- package/istm-workflow/istm-develop/agents/openai.yaml +7 -0
- package/istm-workflow/istm-develop/checklist.md +95 -0
- package/istm-workflow/istm-develop/flow/build.md +133 -0
- package/istm-workflow/istm-develop/flow/git.md +34 -0
- package/istm-workflow/istm-develop/logical-guide.md +99 -0
- package/istm-workflow/istm-develop/ui/existing.md +23 -0
- package/istm-workflow/istm-develop/ui/generate.md +131 -0
- package/istm-workflow/istm-develop/ui/image.md +41 -0
- package/istm-workflow/istm-develop/ui/implementation.md +281 -0
- package/istm-workflow/istm-develop/ui/mcp.md +11 -0
- package/istm-workflow/istm-develop/ui-guide.md +164 -0
- package/istm-workflow/istm-document/SKILL.md +123 -0
- package/istm-workflow/istm-document/agent-prompt.md +57 -0
- package/istm-workflow/istm-document/agents/openai.yaml +7 -0
- package/istm-workflow/istm-document/templates/changelog.md +54 -0
- package/istm-workflow/istm-document/templates/postmortem.md +58 -0
- package/istm-workflow/istm-document/templates/pr.md +43 -0
- package/istm-workflow/istm-document/templates/release-note.md +41 -0
- package/istm-workflow/istm-scope/SKILL.md +100 -0
- package/istm-workflow/istm-scope/agents/openai.yaml +7 -0
- package/istm-workflow/istm-scope/approaches/facade.md +33 -0
- package/istm-workflow/istm-scope/approaches/journey.md +31 -0
- package/istm-workflow/istm-scope/approaches/skateboard.md +33 -0
- package/istm-workflow/istm-scope/approaches/tracer-bullet.md +34 -0
- package/istm-workflow/istm-scope/modes/add.md +14 -0
- package/istm-workflow/istm-scope/modes/plan-brownfield.md +11 -0
- package/istm-workflow/istm-scope/modes/plan-greenfield.md +20 -0
- package/istm-workflow/istm-scope/modes/plan-monorepo.md +8 -0
- package/istm-workflow/istm-scope/modes/plan.md +120 -0
- package/istm-workflow/istm-scope/modes/replan.md +13 -0
- package/istm-workflow/istm-scope/scope-template.md +148 -0
- package/istm-workflow/istm-sync/SKILL.md +166 -0
- package/istm-workflow/istm-sync/agent-prompt.md +211 -0
- package/istm-workflow/istm-sync/agents/openai.yaml +7 -0
- package/istm-workflow/istm-test/SKILL.md +233 -0
- package/istm-workflow/istm-test/agent-prompt.md +62 -0
- package/istm-workflow/istm-test/agents/openai.yaml +7 -0
- package/istm-workflow/istm-test/modes/setup.md +97 -0
- package/istm-workflow/istm-test/writing-guide.md +196 -0
- package/package.json +35 -0
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
# Zenix Animation Utilities
|
|
2
|
+
|
|
3
|
+
# gsap.utils
|
|
4
|
+
|
|
5
|
+
## When to Use This Skill
|
|
6
|
+
|
|
7
|
+
Apply when writing or reviewing code that uses **gsap.utils** for math, array/collection handling, unit parsing, or value mapping in animations (e.g. mapping scroll to a value, randomizing, snapping to a grid, or normalizing inputs).
|
|
8
|
+
|
|
9
|
+
**Related skills:** Use with **gsap-core**, **gsap-timeline**, and **gsap-scrolltrigger** when building animations; CustomEase and other easing utilities are in **gsap-plugins**.
|
|
10
|
+
|
|
11
|
+
## Overview
|
|
12
|
+
|
|
13
|
+
**gsap.utils** provides pure helpers; no need to register. Use in tween vars (e.g. function-based values), in ScrollTrigger or Observer callbacks, or in any JS that drives GSAP. All are on **gsap.utils** (e.g. `gsap.utils.clamp()`).
|
|
14
|
+
|
|
15
|
+
**Omitting the value: function form.** Many utils accept the value to transform as the **last** argument. If you omit that argument, the util returns a **function** that accepts the value later. Use the function form when you need to clamp, map, normalize, or snap many values with the same config (e.g. in a mousemove handler or tween callback). **Exception: random()** — pass **true** as the last argument to get a reusable function (do not omit the value); see [random()](https://gsap.com/docs/v3/GSAP/UtilityMethods/random()).
|
|
16
|
+
|
|
17
|
+
```javascript
|
|
18
|
+
// With value: returns the result
|
|
19
|
+
gsap.utils.clamp(0, 100, 150); // 100
|
|
20
|
+
|
|
21
|
+
// Without value: returns a function you call with the value later
|
|
22
|
+
let c = gsap.utils.clamp(0, 100);
|
|
23
|
+
c(150); // 100
|
|
24
|
+
c(-10); // 0
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Clamping and Ranges
|
|
28
|
+
|
|
29
|
+
### clamp(min, max, value?)
|
|
30
|
+
|
|
31
|
+
Constrains a value between min and max. Omit **value** to get a function: `clamp(min, max)(value)`.
|
|
32
|
+
|
|
33
|
+
```javascript
|
|
34
|
+
gsap.utils.clamp(0, 100, 150); // 100
|
|
35
|
+
gsap.utils.clamp(0, 100, -10); // 0
|
|
36
|
+
|
|
37
|
+
let clampFn = gsap.utils.clamp(0, 100);
|
|
38
|
+
clampFn(150); // 100
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### mapRange(inMin, inMax, outMin, outMax, value?)
|
|
42
|
+
|
|
43
|
+
Maps a value from one range to another. Use when converting scroll position, progress (0–1), or input range to an animation range. Omit **value** to get a function: `mapRange(inMin, inMax, outMin, outMax)(value)`.
|
|
44
|
+
|
|
45
|
+
```javascript
|
|
46
|
+
gsap.utils.mapRange(0, 100, 0, 500, 50); // 250
|
|
47
|
+
gsap.utils.mapRange(0, 1, 0, 360, 0.5); // 180 (progress to degrees)
|
|
48
|
+
|
|
49
|
+
let mapFn = gsap.utils.mapRange(0, 100, 0, 500);
|
|
50
|
+
mapFn(50); // 250
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### normalize(min, max, value?)
|
|
54
|
+
|
|
55
|
+
Returns a value normalized to 0–1 for the given range. Inverse of mapping when the target range is 0–1. Omit **value** to get a function: `normalize(min, max)(value)`.
|
|
56
|
+
|
|
57
|
+
```javascript
|
|
58
|
+
gsap.utils.normalize(0, 100, 50); // 0.5
|
|
59
|
+
gsap.utils.normalize(100, 300, 200); // 0.5
|
|
60
|
+
|
|
61
|
+
let normFn = gsap.utils.normalize(0, 100);
|
|
62
|
+
normFn(50); // 0.5
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### interpolate(start, end, progress?)
|
|
66
|
+
|
|
67
|
+
Interpolates between two values at a given progress (0–1). Handles numbers, colors, and objects with matching keys. Omit **progress** to get a function: `interpolate(start, end)(progress)`.
|
|
68
|
+
|
|
69
|
+
```javascript
|
|
70
|
+
gsap.utils.interpolate(0, 100, 0.5); // 50
|
|
71
|
+
gsap.utils.interpolate("#ff0000", "#0000ff", 0.5); // mid color
|
|
72
|
+
gsap.utils.interpolate({ x: 0, y: 0 }, { x: 100, y: 50 }, 0.5); // { x: 50, y: 25 }
|
|
73
|
+
|
|
74
|
+
let lerp = gsap.utils.interpolate(0, 100);
|
|
75
|
+
lerp(0.5); // 50
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Random and Snap
|
|
79
|
+
|
|
80
|
+
### random(minimum, maximum[, snapIncrement, returnFunction]) / random(array[, returnFunction])
|
|
81
|
+
|
|
82
|
+
Returns a random number in the range **minimum**–**maximum**, or a random element from an **array**. Optional **snapIncrement** snaps the result to the nearest multiple (e.g. `5` → multiples of 5). **To get a reusable function**, pass **true** as the last argument (**returnFunction**); the returned function takes no args and returns a new random value each time. This is the only util that uses `true` for the function form instead of omitting the value.
|
|
83
|
+
|
|
84
|
+
```javascript
|
|
85
|
+
// immediate value: number in range
|
|
86
|
+
gsap.utils.random(-100, 100); // e.g. 42.7
|
|
87
|
+
gsap.utils.random(0, 500, 5); // 0–500, snapped to nearest 5
|
|
88
|
+
|
|
89
|
+
// reusable function: pass true as last argument
|
|
90
|
+
let randomFn = gsap.utils.random(-200, 500, 10, true);
|
|
91
|
+
randomFn(); // random value in range, snapped to 10
|
|
92
|
+
randomFn(); // another random value
|
|
93
|
+
|
|
94
|
+
// array: pick one value at random
|
|
95
|
+
gsap.utils.random(["red", "blue", "green"]); // "red", "blue", or "green"
|
|
96
|
+
let randomFromArray = gsap.utils.random([0, 100, 200], true);
|
|
97
|
+
randomFromArray(); // 0, 100, or 200
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
**String form in tween vars:** use `"random(-100, 100)"`, `"random(-100, 100, 5)"`, or `"random([0, 100, 200])"`; GSAP evaluates it per target.
|
|
101
|
+
|
|
102
|
+
```javascript
|
|
103
|
+
gsap.to(".box", { x: "random(-100, 100, 5)", duration: 1 });
|
|
104
|
+
gsap.to(".item", { backgroundColor: "random([red, blue, green])" });
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### snap(snapTo, value?)
|
|
108
|
+
|
|
109
|
+
Snaps a value to the nearest multiple of **snapTo**, or to the nearest value in an array of allowed values. Omit **value** to get a function: `snap(snapTo)(value)` (or `snap(snapArray)(value)`).
|
|
110
|
+
|
|
111
|
+
```javascript
|
|
112
|
+
gsap.utils.snap(10, 23); // 20
|
|
113
|
+
gsap.utils.snap(0.25, 0.7); // 0.75
|
|
114
|
+
gsap.utils.snap([0, 100, 200], 150); // 100 or 200 (nearest in array)
|
|
115
|
+
|
|
116
|
+
let snapFn = gsap.utils.snap(10);
|
|
117
|
+
snapFn(23); // 20
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Use in tweens for grid or step-based animation:
|
|
121
|
+
|
|
122
|
+
```javascript
|
|
123
|
+
gsap.to(".x", { x: 200, snap: { x: 20 } });
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### shuffle(array)
|
|
127
|
+
|
|
128
|
+
Returns a new array with the same elements in random order. Use for randomizing order (e.g. stagger from "random" with a copy).
|
|
129
|
+
|
|
130
|
+
```javascript
|
|
131
|
+
gsap.utils.shuffle([1, 2, 3, 4]); // e.g. [3, 1, 4, 2]
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### distribute(config)
|
|
135
|
+
|
|
136
|
+
**Returns a function** that assigns a value to each target based on its position in the array (or in a grid). Used internally for advanced staggers; use it whenever you need values spread across many elements (e.g. scale, opacity, x, delay). The returned function receives `(index, target, targets)` — either call it manually or pass the result directly into a tween; GSAP will call it per target with index, element, and array.
|
|
137
|
+
|
|
138
|
+
**Config (all optional):**
|
|
139
|
+
|
|
140
|
+
| Property | Type | Description |
|
|
141
|
+
|----------|------|-------------|
|
|
142
|
+
| `base` | Number | Starting value. Default `0`. |
|
|
143
|
+
| `amount` | Number | Total to distribute across all targets (added to base). E.g. `amount: 1` with 100 targets → 0.01 between each. Use **each** instead to set a fixed step per target. |
|
|
144
|
+
| `each` | Number | Amount to add between each target (added to base). E.g. `each: 1` with 4 targets → 0, 1, 2, 3. Use **amount** instead to split a total. |
|
|
145
|
+
| `from` | Number \| String \| Array | Where distribution starts: index, or `"start"`, `"center"`, `"edges"`, `"random"`, `"end"`, or ratios like `[0.25, 0.75]`. Default `0`. |
|
|
146
|
+
| `grid` | String \| Array | Use grid position instead of flat index: `[rows, columns]` (e.g. `[5, 10]`) or `"auto"` to detect. Omit for flat array. |
|
|
147
|
+
| `axis` | String | For grid: limit to one axis (`"x"` or `"y"`). |
|
|
148
|
+
| `ease` | Ease | Distribute values along an ease curve (e.g. `"power1.inOut"`). Default `"none"`. |
|
|
149
|
+
|
|
150
|
+
**In a tween:** pass the result of `distribute(config)` as the property value; GSAP calls the function for each target with `(index, target, targets)`.
|
|
151
|
+
|
|
152
|
+
```javascript
|
|
153
|
+
// Scale: middle elements 0.5, outer edges 3 (amount 2.5 distributed from center)
|
|
154
|
+
gsap.to(".class", {
|
|
155
|
+
scale: gsap.utils.distribute({
|
|
156
|
+
base: 0.5,
|
|
157
|
+
amount: 2.5,
|
|
158
|
+
from: "center"
|
|
159
|
+
})
|
|
160
|
+
});
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
**Manual use:** call the returned function with `(index, target, targets)` to get the value for that index.
|
|
164
|
+
|
|
165
|
+
```javascript
|
|
166
|
+
const distributor = gsap.utils.distribute({
|
|
167
|
+
base: 50,
|
|
168
|
+
amount: 100,
|
|
169
|
+
from: "center",
|
|
170
|
+
ease: "power1.inOut"
|
|
171
|
+
});
|
|
172
|
+
const targets = gsap.utils.toArray(".box");
|
|
173
|
+
const valueForIndex2 = distributor(2, targets[2], targets);
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
See [distribute()](https://gsap.com/docs/v3/GSAP/UtilityMethods/distribute/) for more.
|
|
177
|
+
|
|
178
|
+
## Units and Parsing
|
|
179
|
+
|
|
180
|
+
### getUnit(value)
|
|
181
|
+
|
|
182
|
+
Returns the unit string of a value (e.g. `"px"`, `"%"`, `"deg"`). Use when normalizing or converting values.
|
|
183
|
+
|
|
184
|
+
```javascript
|
|
185
|
+
gsap.utils.getUnit("100px"); // "px"
|
|
186
|
+
gsap.utils.getUnit("50%"); // "%"
|
|
187
|
+
gsap.utils.getUnit(42); // "" (unitless)
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
### unitize(value, unit)
|
|
191
|
+
|
|
192
|
+
Appends a unit to a number, or returns the value as-is if it already has a unit. Use when building CSS values or tween end values.
|
|
193
|
+
|
|
194
|
+
```javascript
|
|
195
|
+
gsap.utils.unitize(100, "px"); // "100px"
|
|
196
|
+
gsap.utils.unitize("2rem", "px"); // "2rem" (unchanged)
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
### splitColor(color, returnHSL?)
|
|
200
|
+
|
|
201
|
+
Converts a color string into an array: **[red, green, blue]** (0–255), or **[red, green, blue, alpha]** (4 elements for RGBA when alpha is present or required). Pass **true** as the second argument (**returnHSL**) to get **[hue, saturation, lightness]** or **[hue, saturation, lightness, alpha]** (HSL/HSLA) instead. Works with `"rgb()"`, `"rgba()"`, `"hsl()"`, `"hsla()"`, hex, and named colors (e.g. `"red"`). Use when animating color components or building gradients. See [splitColor()](https://gsap.com/docs/v3/GSAP/UtilityMethods/splitColor/).
|
|
202
|
+
|
|
203
|
+
```javascript
|
|
204
|
+
gsap.utils.splitColor("red"); // [255, 0, 0]
|
|
205
|
+
gsap.utils.splitColor("#6fb936"); // [111, 185, 54]
|
|
206
|
+
gsap.utils.splitColor("rgba(204, 153, 51, 0.5)"); // [204, 153, 51, 0.5] (4 elements)
|
|
207
|
+
gsap.utils.splitColor("#6fb936", true); // [94, 55, 47] (HSL: hue, saturation, lightness)
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
## Arrays and Collections
|
|
211
|
+
|
|
212
|
+
### selector(scope)
|
|
213
|
+
|
|
214
|
+
Returns a scoped selector function that finds elements only within the given element (or ref). Use in components so selectors like `".box"` match only descendants of that component, not the whole document. Accepts a DOM element or a ref (e.g. React ref; handles `.current`).
|
|
215
|
+
|
|
216
|
+
```javascript
|
|
217
|
+
const q = gsap.utils.selector(containerRef);
|
|
218
|
+
q(".box"); // array of .box elements inside container
|
|
219
|
+
gsap.to(q(".circle"), { x: 100 });
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
### toArray(value, scope?)
|
|
223
|
+
|
|
224
|
+
Converts a value to an array: selector string (scoped to element), NodeList, HTMLCollection, single element, or array. Use when passing mixed inputs to GSAP (e.g. targets) and a true array is needed.
|
|
225
|
+
|
|
226
|
+
```javascript
|
|
227
|
+
gsap.utils.toArray(".item"); // array of elements
|
|
228
|
+
gsap.utils.toArray(".item", container); // scoped to container
|
|
229
|
+
gsap.utils.toArray(nodeList); // [ ... ] from NodeList
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
### pipe(...functions)
|
|
233
|
+
|
|
234
|
+
Composes functions: **pipe(f1, f2, f3)(value)** returns f3(f2(f1(value))). Use when applying a chain of transforms (e.g. normalize → mapRange → snap) in a tween or callback.
|
|
235
|
+
|
|
236
|
+
```javascript
|
|
237
|
+
const fn = gsap.utils.pipe(
|
|
238
|
+
(v) => gsap.utils.normalize(0, 100, v),
|
|
239
|
+
(v) => gsap.utils.snap(0.1, v)
|
|
240
|
+
);
|
|
241
|
+
fn(50); // normalized then snapped
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
### wrap(min, max, value?)
|
|
245
|
+
|
|
246
|
+
Wraps a value into the range min–max (inclusive min, exclusive max). Use for infinite scroll or cyclic values. Omit **value** to get a function: `wrap(min, max)(value)`.
|
|
247
|
+
|
|
248
|
+
```javascript
|
|
249
|
+
gsap.utils.wrap(0, 360, 370); // 10
|
|
250
|
+
gsap.utils.wrap(0, 360, -10); // 350
|
|
251
|
+
|
|
252
|
+
let wrapFn = gsap.utils.wrap(0, 360);
|
|
253
|
+
wrapFn(370); // 10
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
### wrapYoyo(min, max, value?)
|
|
257
|
+
|
|
258
|
+
Wraps value in range with a yoyo (bounces at ends). Use for back-and-forth within a range. Omit **value** to get a function: `wrapYoyo(min, max)(value)`.
|
|
259
|
+
|
|
260
|
+
```javascript
|
|
261
|
+
gsap.utils.wrapYoyo(0, 100, 150); // 50 (bounces back)
|
|
262
|
+
|
|
263
|
+
let wrapY = gsap.utils.wrapYoyo(0, 100);
|
|
264
|
+
wrapY(150); // 50
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
## Best practices
|
|
268
|
+
|
|
269
|
+
- ✅ Omit the value argument to get a reusable function when the same range/config is used many times (e.g. scroll handler, tween callback): `let mapFn = gsap.utils.mapRange(0, 1, 0, 360); mapFn(progress)`.
|
|
270
|
+
- ✅ Use **snap** for grid-aligned or step-based values; use **toArray** when GSAP or your code needs a real array from a selector or NodeList.
|
|
271
|
+
- ✅ Use **gsap.utils.selector(scope)** in components so selectors are scoped to a container or ref.
|
|
272
|
+
|
|
273
|
+
## Do Not
|
|
274
|
+
|
|
275
|
+
- ❌ Assume **mapRange** / **normalize** handle units; they work on numbers. Use **getUnit** / **unitize** when units matter.
|
|
276
|
+
- ❌ Override or rely on undocumented behavior; stick to the documented API.
|
|
277
|
+
|
|
278
|
+
### Learn More
|
|
279
|
+
|
|
280
|
+
https://gsap.com/docs/v3/HelperFunctions
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
Animation Vocabulary
|
|
2
|
+
A glossary of common animation patterns taught in the course. Use these names to describe what you want when prompting an AI.
|
|
3
|
+
|
|
4
|
+
Entrances & Exits
|
|
5
|
+
How elements appear and disappear.
|
|
6
|
+
|
|
7
|
+
Fade in / Fade out Element appears or disappears by changing opacity.
|
|
8
|
+
|
|
9
|
+
Slide in Element enters by sliding in from off-screen (left, right, top, or bottom).
|
|
10
|
+
|
|
11
|
+
Scale in Element grows from smaller to full size as it appears, often paired with a fade.
|
|
12
|
+
|
|
13
|
+
Pop in Element appears with a slight overshoot, like it bounces into place.
|
|
14
|
+
|
|
15
|
+
Reveal Content is uncovered gradually, often by animating a clip-path or mask.
|
|
16
|
+
|
|
17
|
+
Enter / Exit The animation an element plays when it’s added to or removed from the screen.
|
|
18
|
+
|
|
19
|
+
Sequencing & Timing
|
|
20
|
+
Coordinating multiple elements or moments.
|
|
21
|
+
|
|
22
|
+
Keyframes Defined points in an animation (0%, 50%, 100%) that the browser fills the gaps between.
|
|
23
|
+
|
|
24
|
+
Interpolation / Tween Generating all the in-between frames between a start and end value, so motion is continuous.
|
|
25
|
+
|
|
26
|
+
Stagger Animate several items one after another with a small delay between each, creating a cascade.
|
|
27
|
+
|
|
28
|
+
Orchestration Deliberately timing multiple animations so they feel like one coordinated motion.
|
|
29
|
+
|
|
30
|
+
Delay Time before an animation starts.
|
|
31
|
+
|
|
32
|
+
Duration How long an animation takes.
|
|
33
|
+
|
|
34
|
+
Fill mode Whether an element keeps its first or last frame's styles before the animation starts or after it ends (e.g. forwards).
|
|
35
|
+
|
|
36
|
+
Stepped animation An animation that is divided into discrete steps, like a countdown timer.
|
|
37
|
+
|
|
38
|
+
Movement & Transforms
|
|
39
|
+
Changing an element’s position, size, or angle.
|
|
40
|
+
|
|
41
|
+
Translate Move an element along the X or Y axis.
|
|
42
|
+
|
|
43
|
+
Scale Make an element bigger or smaller.
|
|
44
|
+
|
|
45
|
+
Rotate Spin an element around a point.
|
|
46
|
+
|
|
47
|
+
Skew Slant an element along the X or Y axis, shearing it out of its rectangular shape.
|
|
48
|
+
|
|
49
|
+
3D tilt / Flip Rotate in 3D space (rotateX / rotateY) to add depth.
|
|
50
|
+
|
|
51
|
+
Perspective How strong the 3D effect looks — a lower value exaggerates depth, like the viewer is closer.
|
|
52
|
+
|
|
53
|
+
Transform origin The anchor point a scale or rotation grows or spins from.
|
|
54
|
+
|
|
55
|
+
Origin-aware animation An element animates out of its trigger, like a popover growing from the button that opened it instead of from its own center which is the default in CSS.
|
|
56
|
+
|
|
57
|
+
Transitions Between States
|
|
58
|
+
Connecting one state, view, or element to another.
|
|
59
|
+
|
|
60
|
+
Crossfade One element fades out as another fades in, in the same spot.
|
|
61
|
+
|
|
62
|
+
Continuity transition A change that keeps the user oriented by visually connecting before and after. For example, making the same rectangle bigger and smaller.
|
|
63
|
+
|
|
64
|
+
Morph One shape smoothly turns into another shape, e.g. Dynamic Island.
|
|
65
|
+
|
|
66
|
+
Shared element transition An element travels and transforms from one position into another, like a thumbnail expanding into a card.
|
|
67
|
+
|
|
68
|
+
Layout animation When an element’s size or position changes, it animates to the new spot instead of snapping.
|
|
69
|
+
|
|
70
|
+
Accordion / Collapse A section smoothly expands and collapses its height to show or hide content.
|
|
71
|
+
|
|
72
|
+
Direction-aware transition Content slides one way going forward and the opposite way going back, so navigation has a sense of direction.
|
|
73
|
+
|
|
74
|
+
Scroll
|
|
75
|
+
Motion tied to scrolling or navigating between views.
|
|
76
|
+
|
|
77
|
+
Scroll reveal Elements fade or slide into place as they enter the viewport.
|
|
78
|
+
|
|
79
|
+
Scroll-driven animation An animation whose progress is tied directly to scroll position.
|
|
80
|
+
|
|
81
|
+
Parallax Background and foreground move at different speeds while scrolling, creating depth.
|
|
82
|
+
|
|
83
|
+
Page transition An animation that plays when navigating from one page or route to another.
|
|
84
|
+
|
|
85
|
+
View transition The browser morphs between two states or pages, connecting shared elements.
|
|
86
|
+
|
|
87
|
+
Feedback & Interaction
|
|
88
|
+
Responding to the user’s actions.
|
|
89
|
+
|
|
90
|
+
Hover effect Visual change when the cursor moves over an element.
|
|
91
|
+
|
|
92
|
+
Press / Tap feedback A subtle scale-down when an element is clicked, so it feels physical.
|
|
93
|
+
|
|
94
|
+
Hold to confirm A progress effect that fills up while the user holds a button.
|
|
95
|
+
|
|
96
|
+
Drag Moving an element by grabbing it, often with momentum when released.
|
|
97
|
+
|
|
98
|
+
Drag to reorder Dragging items in a list to rearrange them, while the others shift to make room.
|
|
99
|
+
|
|
100
|
+
Swipe to dismiss Dragging an element off-screen to close it, like a drawer or toast.
|
|
101
|
+
|
|
102
|
+
Rubber-banding Resistance and snap-back when you drag past a boundary (the iOS overscroll feel).
|
|
103
|
+
|
|
104
|
+
Shake / Wiggle A quick side-to-side jitter signaling an error or rejected input.
|
|
105
|
+
|
|
106
|
+
Ripple A circle expanding from the point of a tap, confirming the press.
|
|
107
|
+
|
|
108
|
+
Easing
|
|
109
|
+
How speed changes over an animation.
|
|
110
|
+
|
|
111
|
+
Easing The rate at which an animation speeds up or slows down.
|
|
112
|
+
|
|
113
|
+
Ease-out Starts fast, ends slow. The default for most UI and anything responding to the user.
|
|
114
|
+
|
|
115
|
+
Ease-in Starts slow, ends fast. Usually avoided; can feel sluggish.
|
|
116
|
+
|
|
117
|
+
Ease-in-out Slow, fast, slow. Good for elements already on screen moving from A to B.
|
|
118
|
+
|
|
119
|
+
Linear Constant speed. Avoid for UI; reserve for spinners or marquees.
|
|
120
|
+
|
|
121
|
+
Cubic-bezier A custom easing curve you define for precise control.
|
|
122
|
+
|
|
123
|
+
Asymmetric easing A curve that accelerates and decelerates at different rates. Feels more alive than a symmetric one.
|
|
124
|
+
|
|
125
|
+
Spring Animations
|
|
126
|
+
Physics-based motion as an alternative to fixed-duration easing.
|
|
127
|
+
|
|
128
|
+
Spring Motion driven by physics (tension, mass, damping) rather than a set duration.
|
|
129
|
+
|
|
130
|
+
Stiffness / Tension How strongly the spring pulls toward its target. Higher feels snappier.
|
|
131
|
+
|
|
132
|
+
Damping How quickly a spring settles. Lower damping means more bounce and oscillation.
|
|
133
|
+
|
|
134
|
+
Mass How heavy the animated element feels. More mass makes it slower and more sluggish.
|
|
135
|
+
|
|
136
|
+
Bounce A spring that overshoots and settles, adding playfulness.
|
|
137
|
+
|
|
138
|
+
Perceptual duration How long a spring feels finished, even though it keeps micro-settling underneath.
|
|
139
|
+
|
|
140
|
+
Momentum Motion that carries velocity, especially after a drag or interruption.
|
|
141
|
+
|
|
142
|
+
Velocity How fast and in which direction an element is moving. A spring carries it into the next animation when interrupted, so a flicked element keeps its speed.
|
|
143
|
+
|
|
144
|
+
Interruptible animation An animation that can be smoothly redirected mid-flight instead of finishing first.
|
|
145
|
+
|
|
146
|
+
Looping & Ambient Motion
|
|
147
|
+
Animations that run on their own.
|
|
148
|
+
|
|
149
|
+
Marquee Text or content that scrolls continuously in a loop.
|
|
150
|
+
|
|
151
|
+
Loop An animation that repeats, a set number of times or infinitely.
|
|
152
|
+
|
|
153
|
+
Alternate (yoyo) A loop that plays forward then reverses each iteration, instead of jumping back to the start.
|
|
154
|
+
|
|
155
|
+
Orbit An element circling around another in a continuous path.
|
|
156
|
+
|
|
157
|
+
Pulse A gentle repeating scale or opacity change to draw attention.
|
|
158
|
+
|
|
159
|
+
Float A gentle, continuous up-and-down drift that makes a static element feel alive and weightless.
|
|
160
|
+
|
|
161
|
+
Idle animation Subtle motion that plays while an element is just sitting there, waiting to be interacted with.
|
|
162
|
+
|
|
163
|
+
Polish & Effects
|
|
164
|
+
The small touches that separate good from great.
|
|
165
|
+
|
|
166
|
+
Blur A blur filter used to soften an element or mask tiny imperfections.
|
|
167
|
+
|
|
168
|
+
Clip-path Clipping an element to a shape, used for reveals, masks, and before/after sliders.
|
|
169
|
+
|
|
170
|
+
Mask Hiding or revealing parts of an element using a shape or gradient — like clip-path, but with soft, fadeable edges.
|
|
171
|
+
|
|
172
|
+
Before / after slider A draggable divider that wipes between two overlaid images to compare them.
|
|
173
|
+
|
|
174
|
+
Line drawing An SVG path that draws itself in, like an invisible pen tracing it.
|
|
175
|
+
|
|
176
|
+
Text morph Text that animates character by character when it changes, drawing attention to the new value.
|
|
177
|
+
|
|
178
|
+
Skeleton / Shimmer A placeholder with a moving sheen shown while content loads.
|
|
179
|
+
|
|
180
|
+
Number ticker Digits rolling or counting up to a value.
|
|
181
|
+
|
|
182
|
+
Tabular numbers Fixed-width digits so numbers don’t shift around as they change. Essential for tickers, timers, and counters.
|
|
183
|
+
|
|
184
|
+
Typewriter Text appearing one character at a time, as if being typed.
|
|
185
|
+
|
|
186
|
+
Performance
|
|
187
|
+
What keeps motion smooth instead of stuttering.
|
|
188
|
+
|
|
189
|
+
Frame rate (FPS) Frames drawn per second. 60fps is the baseline for smooth motion; 120fps on newer displays.
|
|
190
|
+
|
|
191
|
+
Jank Visible stutter when the browser drops frames because it can't keep up with the animation.
|
|
192
|
+
|
|
193
|
+
Dropped frame A frame the browser missed its deadline to draw, causing a tiny hitch in motion.
|
|
194
|
+
|
|
195
|
+
Compositing Letting the GPU move or fade an element on its own layer without redoing layout or paint.
|
|
196
|
+
|
|
197
|
+
will-change A CSS hint that an element is about to animate, so the browser can promote it to its own layer ahead of time.
|
|
198
|
+
|
|
199
|
+
Layout thrashing Animating properties like width, height, top, or left that force the browser to recalculate layout every frame, causing jank.
|
|
200
|
+
|
|
201
|
+
Principles to Know
|
|
202
|
+
Concepts that guide when and how to animate.
|
|
203
|
+
|
|
204
|
+
Purposeful animation Motion should serve a function — orient, give feedback, show relationships — not just decorate.
|
|
205
|
+
|
|
206
|
+
Anticipation A small wind-up in the opposite direction before a move, hinting at what's about to happen.
|
|
207
|
+
|
|
208
|
+
Follow-through Parts of an element keep moving and settle slightly after the main motion stops, adding weight.
|
|
209
|
+
|
|
210
|
+
Squash & stretch Deforming an element as it moves to convey weight, speed, and flexibility.
|
|
211
|
+
|
|
212
|
+
Perceived performance The right animation makes an interface feel faster, even when it isn’t.
|
|
213
|
+
|
|
214
|
+
Frequency of use The more often a user sees an animation, the shorter and subtler it should be.
|
|
215
|
+
|
|
216
|
+
Spatial consistency Animating so an element keeps its identity and position across states, so users never lose track of where things went.
|
|
217
|
+
|
|
218
|
+
Hardware acceleration Animating transform and opacity lets the GPU keep motion smooth.
|
|
219
|
+
|
|
220
|
+
Reduced motion Respecting the user’s prefers-reduced-motion setting by toning down or removing motion.
|