@cosmictraveler002/anim-kit 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.
Files changed (127) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +1033 -0
  3. package/dist/anim-kit.standalone.js +117 -0
  4. package/dist/anim-kit.standalone.js.map +1 -0
  5. package/dist/core/gsap.d.ts +44 -0
  6. package/dist/core/gsap.d.ts.map +1 -0
  7. package/dist/core/gsap.js +71 -0
  8. package/dist/core/gsap.js.map +1 -0
  9. package/dist/core/guard.d.ts +3 -0
  10. package/dist/core/guard.d.ts.map +1 -0
  11. package/dist/core/guard.js +18 -0
  12. package/dist/core/guard.js.map +1 -0
  13. package/dist/core/smooth-scroll.d.ts +45 -0
  14. package/dist/core/smooth-scroll.d.ts.map +1 -0
  15. package/dist/core/smooth-scroll.js +98 -0
  16. package/dist/core/smooth-scroll.js.map +1 -0
  17. package/dist/core/split.d.ts +24 -0
  18. package/dist/core/split.d.ts.map +1 -0
  19. package/dist/core/split.js +117 -0
  20. package/dist/core/split.js.map +1 -0
  21. package/dist/core/types.d.ts +21 -0
  22. package/dist/core/types.d.ts.map +1 -0
  23. package/dist/core/types.js +9 -0
  24. package/dist/core/types.js.map +1 -0
  25. package/dist/core/util.d.ts +19 -0
  26. package/dist/core/util.d.ts.map +1 -0
  27. package/dist/core/util.js +73 -0
  28. package/dist/core/util.js.map +1 -0
  29. package/dist/effects/counter.d.ts +52 -0
  30. package/dist/effects/counter.d.ts.map +1 -0
  31. package/dist/effects/counter.js +106 -0
  32. package/dist/effects/counter.js.map +1 -0
  33. package/dist/effects/cursor-follower.d.ts +19 -0
  34. package/dist/effects/cursor-follower.d.ts.map +1 -0
  35. package/dist/effects/cursor-follower.js +76 -0
  36. package/dist/effects/cursor-follower.js.map +1 -0
  37. package/dist/effects/drag-strip.d.ts +17 -0
  38. package/dist/effects/drag-strip.d.ts.map +1 -0
  39. package/dist/effects/drag-strip.js +186 -0
  40. package/dist/effects/drag-strip.js.map +1 -0
  41. package/dist/effects/hero-shrink.d.ts +15 -0
  42. package/dist/effects/hero-shrink.d.ts.map +1 -0
  43. package/dist/effects/hero-shrink.js +40 -0
  44. package/dist/effects/hero-shrink.js.map +1 -0
  45. package/dist/effects/horizontal-scroll.d.ts +17 -0
  46. package/dist/effects/horizontal-scroll.d.ts.map +1 -0
  47. package/dist/effects/horizontal-scroll.js +87 -0
  48. package/dist/effects/horizontal-scroll.js.map +1 -0
  49. package/dist/effects/line-reveal.d.ts +34 -0
  50. package/dist/effects/line-reveal.d.ts.map +1 -0
  51. package/dist/effects/line-reveal.js +71 -0
  52. package/dist/effects/line-reveal.js.map +1 -0
  53. package/dist/effects/liquid-button.d.ts +19 -0
  54. package/dist/effects/liquid-button.d.ts.map +1 -0
  55. package/dist/effects/liquid-button.js +52 -0
  56. package/dist/effects/liquid-button.js.map +1 -0
  57. package/dist/effects/logo-reveal.d.ts +15 -0
  58. package/dist/effects/logo-reveal.d.ts.map +1 -0
  59. package/dist/effects/logo-reveal.js +49 -0
  60. package/dist/effects/logo-reveal.js.map +1 -0
  61. package/dist/effects/marquee.d.ts +13 -0
  62. package/dist/effects/marquee.d.ts.map +1 -0
  63. package/dist/effects/marquee.js +143 -0
  64. package/dist/effects/marquee.js.map +1 -0
  65. package/dist/effects/mask-reveal.d.ts +36 -0
  66. package/dist/effects/mask-reveal.d.ts.map +1 -0
  67. package/dist/effects/mask-reveal.js +102 -0
  68. package/dist/effects/mask-reveal.js.map +1 -0
  69. package/dist/effects/menu-overlay.d.ts +32 -0
  70. package/dist/effects/menu-overlay.d.ts.map +1 -0
  71. package/dist/effects/menu-overlay.js +150 -0
  72. package/dist/effects/menu-overlay.js.map +1 -0
  73. package/dist/effects/nav-hide.d.ts +13 -0
  74. package/dist/effects/nav-hide.d.ts.map +1 -0
  75. package/dist/effects/nav-hide.js +68 -0
  76. package/dist/effects/nav-hide.js.map +1 -0
  77. package/dist/effects/parallax.d.ts +11 -0
  78. package/dist/effects/parallax.d.ts.map +1 -0
  79. package/dist/effects/parallax.js +48 -0
  80. package/dist/effects/parallax.js.map +1 -0
  81. package/dist/effects/preloader.d.ts +33 -0
  82. package/dist/effects/preloader.d.ts.map +1 -0
  83. package/dist/effects/preloader.js +128 -0
  84. package/dist/effects/preloader.js.map +1 -0
  85. package/dist/effects/scatter-text.d.ts +20 -0
  86. package/dist/effects/scatter-text.d.ts.map +1 -0
  87. package/dist/effects/scatter-text.js +87 -0
  88. package/dist/effects/scatter-text.js.map +1 -0
  89. package/dist/effects/stacked-cards.d.ts +24 -0
  90. package/dist/effects/stacked-cards.d.ts.map +1 -0
  91. package/dist/effects/stacked-cards.js +106 -0
  92. package/dist/effects/stacked-cards.js.map +1 -0
  93. package/dist/effects/theme-reveal.d.ts +35 -0
  94. package/dist/effects/theme-reveal.d.ts.map +1 -0
  95. package/dist/effects/theme-reveal.js +93 -0
  96. package/dist/effects/theme-reveal.js.map +1 -0
  97. package/dist/index.d.ts +77 -0
  98. package/dist/index.d.ts.map +1 -0
  99. package/dist/index.js +61 -0
  100. package/dist/index.js.map +1 -0
  101. package/dist/styles/anim-kit.css +361 -0
  102. package/package.json +80 -0
  103. package/src/core/gsap.ts +79 -0
  104. package/src/core/guard.ts +18 -0
  105. package/src/core/smooth-scroll.ts +143 -0
  106. package/src/core/split.ts +145 -0
  107. package/src/core/types.ts +30 -0
  108. package/src/core/util.ts +79 -0
  109. package/src/effects/counter.ts +192 -0
  110. package/src/effects/cursor-follower.ts +104 -0
  111. package/src/effects/drag-strip.ts +228 -0
  112. package/src/effects/hero-shrink.ts +69 -0
  113. package/src/effects/horizontal-scroll.ts +123 -0
  114. package/src/effects/line-reveal.ts +109 -0
  115. package/src/effects/liquid-button.ts +75 -0
  116. package/src/effects/logo-reveal.ts +76 -0
  117. package/src/effects/marquee.ts +157 -0
  118. package/src/effects/mask-reveal.ts +148 -0
  119. package/src/effects/menu-overlay.ts +218 -0
  120. package/src/effects/nav-hide.ts +90 -0
  121. package/src/effects/parallax.ts +68 -0
  122. package/src/effects/preloader.ts +187 -0
  123. package/src/effects/scatter-text.ts +129 -0
  124. package/src/effects/stacked-cards.ts +154 -0
  125. package/src/effects/theme-reveal.ts +144 -0
  126. package/src/index.ts +98 -0
  127. package/src/styles/anim-kit.css +361 -0
