@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,668 @@
|
|
|
1
|
+
# Scroll Patterns — Deep Dive
|
|
2
|
+
|
|
3
|
+
Comprehensive reference for scroll-triggered animations. Covers Lenis setup,
|
|
4
|
+
reveal types, horizontal galleries, staggered content, and mobile fallbacks.
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Lenis Setup
|
|
9
|
+
|
|
10
|
+
Lenis provides smooth scroll that integrates with GSAP's ticker for unified
|
|
11
|
+
timing. It's the foundation of all Antigravity scroll animations.
|
|
12
|
+
|
|
13
|
+
### Installation & Core Setup
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
bun add lenis
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
```js
|
|
20
|
+
// lenis.js — initialize once, export globally
|
|
21
|
+
import Lenis from '@studio-freight/lenis';
|
|
22
|
+
|
|
23
|
+
const lenis = new Lenis({
|
|
24
|
+
duration: 1.2,
|
|
25
|
+
easing: (t) => Math.min(1, 1.001 - Math.pow(2, -10 * t)), // exponential out
|
|
26
|
+
orientation: 'vertical',
|
|
27
|
+
gestureOrientation: 'vertical',
|
|
28
|
+
smoothWheel: true,
|
|
29
|
+
smoothTouch: false, // HARD STOP — see SKILL.md hard stops
|
|
30
|
+
touchMultiplier: 2,
|
|
31
|
+
infinite: false,
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
// Sync Lenis with GSAP ticker
|
|
35
|
+
gsap.ticker.add((time) => {
|
|
36
|
+
lenis.raf(time * 1000);
|
|
37
|
+
});
|
|
38
|
+
gsap.ticker.lagSmoothing(0);
|
|
39
|
+
|
|
40
|
+
// Expose for external access
|
|
41
|
+
window.lenis = lenis;
|
|
42
|
+
|
|
43
|
+
export default lenis;
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Lenis + ScrollTrigger Integration
|
|
47
|
+
|
|
48
|
+
```js
|
|
49
|
+
// Update ScrollTrigger on Lenis scroll
|
|
50
|
+
lenis.on('scroll', ScrollTrigger.update);
|
|
51
|
+
|
|
52
|
+
// For horizontal scroll sections, pause Lenis during pin
|
|
53
|
+
ScrollTrigger.create({
|
|
54
|
+
trigger: '.horizontal-gallery',
|
|
55
|
+
start: 'top top',
|
|
56
|
+
end: 'bottom bottom',
|
|
57
|
+
onEnter: () => lenis.stop(),
|
|
58
|
+
onLeave: () => lenis.stop(),
|
|
59
|
+
onEnterBack: () => lenis.stop(),
|
|
60
|
+
onLeaveBack: () => lenis.stop(),
|
|
61
|
+
});
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Destroying Lenis (page transitions)
|
|
65
|
+
|
|
66
|
+
```js
|
|
67
|
+
// Call before page transition leave
|
|
68
|
+
lenis.destroy();
|
|
69
|
+
|
|
70
|
+
// Call after page transition enter
|
|
71
|
+
lenis = new Lenis({ /* options */ });
|
|
72
|
+
gsap.ticker.add((time) => lenis.raf(time * 1000));
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
## Reveal Type 1: Fade-Up
|
|
78
|
+
|
|
79
|
+
The most versatile and universally appropriate reveal. Use for body text,
|
|
80
|
+
captions, secondary content, and anything where scale isn't necessary.
|
|
81
|
+
|
|
82
|
+
```js
|
|
83
|
+
// GSAP — individual elements
|
|
84
|
+
gsap.from('.fade-up', {
|
|
85
|
+
y: 50,
|
|
86
|
+
opacity: 0,
|
|
87
|
+
duration: 0.8,
|
|
88
|
+
ease: 'power4.out',
|
|
89
|
+
scrollTrigger: {
|
|
90
|
+
trigger: '.fade-up',
|
|
91
|
+
start: 'top 88%',
|
|
92
|
+
toggleActions: 'play none none reverse',
|
|
93
|
+
},
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
// GSAP — staggered group (see Staggered Content section)
|
|
97
|
+
gsap.from('.fade-up-group > *', {
|
|
98
|
+
y: 60,
|
|
99
|
+
opacity: 0,
|
|
100
|
+
duration: 0.8,
|
|
101
|
+
ease: 'power4.out',
|
|
102
|
+
stagger: 0.1,
|
|
103
|
+
scrollTrigger: {
|
|
104
|
+
trigger: '.fade-up-group',
|
|
105
|
+
start: 'top 80%',
|
|
106
|
+
},
|
|
107
|
+
});
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
```css
|
|
111
|
+
/* CSS-only Tier 1 fallback */
|
|
112
|
+
.fade-up {
|
|
113
|
+
opacity: 0;
|
|
114
|
+
transform: translateY(40px);
|
|
115
|
+
transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
|
|
116
|
+
}
|
|
117
|
+
.fade-up.is-visible {
|
|
118
|
+
opacity: 1;
|
|
119
|
+
transform: translateY(0);
|
|
120
|
+
}
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
## Reveal Type 2: Scale
|
|
126
|
+
|
|
127
|
+
For images, cards, and high-impact moments. Scale reveals draw the eye.
|
|
128
|
+
Often combined with fade-up for maximum impact.
|
|
129
|
+
|
|
130
|
+
```js
|
|
131
|
+
// Image scale reveal — from slightly smaller, grows to full size
|
|
132
|
+
gsap.from('.scale-reveal', {
|
|
133
|
+
scale: 0.92,
|
|
134
|
+
opacity: 0,
|
|
135
|
+
duration: 1.0,
|
|
136
|
+
ease: 'power4.out',
|
|
137
|
+
scrollTrigger: {
|
|
138
|
+
trigger: '.scale-reveal',
|
|
139
|
+
start: 'top 85%',
|
|
140
|
+
},
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
// Card scale reveal with fade
|
|
144
|
+
gsap.from('.card-scale', {
|
|
145
|
+
scale: 0.85,
|
|
146
|
+
opacity: 0,
|
|
147
|
+
y: 40,
|
|
148
|
+
duration: 0.9,
|
|
149
|
+
ease: 'power4.out',
|
|
150
|
+
stagger: 0.12,
|
|
151
|
+
scrollTrigger: {
|
|
152
|
+
trigger: '.card-grid',
|
|
153
|
+
start: 'top 75%',
|
|
154
|
+
},
|
|
155
|
+
});
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
---
|
|
159
|
+
|
|
160
|
+
## Reveal Type 3: Clip-Path Reveal
|
|
161
|
+
|
|
162
|
+
The most visually striking reveal. Content "wipes in" from a direction.
|
|
163
|
+
Extremely effective for images, hero sections, and full-bleed backgrounds.
|
|
164
|
+
|
|
165
|
+
```js
|
|
166
|
+
// Wipe from left — image reveals left to right
|
|
167
|
+
gsap.from('.clip-left', {
|
|
168
|
+
clipPath: 'inset(0 100% 0 0)', // clipped: fully hidden right side
|
|
169
|
+
duration: 1.0,
|
|
170
|
+
ease: 'power4.out',
|
|
171
|
+
scrollTrigger: {
|
|
172
|
+
trigger: '.clip-left',
|
|
173
|
+
start: 'top 80%',
|
|
174
|
+
},
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
// Wipe from bottom — content reveals upward
|
|
178
|
+
gsap.from('.clip-bottom', {
|
|
179
|
+
clipPath: 'inset(100% 0 0 0)',
|
|
180
|
+
duration: 0.9,
|
|
181
|
+
ease: 'power4.out',
|
|
182
|
+
scrollTrigger: {
|
|
183
|
+
trigger: '.clip-bottom',
|
|
184
|
+
start: 'top 85%',
|
|
185
|
+
},
|
|
186
|
+
});
|
|
187
|
+
|
|
188
|
+
// Circular reveal — hero images, portfolio items
|
|
189
|
+
gsap.from('.clip-circle', {
|
|
190
|
+
clipPath: 'circle(0% at 50% 50%)',
|
|
191
|
+
duration: 1.2,
|
|
192
|
+
ease: 'power3.out',
|
|
193
|
+
scrollTrigger: {
|
|
194
|
+
trigger: '.clip-circle',
|
|
195
|
+
start: 'top 80%',
|
|
196
|
+
},
|
|
197
|
+
});
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
```css
|
|
201
|
+
/* CSS clip-path — simpler variant */
|
|
202
|
+
.clip-text {
|
|
203
|
+
clip-path: inset(0 100% 0 0);
|
|
204
|
+
transition: clip-path 0.8s cubic-bezier(0.16, 1, 0.3, 1);
|
|
205
|
+
}
|
|
206
|
+
.clip-text.is-visible {
|
|
207
|
+
clip-path: inset(0 0% 0 0);
|
|
208
|
+
}
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
**⚠️ DESCENDER SAFETY:** All display text (>48px font-size) using clip-path
|
|
212
|
+
must have `overflow: visible` and `padding-bottom: 0.1em`. See
|
|
213
|
+
`references/text-animation.md` for the full DESCENDER SAFETY PROTOCOL.
|
|
214
|
+
|
|
215
|
+
---
|
|
216
|
+
|
|
217
|
+
## Reveal Type 4: Parallax
|
|
218
|
+
|
|
219
|
+
Parallax creates depth by moving elements at different rates during scroll.
|
|
220
|
+
Use sparingly and purposefully — not for decoration.
|
|
221
|
+
|
|
222
|
+
```js
|
|
223
|
+
// Background image parallax — moves slower than scroll
|
|
224
|
+
gsap.to('.parallax-bg', {
|
|
225
|
+
yPercent: 30,
|
|
226
|
+
ease: 'none',
|
|
227
|
+
scrollTrigger: {
|
|
228
|
+
trigger: '.parallax-section',
|
|
229
|
+
start: 'top bottom',
|
|
230
|
+
end: 'bottom top',
|
|
231
|
+
scrub: true,
|
|
232
|
+
},
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
// Foreground element — moves faster than scroll (subtle)
|
|
236
|
+
gsap.to('.parallax-fore', {
|
|
237
|
+
yPercent: -15,
|
|
238
|
+
ease: 'none',
|
|
239
|
+
scrollTrigger: {
|
|
240
|
+
trigger: '.parallax-section',
|
|
241
|
+
start: 'top top',
|
|
242
|
+
end: 'bottom top',
|
|
243
|
+
scrub: 0.5,
|
|
244
|
+
},
|
|
245
|
+
});
|
|
246
|
+
|
|
247
|
+
// Text parallax — headline moves up as section enters
|
|
248
|
+
gsap.to('.parallax-text', {
|
|
249
|
+
y: -80,
|
|
250
|
+
ease: 'none',
|
|
251
|
+
scrollTrigger: {
|
|
252
|
+
trigger: '.parallax-text',
|
|
253
|
+
start: 'top bottom',
|
|
254
|
+
end: 'bottom top',
|
|
255
|
+
scrub: 1,
|
|
256
|
+
},
|
|
257
|
+
});
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
**Performance note:** Parallax on large images is expensive. Use `will-change: transform`
|
|
261
|
+
on `.parallax-bg` only during the active scroll range. Remove it after:
|
|
262
|
+
```js
|
|
263
|
+
// Add will-change during scrub
|
|
264
|
+
ScrollTrigger.create({
|
|
265
|
+
trigger: '.parallax-bg',
|
|
266
|
+
start: 'top bottom',
|
|
267
|
+
end: 'bottom top',
|
|
268
|
+
onEnter: () => element.style.setProperty('will-change', 'transform'),
|
|
269
|
+
onLeaveBack: () => element.style.removeProperty('will-change'),
|
|
270
|
+
});
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
---
|
|
274
|
+
|
|
275
|
+
## Reveal Type 5: Horizontal Wipe
|
|
276
|
+
|
|
277
|
+
Text or content that wipes horizontally on scroll. Great for section titles,
|
|
278
|
+
lists, or timelines. Requires careful setup to avoid overflow issues.
|
|
279
|
+
|
|
280
|
+
```js
|
|
281
|
+
// Horizontal text wipe — uses clip-path + x translation
|
|
282
|
+
gsap.from('.h-wipe', {
|
|
283
|
+
x: '100%',
|
|
284
|
+
clipPath: 'inset(0 0 0 0)', // already visible
|
|
285
|
+
duration: 0.8,
|
|
286
|
+
ease: 'power4.out',
|
|
287
|
+
scrollTrigger: {
|
|
288
|
+
trigger: '.h-wipe',
|
|
289
|
+
start: 'top 85%',
|
|
290
|
+
},
|
|
291
|
+
});
|
|
292
|
+
|
|
293
|
+
// Cleaner approach: animate a pseudo-element overlay
|
|
294
|
+
gsap.from('.h-wipe-wrapper::after', {
|
|
295
|
+
scaleX: 1,
|
|
296
|
+
transformOrigin: 'right',
|
|
297
|
+
duration: 0.7,
|
|
298
|
+
ease: 'power4.inOut',
|
|
299
|
+
scrollTrigger: {
|
|
300
|
+
trigger: '.h-wipe-wrapper',
|
|
301
|
+
start: 'top 80%',
|
|
302
|
+
},
|
|
303
|
+
});
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
---
|
|
307
|
+
|
|
308
|
+
## Reveal Type 6: Circular Reveal
|
|
309
|
+
|
|
310
|
+
A radial wipe from a specific point. Often used for hero backgrounds,
|
|
311
|
+
portfolio grid items, or modal openings. Creates a premium "focus" effect.
|
|
312
|
+
|
|
313
|
+
```js
|
|
314
|
+
// Circular reveal from center
|
|
315
|
+
gsap.from('.circle-reveal', {
|
|
316
|
+
clipPath: 'circle(0% at 50% 50%)',
|
|
317
|
+
duration: 1.0,
|
|
318
|
+
ease: 'power3.out',
|
|
319
|
+
scrollTrigger: {
|
|
320
|
+
trigger: '.circle-reveal',
|
|
321
|
+
start: 'top 80%',
|
|
322
|
+
},
|
|
323
|
+
});
|
|
324
|
+
|
|
325
|
+
// Circular reveal from corner — great for images
|
|
326
|
+
gsap.from('.circle-corner', {
|
|
327
|
+
clipPath: 'circle(0% at 0% 0%)', // top-left origin
|
|
328
|
+
duration: 1.1,
|
|
329
|
+
ease: 'power4.out',
|
|
330
|
+
scrollTrigger: {
|
|
331
|
+
trigger: '.circle-corner',
|
|
332
|
+
start: 'top 85%',
|
|
333
|
+
},
|
|
334
|
+
});
|
|
335
|
+
|
|
336
|
+
// Staggered circular reveal for grid
|
|
337
|
+
gsap.from('.circle-grid > *', {
|
|
338
|
+
clipPath: 'circle(0% at 50% 50%)',
|
|
339
|
+
duration: 0.8,
|
|
340
|
+
ease: 'power3.out',
|
|
341
|
+
stagger: {
|
|
342
|
+
each: 0.08,
|
|
343
|
+
from: 'random',
|
|
344
|
+
},
|
|
345
|
+
scrollTrigger: {
|
|
346
|
+
trigger: '.circle-grid',
|
|
347
|
+
start: 'top 80%',
|
|
348
|
+
},
|
|
349
|
+
});
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
---
|
|
353
|
+
|
|
354
|
+
## Horizontal Scroll Gallery
|
|
355
|
+
|
|
356
|
+
One of the most impressive scroll interactions. The user scrolls vertically
|
|
357
|
+
but content moves horizontally. Requires careful GSAP ScrollTrigger pin setup.
|
|
358
|
+
|
|
359
|
+
### Core Pattern: Pin + Horizontal Scrub
|
|
360
|
+
|
|
361
|
+
```js
|
|
362
|
+
// Horizontal scroll gallery
|
|
363
|
+
const sections = gsap.utils.toArray('.h-scroll-item');
|
|
364
|
+
|
|
365
|
+
const hScrollTween = gsap.to(sections, {
|
|
366
|
+
xPercent: -100 * (sections.length - 1),
|
|
367
|
+
ease: 'none',
|
|
368
|
+
scrollTrigger: {
|
|
369
|
+
trigger: '.h-scroll-container',
|
|
370
|
+
pin: true,
|
|
371
|
+
scrub: 1,
|
|
372
|
+
start: 'top top',
|
|
373
|
+
end: () => '+=' + (sections.length - 1) * window.innerWidth,
|
|
374
|
+
anticipatePin: 1, // prevents jump on pin
|
|
375
|
+
invalidateOnRefresh: true,
|
|
376
|
+
},
|
|
377
|
+
});
|
|
378
|
+
|
|
379
|
+
// Optional: fade in first and last items as they enter/exit
|
|
380
|
+
gsap.fromTo('.h-scroll-item:first-child',
|
|
381
|
+
{ opacity: 0.5 },
|
|
382
|
+
{
|
|
383
|
+
opacity: 1,
|
|
384
|
+
ease: 'none',
|
|
385
|
+
scrollTrigger: {
|
|
386
|
+
trigger: '.h-scroll-container',
|
|
387
|
+
start: 'top top',
|
|
388
|
+
end: 'top+=10% top',
|
|
389
|
+
scrub: true,
|
|
390
|
+
},
|
|
391
|
+
}
|
|
392
|
+
);
|
|
393
|
+
```
|
|
394
|
+
|
|
395
|
+
```html
|
|
396
|
+
<div class="h-scroll-container">
|
|
397
|
+
<div class="h-scroll-wrapper">
|
|
398
|
+
<section class="h-scroll-item">Slide 1</section>
|
|
399
|
+
<section class="h-scroll-item">Slide 2</section>
|
|
400
|
+
<section class="h-scroll-item">Slide 3</section>
|
|
401
|
+
</div>
|
|
402
|
+
</div>
|
|
403
|
+
```
|
|
404
|
+
|
|
405
|
+
```css
|
|
406
|
+
.h-scroll-container {
|
|
407
|
+
overflow: hidden;
|
|
408
|
+
height: 100vh;
|
|
409
|
+
}
|
|
410
|
+
.h-scroll-wrapper {
|
|
411
|
+
display: flex;
|
|
412
|
+
height: 100%;
|
|
413
|
+
will-change: transform;
|
|
414
|
+
}
|
|
415
|
+
.h-scroll-item {
|
|
416
|
+
flex: 0 0 100vw;
|
|
417
|
+
width: 100vw;
|
|
418
|
+
height: 100%;
|
|
419
|
+
}
|
|
420
|
+
```
|
|
421
|
+
|
|
422
|
+
### Horizontal Gallery with Progress Indicator
|
|
423
|
+
|
|
424
|
+
```js
|
|
425
|
+
// Progress bar during horizontal scroll
|
|
426
|
+
gsap.to('.h-progress-fill', {
|
|
427
|
+
scaleX: 1,
|
|
428
|
+
ease: 'none',
|
|
429
|
+
scrollTrigger: {
|
|
430
|
+
trigger: '.h-scroll-container',
|
|
431
|
+
start: 'top top',
|
|
432
|
+
end: () => '+=' + (sections.length - 1) * window.innerWidth,
|
|
433
|
+
scrub: 0.3,
|
|
434
|
+
},
|
|
435
|
+
});
|
|
436
|
+
```
|
|
437
|
+
|
|
438
|
+
### Cleanup (page transitions)
|
|
439
|
+
|
|
440
|
+
```js
|
|
441
|
+
// Kill horizontal scroll trigger on unmount
|
|
442
|
+
const hScrollTrigger = ScrollTrigger.getAll().find(t =>
|
|
443
|
+
t.vars.trigger?.classList?.contains('h-scroll-container')
|
|
444
|
+
);
|
|
445
|
+
if (hScrollTrigger) hScrollTrigger.kill();
|
|
446
|
+
```
|
|
447
|
+
|
|
448
|
+
---
|
|
449
|
+
|
|
450
|
+
## Staggered Content Reveals
|
|
451
|
+
|
|
452
|
+
Stagger creates rhythm and guides attention through content in sequence.
|
|
453
|
+
Always stagger in a logical order: headline → subhead → body → images → CTAs.
|
|
454
|
+
|
|
455
|
+
### Text + Image Stagger
|
|
456
|
+
|
|
457
|
+
```js
|
|
458
|
+
// Orchestrated reveal: title → subtitle → image → body → CTA
|
|
459
|
+
const tl = gsap.timeline({
|
|
460
|
+
scrollTrigger: {
|
|
461
|
+
trigger: '.stagger-section',
|
|
462
|
+
start: 'top 80%',
|
|
463
|
+
},
|
|
464
|
+
});
|
|
465
|
+
|
|
466
|
+
tl.from('.stagger-title', {
|
|
467
|
+
y: 50,
|
|
468
|
+
opacity: 0,
|
|
469
|
+
duration: 0.8,
|
|
470
|
+
ease: 'power4.out',
|
|
471
|
+
})
|
|
472
|
+
.from('.stagger-subtitle', {
|
|
473
|
+
y: 40,
|
|
474
|
+
opacity: 0,
|
|
475
|
+
duration: 0.6,
|
|
476
|
+
ease: 'power4.out',
|
|
477
|
+
}, '-=0.5') // overlap by 0.5s
|
|
478
|
+
.from('.stagger-image', {
|
|
479
|
+
scale: 0.9,
|
|
480
|
+
opacity: 0,
|
|
481
|
+
duration: 0.9,
|
|
482
|
+
ease: 'power4.out',
|
|
483
|
+
}, '-=0.4')
|
|
484
|
+
.from('.stagger-body', {
|
|
485
|
+
y: 30,
|
|
486
|
+
opacity: 0,
|
|
487
|
+
duration: 0.6,
|
|
488
|
+
ease: 'power4.out',
|
|
489
|
+
}, '-=0.5')
|
|
490
|
+
.from('.stagger-cta', {
|
|
491
|
+
y: 20,
|
|
492
|
+
opacity: 0,
|
|
493
|
+
duration: 0.5,
|
|
494
|
+
ease: 'power4.out',
|
|
495
|
+
}, '-=0.3');
|
|
496
|
+
```
|
|
497
|
+
|
|
498
|
+
### Card Grid Stagger
|
|
499
|
+
|
|
500
|
+
```js
|
|
501
|
+
// Grid stagger — 2D stagger (rows then columns feel)
|
|
502
|
+
gsap.from('.card-grid > *', {
|
|
503
|
+
y: 60,
|
|
504
|
+
opacity: 0,
|
|
505
|
+
duration: 0.7,
|
|
506
|
+
ease: 'power4.out',
|
|
507
|
+
stagger: {
|
|
508
|
+
each: 0.08,
|
|
509
|
+
from: 'start', // 'start' = left-to-right, top-to-bottom
|
|
510
|
+
// 'end' = right-to-left
|
|
511
|
+
// 'random' = chaotic but visually interesting
|
|
512
|
+
// { x: 0, y: 1 } = grid-ordered
|
|
513
|
+
},
|
|
514
|
+
scrollTrigger: {
|
|
515
|
+
trigger: '.card-grid',
|
|
516
|
+
start: 'top 80%',
|
|
517
|
+
},
|
|
518
|
+
});
|
|
519
|
+
```
|
|
520
|
+
|
|
521
|
+
### Image Gallery Stagger
|
|
522
|
+
|
|
523
|
+
```js
|
|
524
|
+
// Masonry/grid image stagger — use from: 'random' for organic feel
|
|
525
|
+
gsap.from('.image-grid img', {
|
|
526
|
+
scale: 0.8,
|
|
527
|
+
opacity: 0,
|
|
528
|
+
duration: 1.0,
|
|
529
|
+
ease: 'power3.out',
|
|
530
|
+
stagger: {
|
|
531
|
+
each: 0.06,
|
|
532
|
+
from: 'random',
|
|
533
|
+
},
|
|
534
|
+
scrollTrigger: {
|
|
535
|
+
trigger: '.image-grid',
|
|
536
|
+
start: 'top 80%',
|
|
537
|
+
},
|
|
538
|
+
});
|
|
539
|
+
```
|
|
540
|
+
|
|
541
|
+
---
|
|
542
|
+
|
|
543
|
+
## Scroll-Velocity Effects
|
|
544
|
+
|
|
545
|
+
Visual responses based on how fast the user scrolls. Creates a sense of
|
|
546
|
+
"weight" and physicality. Use sparingly — these can feel gimmicky.
|
|
547
|
+
|
|
548
|
+
### Speed-Based Scale
|
|
549
|
+
|
|
550
|
+
```js
|
|
551
|
+
// Elements compress slightly during fast scroll
|
|
552
|
+
let lastScrollY = 0;
|
|
553
|
+
let velocity = 0;
|
|
554
|
+
|
|
555
|
+
lenis.on('scroll', ({ scroll, limit, velocity: v }) => {
|
|
556
|
+
velocity = v;
|
|
557
|
+
|
|
558
|
+
// Apply subtle scale based on scroll velocity
|
|
559
|
+
gsap.to('.velocity-scale', {
|
|
560
|
+
scale: 1 - Math.min(Math.abs(velocity) * 0.02, 0.05),
|
|
561
|
+
duration: 0.3,
|
|
562
|
+
overwrite: 'auto',
|
|
563
|
+
});
|
|
564
|
+
});
|
|
565
|
+
```
|
|
566
|
+
|
|
567
|
+
### Directional Parallax Layers
|
|
568
|
+
|
|
569
|
+
```js
|
|
570
|
+
// Multiple layers moving at different speeds based on scroll direction
|
|
571
|
+
// Down scroll: layers move up at different rates
|
|
572
|
+
// Up scroll: layers move down
|
|
573
|
+
|
|
574
|
+
let scrollDir = 1; // 1 = down, -1 = up
|
|
575
|
+
|
|
576
|
+
lenis.on('scroll', ({ scroll, limit, velocity }) => {
|
|
577
|
+
scrollDir = velocity >= 0 ? 1 : -1;
|
|
578
|
+
});
|
|
579
|
+
|
|
580
|
+
const layers = document.querySelectorAll('.parallax-layer');
|
|
581
|
+
layers.forEach((layer, i) => {
|
|
582
|
+
const speed = (i + 1) * 0.05; // each layer slightly faster
|
|
583
|
+
gsap.to(layer, {
|
|
584
|
+
y: () => scrollDir * 100 * speed,
|
|
585
|
+
ease: 'none',
|
|
586
|
+
scrollTrigger: {
|
|
587
|
+
trigger: '.parallax-container',
|
|
588
|
+
start: 'top bottom',
|
|
589
|
+
end: 'bottom top',
|
|
590
|
+
scrub: 0.5,
|
|
591
|
+
},
|
|
592
|
+
});
|
|
593
|
+
});
|
|
594
|
+
```
|
|
595
|
+
|
|
596
|
+
---
|
|
597
|
+
|
|
598
|
+
## Mobile Fallbacks
|
|
599
|
+
|
|
600
|
+
Scroll-heavy animations often need simplified versions on mobile to maintain
|
|
601
|
+
60fps. Implement feature detection, not device detection.
|
|
602
|
+
|
|
603
|
+
### Responsive Scroll Animation Strategy
|
|
604
|
+
|
|
605
|
+
```js
|
|
606
|
+
// Check for reduced-motion AND low-end device
|
|
607
|
+
const isLowEnd = navigator.hardwareConcurrency <= 4 ||
|
|
608
|
+
!window.matchMedia('(min-width: 768px)').matches;
|
|
609
|
+
const prefersReducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
|
|
610
|
+
|
|
611
|
+
if (!prefersReducedMotion && !isLowEnd) {
|
|
612
|
+
// Full scroll animations
|
|
613
|
+
initScrollAnimations();
|
|
614
|
+
} else if (!prefersReducedMotion) {
|
|
615
|
+
// Simplified: only fade-up, no parallax, no horizontal scroll
|
|
616
|
+
initSimplifiedScroll();
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
// Progressive enhancement: load as you go
|
|
620
|
+
function initSimplifiedScroll() {
|
|
621
|
+
gsap.from('.section-reveal', {
|
|
622
|
+
opacity: 0,
|
|
623
|
+
y: 30,
|
|
624
|
+
duration: 0.5,
|
|
625
|
+
ease: 'power2.out',
|
|
626
|
+
scrollTrigger: {
|
|
627
|
+
trigger: '.section-reveal',
|
|
628
|
+
start: 'top 90%',
|
|
629
|
+
once: true,
|
|
630
|
+
},
|
|
631
|
+
});
|
|
632
|
+
}
|
|
633
|
+
```
|
|
634
|
+
|
|
635
|
+
### Mobile-Specific CSS
|
|
636
|
+
|
|
637
|
+
```css
|
|
638
|
+
/* Disable parallax on mobile */
|
|
639
|
+
@media (max-width: 767px) {
|
|
640
|
+
.parallax-bg,
|
|
641
|
+
.parallax-fore {
|
|
642
|
+
transform: none !important;
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
/* Simplify clip-path animations */
|
|
646
|
+
.clip-complex {
|
|
647
|
+
clip-path: none !important;
|
|
648
|
+
}
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
/* Reduced motion — remove all scroll animations */
|
|
652
|
+
@media (prefers-reduced-motion: reduce) {
|
|
653
|
+
.scroll-reveal,
|
|
654
|
+
.parallax-* {
|
|
655
|
+
transform: none !important;
|
|
656
|
+
opacity: 1 !important;
|
|
657
|
+
clip-path: none !important;
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
```
|
|
661
|
+
|
|
662
|
+
### Performance Budget for Mobile
|
|
663
|
+
|
|
664
|
+
- Max 3 simultaneous ScrollTrigger instances on mobile
|
|
665
|
+
- No horizontal scroll galleries on mobile (convert to vertical stack)
|
|
666
|
+
- Images: lazy-load all below-fold images
|
|
667
|
+
- Use `loading="lazy"` and `decoding="async"` on all images
|
|
668
|
+
- Target: <3s LCP on 4G throttle
|