package/src/index.ts ADDED
@@ -0,0 +1,98 @@
1
+ /**
2
+ * anim-kit — modular animation library extracted from dzinrstudio.com.
3
+ *
4
+ * Core:
5
+ * smoothScroll() Lenis + ScrollTrigger bridge (lerp 0.08)
6
+ * initGSAP() registers GSAP plugins + the studio's custom eases
7
+ * split() text splitting with mask support
8
+ *
9
+ * Scroll effects:
10
+ * lineReveal() masked staggered text reveal
11
+ * maskReveal() inline overflow-hidden heading reveal
12
+ * revealRule() line that draws to full width
13
+ * parallax() data-speed parallax
14
+ * horizontalScroll() pinned horizontal gallery
15
+ * stackedCards() / stackedCardsPinned() pinned card deck
16
+ * scatterText() pinned horizontal band with per-char settle
17
+ * heroShrink() media that scales down as it scrolls away
18
+ * navHide() header that hides on scroll-down
19
+ * logoReveal() SVG wordmark assembling letter by letter
20
+ *
21
+ * Infinite / loops:
22
+ * marquee() dual-row constant-speed marquee
23
+ * dragStrip() infinite draggable carousel with rotation
24
+ *
25
+ * Micro-interactions:
26
+ * liquidButton() SVG wave flood on hover
27
+ * underlineLink() underline wipe on hover
28
+ * cursorFollower() spring-follow cursor tag
29
+ * counter() tabular number ticker
30
+ * audioBars() equaliser visualiser
31
+ * themeReveal() View Transitions circular wipe
32
+ * menuOverlay() clip-path curtain menu
33
+ * preloader() 0→100 counter intro
34
+ */
35
+
36
+ /* ---- core ---- */
37
+ export { gsap, ScrollTrigger, SplitText, Draggable, CustomEase, ScrollSmoother, initGSAP, EASES } from "./core/gsap.js";
38
+ export type { SmoothScrollOptions, SmoothScrollHandle } from "./core/smooth-scroll.js";
39
+ export { smoothScroll } from "./core/smooth-scroll.js";
40
+ export { split } from "./core/split.js";
41
+ export type { SplitOptions, SplitResult, SplitType } from "./core/split.js";
42
+ export { guard } from "./core/guard.js";
43
+ export { toArray, one, onReady, compose, raf, prefersReducedMotion } from "./core/util.js";
44
+ export type { TargetLike, Destroy, CommonOptions } from "./core/types.js";
45
+
46
+ /* ---- scroll effects ---- */
47
+ export { lineReveal } from "./effects/line-reveal.js";
48
+ export type { LineRevealOptions } from "./effects/line-reveal.js";
49
+
50
+ export { maskReveal, revealRule } from "./effects/mask-reveal.js";
51
+ export type { MaskRevealOptions } from "./effects/mask-reveal.js";
52
+
53
+ export { parallax } from "./effects/parallax.js";
54
+ export type { ParallaxOptions } from "./effects/parallax.js";
55
+
56
+ export { horizontalScroll } from "./effects/horizontal-scroll.js";
57
+ export type { HorizontalScrollOptions } from "./effects/horizontal-scroll.js";
58
+
59
+ export { stackedCards, stackedCardsPinned } from "./effects/stacked-cards.js";
60
+ export type { StackedCardsOptions } from "./effects/stacked-cards.js";
61
+
62
+ export { scatterText } from "./effects/scatter-text.js";
63
+ export type { ScatterTextOptions } from "./effects/scatter-text.js";
64
+
65
+ export { heroShrink } from "./effects/hero-shrink.js";
66
+ export type { HeroShrinkOptions } from "./effects/hero-shrink.js";
67
+
68
+ export { navHide } from "./effects/nav-hide.js";
69
+ export type { NavHideOptions } from "./effects/nav-hide.js";
70
+
71
+ export { logoReveal } from "./effects/logo-reveal.js";
72
+ export type { LogoRevealOptions } from "./effects/logo-reveal.js";
73
+
74
+ /* ---- loops ---- */
75
+ export { marquee } from "./effects/marquee.js";
76
+ export type { MarqueeOptions } from "./effects/marquee.js";
77
+
78
+ export { dragStrip } from "./effects/drag-strip.js";
79
+ export type { DragStripOptions } from "./effects/drag-strip.js";
80
+
81
+ /* ---- micro-interactions ---- */
82
+ export { liquidButton, underlineLink } from "./effects/liquid-button.js";
83
+ export type { LiquidButtonOptions } from "./effects/liquid-button.js";
84
+
85
+ export { cursorFollower } from "./effects/cursor-follower.js";
86
+ export type { CursorFollowerOptions } from "./effects/cursor-follower.js";
87
+
88
+ export { counter, audioBars } from "./effects/counter.js";
89
+ export type { CounterOptions, AudioBarsOptions, AudioBarsHandle } from "./effects/counter.js";
90
+
91
+ export { themeReveal } from "./effects/theme-reveal.js";
92
+ export type { ThemeRevealOptions, ThemeRevealHandle, ThemeName } from "./effects/theme-reveal.js";
93
+
94
+ export { menuOverlay } from "./effects/menu-overlay.js";
95
+ export type { MenuOverlayOptions, MenuOverlayHandle } from "./effects/menu-overlay.js";
96
+
97
+ export { preloader } from "./effects/preloader.js";
98
+ export type { PreloaderOptions } from "./effects/preloader.js";
@@ -0,0 +1,361 @@
1
+ /**
2
+ * anim-kit — companion stylesheet.
3
+ *
4
+ * Most of the studio's motion is JS-driven, but a handful of effects are pure
5
+ * CSS (liquid button, underline sweep, marquee masks) and every effect needs a
6
+ * resting state that is safe with `prefers-reduced-motion`.
7
+ */
8
+
9
+ /* ------------------------------------------------------------------ */
10
+ /* Design tokens */
11
+ /* ------------------------------------------------------------------ */
12
+
13
+ :root {
14
+ --ak-primary: #6c5ce7;
15
+ --ak-curtain: cubic-bezier(0.76, 0, 0.24, 1);
16
+ --ak-reveal: cubic-bezier(0.165, 0.84, 0.44, 1);
17
+ --ak-out: cubic-bezier(0.4, 0, 0.2, 1);
18
+ }
19
+
20
+ /* ------------------------------------------------------------------ */
21
+ /* Text splitting — masks */
22
+ /* ------------------------------------------------------------------ */
23
+
24
+ /* SplitText / split() output: one mask per line so lines can slide up. */
25
+ .ak-line,
26
+ .ak-line-mask {
27
+ overflow: hidden;
28
+ display: block;
29
+ /* Negate the descender clipping every masked-line setup has to fight. */
30
+ padding-bottom: 0.12em;
31
+ margin-bottom: -0.12em;
32
+ }
33
+
34
+ .ak-line > *,
35
+ .ak-line-mask > * {
36
+ display: block;
37
+ will-change: transform;
38
+ }
39
+
40
+ .ak-char,
41
+ .ak-word {
42
+ display: inline-block;
43
+ will-change: transform;
44
+ }
45
+
46
+ .ak-space {
47
+ display: inline-block;
48
+ white-space: pre;
49
+ }
50
+
51
+ /* ------------------------------------------------------------------ */
52
+ /* Mask reveal (heading lines) */
53
+ /* ------------------------------------------------------------------ */
54
+
55
+ .ak-mask {
56
+ display: block;
57
+ overflow: hidden;
58
+ }
59
+
60
+ .ak-mask__inner {
61
+ display: block;
62
+ will-change: transform;
63
+ }
64
+
65
+ /* ------------------------------------------------------------------ */
66
+ /* Liquid button */
67
+ /* ------------------------------------------------------------------ */
68
+
69
+ .ak-liquid {
70
+ position: relative;
71
+ display: inline-flex;
72
+ align-items: center;
73
+ justify-content: center;
74
+ overflow: hidden;
75
+ isolation: isolate;
76
+ padding: 0.4em 1em;
77
+ border: 0;
78
+ background: var(--ak-foreground, #111);
79
+ color: var(--ak-background, #fff);
80
+ cursor: pointer;
81
+ transition: color 700ms ease-out;
82
+ }
83
+
84
+ .ak-liquid__wave {
85
+ position: absolute;
86
+ left: 50%;
87
+ top: 50%;
88
+ height: 160%;
89
+ width: 160%;
90
+ pointer-events: none;
91
+ transform: translate(-50%, 120%);
92
+ transition-property: transform;
93
+ transition-timing-function: ease-out;
94
+ transition-duration: var(--ak-liquid-duration, 900ms);
95
+ }
96
+
97
+ /* Rising from the bottom → the curved edge peaks on the way up. */
98
+ [data-ak-liquid="up"] .ak-liquid__wave {
99
+ transform: translate(-50%, 120%);
100
+ }
101
+ [data-ak-liquid="up"]:hover .ak-liquid__wave,
102
+ [data-ak-liquid="up"]:focus-visible .ak-liquid__wave {
103
+ transform: translate(-50%, -66.666%);
104
+ }
105
+
106
+ /* Falling in from the top. */
107
+ [data-ak-liquid="down"] .ak-liquid__wave {
108
+ transform: translate(-50%, -120%);
109
+ }
110
+ [data-ak-liquid="down"]:hover .ak-liquid__wave,
111
+ [data-ak-liquid="down"]:focus-visible .ak-liquid__wave {
112
+ transform: translate(-50%, -66.666%);
113
+ }
114
+
115
+ .ak-liquid__wave path {
116
+ fill: var(--ak-liquid-fill, var(--ak-primary));
117
+ }
118
+
119
+ .ak-liquid:hover,
120
+ .ak-liquid:focus-visible {
121
+ color: var(--ak-liquid-label, #fff);
122
+ }
123
+
124
+ .ak-liquid__label {
125
+ position: relative;
126
+ z-index: 10;
127
+ display: inline-flex;
128
+ align-items: center;
129
+ gap: 0.5em;
130
+ white-space: nowrap;
131
+ }
132
+
133
+ /* ------------------------------------------------------------------ */
134
+ /* Underline sweep */
135
+ /* ------------------------------------------------------------------ */
136
+
137
+ .ak-underline {
138
+ position: relative;
139
+ display: inline-block;
140
+ cursor: pointer;
141
+ }
142
+
143
+ .ak-underline::after {
144
+ content: "";
145
+ position: absolute;
146
+ bottom: 0;
147
+ left: 0;
148
+ height: 1px;
149
+ width: 0;
150
+ background: currentColor;
151
+ transition: width 300ms var(--ak-out);
152
+ }
153
+
154
+ .ak-underline:hover::after,
155
+ .ak-underline:focus-visible::after {
156
+ width: 100%;
157
+ }
158
+
159
+ /* ------------------------------------------------------------------ */
160
+ /* Marquee */
161
+ /* ------------------------------------------------------------------ */
162
+
163
+ .ak-marquee {
164
+ position: relative;
165
+ overflow: hidden;
166
+ width: 100%;
167
+ }
168
+
169
+ .ak-marquee__viewport {
170
+ overflow: hidden;
171
+ }
172
+
173
+ .ak-marquee__track {
174
+ display: flex;
175
+ width: max-content;
176
+ will-change: transform;
177
+ backface-visibility: hidden;
178
+ }
179
+
180
+ /* Fade the first/last 10vw into the page background. */
181
+ .ak-marquee::before,
182
+ .ak-marquee::after {
183
+ content: "";
184
+ position: absolute;
185
+ top: 0;
186
+ bottom: 0;
187
+ width: 10vw;
188
+ z-index: 2;
189
+ pointer-events: none;
190
+ }
191
+ .ak-marquee::before {
192
+ left: 0;
193
+ background: linear-gradient(to right, var(--ak-background, #fff) 0%, transparent 100%);
194
+ }
195
+ .ak-marquee::after {
196
+ right: 0;
197
+ background: linear-gradient(to left, var(--ak-background, #fff) 0%, transparent 100%);
198
+ }
199
+
200
+ /* ------------------------------------------------------------------ */
201
+ /* Drag strip */
202
+ /* ------------------------------------------------------------------ */
203
+
204
+ .ak-drag-track {
205
+ display: flex;
206
+ gap: 1rem;
207
+ width: max-content;
208
+ cursor: grab;
209
+ user-select: none;
210
+ touch-action: pan-y;
211
+ will-change: transform;
212
+ }
213
+ .ak-drag-track:active {
214
+ cursor: grabbing;
215
+ }
216
+ .ak-drag-track > * {
217
+ transform-origin: 50% 100%;
218
+ will-change: transform;
219
+ }
220
+
221
+ /* ------------------------------------------------------------------ */
222
+ /* Menu overlay */
223
+ /* ------------------------------------------------------------------ */
224
+
225
+ .menu-overlay {
226
+ position: fixed;
227
+ inset: 0;
228
+ width: 100vw;
229
+ height: 100svh;
230
+ display: flex;
231
+ align-items: center;
232
+ justify-content: flex-start;
233
+ background: var(--ak-primary);
234
+ z-index: 9999;
235
+ pointer-events: none;
236
+ will-change: clip-path;
237
+ /* Matches the collapsed-at-bottom resting state JS sets first. */
238
+ clip-path: polygon(0 100%, 100% 100%, 100% 100%, 0 100%);
239
+ }
240
+
241
+ .menu-overlay-bar {
242
+ position: fixed;
243
+ top: 0;
244
+ left: 0;
245
+ display: flex;
246
+ align-items: center;
247
+ justify-content: space-between;
248
+ width: 100vw;
249
+ padding: 20px;
250
+ }
251
+
252
+ .menu-link {
253
+ overflow: hidden;
254
+ padding-left: 20px;
255
+ }
256
+
257
+ .menu-overlay .menu-link h1,
258
+ .menu-overlay .menu-link a {
259
+ display: block;
260
+ text-transform: uppercase;
261
+ font-size: 5vw;
262
+ font-weight: 400;
263
+ line-height: 0.9;
264
+ will-change: transform;
265
+ }
266
+
267
+ @media (max-width: 767px) {
268
+ .menu-overlay .menu-link h1,
269
+ .menu-overlay .menu-link a {
270
+ font-size: 16vw;
271
+ }
272
+ }
273
+
274
+ /* ------------------------------------------------------------------ */
275
+ /* Stacked cards */
276
+ /* ------------------------------------------------------------------ */
277
+
278
+ .ak-stack-viewport {
279
+ position: sticky;
280
+ top: 0;
281
+ height: 100vh;
282
+ display: flex;
283
+ align-items: center;
284
+ justify-content: center;
285
+ overflow: hidden;
286
+ }
287
+
288
+ .ak-stack-cards {
289
+ display: flex;
290
+ gap: 1rem;
291
+ height: 100vh;
292
+ width: 100%;
293
+ align-items: center;
294
+ justify-content: center;
295
+ }
296
+
297
+ .ak-card {
298
+ will-change: transform;
299
+ }
300
+
301
+ /* ------------------------------------------------------------------ */
302
+ /* Counter */
303
+ /* ------------------------------------------------------------------ */
304
+
305
+ .ak-counter {
306
+ font-variant-numeric: tabular-nums;
307
+ font-feature-settings: "tnum" 1;
308
+ }
309
+
310
+ /* ------------------------------------------------------------------ */
311
+ /* Equaliser */
312
+ /* ------------------------------------------------------------------ */
313
+
314
+ .ak-eq {
315
+ display: flex;
316
+ align-items: center;
317
+ gap: 0.25rem;
318
+ height: 18px;
319
+ width: 100%;
320
+ }
321
+
322
+ .ak-eq > * {
323
+ width: 1px;
324
+ height: 4px;
325
+ border-radius: 999px;
326
+ background: currentColor;
327
+ }
328
+
329
+ /* ------------------------------------------------------------------ */
330
+ /* Reduced motion — show final states, never animate */
331
+ /* ------------------------------------------------------------------ */
332
+
333
+ @media (prefers-reduced-motion: reduce) {
334
+ .ak-line,
335
+ .ak-line-mask,
336
+ .ak-mask {
337
+ overflow: visible;
338
+ }
339
+
340
+ .ak-liquid__wave,
341
+ .ak-underline::after,
342
+ .ak-marquee__track,
343
+ .ak-drag-track,
344
+ .ak-card,
345
+ .menu-overlay {
346
+ transition: none !important;
347
+ animation: none !important;
348
+ }
349
+
350
+ .ak-liquid__wave {
351
+ transform: translate(-50%, 120%) !important;
352
+ }
353
+
354
+ [data-ak-liquid]:hover .ak-liquid__wave {
355
+ transform: translate(-50%, -66.666%) !important;
356
+ }
357
+
358
+ .menu-overlay {
359
+ display: none;
360
+ }
361
+ }