reacthub-pixitweenjs 0.2.9 → 0.2.11

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 (86) hide show
  1. package/package.json +4 -1
  2. package/.storybook/main.ts +0 -31
  3. package/.storybook/preview.tsx +0 -26
  4. package/CHANGELOG.md +0 -98
  5. package/build-storybook.log +0 -94
  6. package/index.html +0 -13
  7. package/public/vite.svg +0 -1
  8. package/src/App.css +0 -42
  9. package/src/App.tsx +0 -29
  10. package/src/assets/font/OpenSans-Light-webfont.eot +0 -0
  11. package/src/assets/font/OpenSans-Light-webfont.svg +0 -252
  12. package/src/assets/font/OpenSans-Light-webfont.ttf +0 -0
  13. package/src/assets/font/OpenSans-Light-webfont.woff +0 -0
  14. package/src/assets/font/OpenSans-Regular-webfont.eot +0 -0
  15. package/src/assets/font/OpenSans-Regular-webfont.svg +0 -252
  16. package/src/assets/font/OpenSans-Regular-webfont.ttf +0 -0
  17. package/src/assets/font/OpenSans-Regular-webfont.woff +0 -0
  18. package/src/assets/icon/percolate.eot +0 -0
  19. package/src/assets/icon/percolate.svg +0 -139
  20. package/src/assets/icon/percolate.ttf +0 -0
  21. package/src/assets/icon/percolate.woff +0 -0
  22. package/src/assets/react.svg +0 -1
  23. package/src/components/PixiAnimatedSprite/PixiAnimatedSprite.tsx +0 -51
  24. package/src/components/PixiAnimatedSprite/index.ts +0 -2
  25. package/src/components/PixiAudioSprite/PixiAudioSprite.stories.tsx +0 -61
  26. package/src/components/PixiAudioSprite/PixiAudioSprite.tsx +0 -202
  27. package/src/components/PixiAudioSprite/index.ts +0 -1
  28. package/src/components/PixiGifSprite/PixiGifSprite.stories.tsx +0 -172
  29. package/src/components/PixiGifSprite/PixiGifSprite.tsx +0 -420
  30. package/src/components/PixiGifSprite/index.ts +0 -2
  31. package/src/components/PixiImageSprite/PixiImageSprite.stories.tsx +0 -220
  32. package/src/components/PixiImageSprite/PixiImageSprite.tsx +0 -60
  33. package/src/components/PixiImageSprite/index.ts +0 -1
  34. package/src/components/PixiSVGSprite/PixiSvgPathSprite.stories.tsx +0 -174
  35. package/src/components/PixiSVGSprite/PixiSvgPathSprite.tsx +0 -158
  36. package/src/components/PixiSVGSprite/index.ts +0 -1
  37. package/src/components/PixiTextSprite/PixiTextSprite.stories.tsx +0 -228
  38. package/src/components/PixiTextSprite/PixiTextSprite.tsx +0 -361
  39. package/src/components/PixiTextSprite/index.ts +0 -1
  40. package/src/components/PixiVideoSprite/PixiVideoSprite.stories.tsx +0 -186
  41. package/src/components/PixiVideoSprite/PixiVideoSprite.tsx +0 -595
  42. package/src/components/PixiVideoSprite/PixiVideoSpriteBackup.txt +0 -755
  43. package/src/components/PixiVideoSprite/index.ts +0 -1
  44. package/src/components/index.ts +0 -7
  45. package/src/declare.module.ts +0 -5
  46. package/src/hocs/AbstractContainer.tsx +0 -199
  47. package/src/hocs/WithFilterContainer.tsx +0 -159
  48. package/src/index.css +0 -457
  49. package/src/index.ts +0 -3
  50. package/src/main.tsx +0 -11
  51. package/src/providers/GsapPixieContextProvider.tsx +0 -245
  52. package/src/providers/index.ts +0 -1
  53. package/src/reacthub-react-bindings.d.ts +0 -27
  54. package/src/stories/Installation.mdx +0 -40
  55. package/src/stories/Introduction.mdx +0 -140
  56. package/src/stories/assets/code-brackets.svg +0 -1
  57. package/src/stories/assets/colors.svg +0 -1
  58. package/src/stories/assets/comments.svg +0 -1
  59. package/src/stories/assets/direction.svg +0 -1
  60. package/src/stories/assets/flow.svg +0 -1
  61. package/src/stories/assets/plugin.svg +0 -1
  62. package/src/stories/assets/repo.svg +0 -1
  63. package/src/stories/assets/stackalt.svg +0 -1
  64. package/src/types/Animations.tsx +0 -41
  65. package/src/types/BaseProps.tsx +0 -56
  66. package/src/types/BlendModes.tsx +0 -19
  67. package/src/types/Effects.tsx +0 -11
  68. package/src/types/transformation.tsx +0 -13
  69. package/src/utils/AppStateProvider.tsx +0 -59
  70. package/src/utils/AppStateStage.tsx +0 -15
  71. package/src/utils/AppWrapper.tsx +0 -47
  72. package/src/utils/ContextBridge.tsx +0 -25
  73. package/src/utils/GsapAnim.tsx +0 -107
  74. package/src/utils/InteractionManager.tsx +0 -36
  75. package/src/utils/PixiStage.tsx +0 -29
  76. package/src/utils/PixiTransformer.tsx +0 -165
  77. package/src/utils/VideoSeekBar.tsx +0 -122
  78. package/src/utils/useDebounce.tsx +0 -15
  79. package/src/utils/useDeepEffect.tsx +0 -23
  80. package/src/vite-env.d.ts +0 -1
  81. package/tsconfig.json +0 -37
  82. package/tsconfig.node.json +0 -10
  83. package/vite.config.ts +0 -39
  84. package/vitest.config.ts +0 -11
  85. /package/dist/{reacthub-pixitweenjs.es.js → index.es.js} +0 -0
  86. /package/dist/{reacthub-pixitweenjs.umd.js → index.umd.js} +0 -0
package/src/index.css DELETED
@@ -1,457 +0,0 @@
1
- * {
2
- box-sizing: border-box;
3
- -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
4
- -webkit-tap-highlight-color: transparent;
5
- }
6
-
7
- html,
8
- body {
9
- margin: 0;
10
- padding: 0;
11
- font-size: 100%;
12
- outline: none;
13
- font-family: "Nunito Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
14
- font-style: 400;
15
- color: #333;
16
- font-size: 16px;
17
- background-color: #26c6da;
18
- -webkit-text-size-adjust: 100%;
19
- -ms-text-size-adjust: 100%;
20
- -webkit-font-smoothing: antialiased;
21
- -moz-osx-font-smoothing: grayscale;
22
- }
23
-
24
- h1,
25
- p,
26
- label {
27
- margin: 0;
28
- padding: 0;
29
- border: 0;
30
- font-weight: normal;
31
- font-style: normal;
32
- font-size: 100%;
33
- line-height: 1;
34
- font-family: inherit;
35
- vertical-align: baseline;
36
- line-height: normal;
37
- font-family: "Nunito Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
38
- }
39
-
40
- button::-moz-focus-inner,
41
- input::-moz-focus-inner {
42
- border: 0;
43
- padding: 0;
44
- }
45
-
46
- button,
47
- input[type="button"],
48
- input[type="reset"],
49
- input[type="submit"] {
50
- cursor: pointer;
51
- }
52
-
53
- @keyframes spin {
54
- 0% {
55
- transform: rotate(0deg);
56
- }
57
-
58
- 100% {
59
- transform: rotate(359deg);
60
- }
61
- }
62
-
63
- @keyframes glow {
64
- 0%,
65
- 100% {
66
- opacity: 1;
67
- }
68
-
69
- 50% {
70
- opacity: 0.5;
71
- }
72
- }
73
-
74
- @font-face {
75
- font-family: "Nunito Sans";
76
- font-style: italic;
77
- font-weight: 400;
78
- src: url(https://fonts.gstatic.com/s/nunitosans/v6/pe0oMImSLYBIv1o4X1M8cce4E9lKcw.ttf)
79
- format("truetype");
80
- }
81
-
82
- @font-face {
83
- font-family: "Nunito Sans";
84
- font-style: normal;
85
- font-weight: 400;
86
- src: url(https://fonts.gstatic.com/s/nunitosans/v6/pe0qMImSLYBIv1o4X1M8cce9I94.ttf)
87
- format("truetype");
88
- }
89
-
90
- @font-face {
91
- font-family: "Nunito Sans";
92
- font-style: normal;
93
- font-weight: 800;
94
- src: url(https://fonts.gstatic.com/s/nunitosans/v6/pe03MImSLYBIv1o4X1M8cc8aBc5tU1Q.ttf)
95
- format("truetype");
96
- }
97
-
98
- .type-light {
99
- font-family: "Nunito Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
100
- font-weight: 300;
101
- }
102
-
103
- .type-bold {
104
- font-family: "Nunito Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
105
- font-weight: 800;
106
- }
107
-
108
- .type-italic {
109
- font-family: "Nunito Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
110
- font-weight: 400;
111
- font-style: italic;
112
- }
113
-
114
- input[type="text"],
115
- input[type="email"],
116
- input[type="password"],
117
- textarea {
118
- font-size: 14px;
119
- line-height: 20px;
120
- font-family: "Nunito Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
121
- font-style: 400;
122
- padding: 0.75rem 0;
123
- line-height: 1.5rem !important;
124
- border: none;
125
- border-radius: 0;
126
- box-sizing: border-box;
127
- color: #333;
128
- outline: none;
129
- }
130
-
131
- .checkbox {
132
- display: inline-block;
133
- height: 3rem;
134
- position: relative;
135
- vertical-align: middle;
136
- width: 44px;
137
- }
138
-
139
- .checkbox input[type="checkbox"] {
140
- font-size: 1em;
141
- visibility: hidden;
142
- }
143
-
144
- .checkbox input[type="checkbox"] + span:before {
145
- position: absolute;
146
- top: 50%;
147
- right: auto;
148
- bottom: auto;
149
- left: 50%;
150
- width: 0.85em;
151
- height: 0.85em;
152
- transform: translate3d(-50%, -50%, 0);
153
- background: transparent;
154
- box-shadow: #2cc5d2 0 0 0 1px inset;
155
- content: "";
156
- display: block;
157
- }
158
-
159
- .checkbox input[type="checkbox"]:checked + span:before {
160
- font-size: 16px;
161
- line-height: 24px;
162
- box-shadow: none;
163
- color: #2cc5d2;
164
- margin-top: -1px;
165
- font-family: "percolate";
166
- font-style: normal;
167
- font-weight: normal;
168
- font-variant: normal;
169
- text-transform: none;
170
- line-height: 1;
171
-
172
- content: "\e65e";
173
- }
174
-
175
- .input-symbol {
176
- display: inline-block;
177
- position: relative;
178
- }
179
-
180
- .input-symbol.error [class^="icon-"],
181
- .input-symbol.error [class*=" icon-"] {
182
- color: #ff4400;
183
- }
184
-
185
- .input-symbol [class^="icon-"],
186
- .input-symbol [class*=" icon-"] {
187
- left: 1em;
188
- }
189
-
190
- .input-symbol input {
191
- padding-left: 3em;
192
- }
193
-
194
- .input-symbol input {
195
- width: 100%;
196
- }
197
-
198
- .input-symbol input:focus + [class^="icon-"],
199
- .input-symbol input:focus + [class*=" icon-"] {
200
- color: #2cc5d2;
201
- }
202
-
203
- .input-symbol [class^="icon-"],
204
- .input-symbol [class*=" icon-"] {
205
- transition: all 300ms ease-in;
206
- transform: translate3d(0, -50%, 0);
207
- background: transparent;
208
- color: #aaa;
209
- font-size: 1em;
210
- height: 1em;
211
- position: absolute;
212
- top: 50%;
213
- width: 1em;
214
- }
215
-
216
- @font-face {
217
- font-family: "percolate";
218
- src: url("./assets/icon/percolate.eot?-5w3um4");
219
- src: url("./assets/icon/percolate.eot?#iefix5w3um4")
220
- format("embedded-opentype"),
221
- url("./assets/icon/percolate.woff?5w3um4") format("woff"),
222
- url("./assets/icon/percolate.ttf?5w3um4") format("truetype"),
223
- url("./assets/icon/percolate.svg?5w3um4") format("svg");
224
- font-weight: normal;
225
- font-style: normal;
226
- }
227
-
228
- [class^="icon-"],
229
- [class*=" icon-"] {
230
- font-family: "percolate";
231
-
232
- font-style: normal;
233
- font-weight: normal;
234
- font-variant: normal;
235
- text-transform: none;
236
- line-height: 1;
237
- }
238
-
239
- .icon-star:before {
240
- content: "\e608";
241
- }
242
-
243
- .icon-face-sad:before {
244
- content: "\e60f";
245
- }
246
-
247
- .icon-check:before {
248
- content: "\e65e";
249
- }
250
-
251
- .list-heading {
252
- letter-spacing: 0.3em;
253
- text-indent: 0.3em;
254
- text-transform: uppercase;
255
- font-family: "Nunito Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
256
- font-weight: 800;
257
- font-size: 11px;
258
- padding-left: 15px;
259
- line-height: 40px;
260
- background: #f8f8f8;
261
- color: #aaa;
262
- }
263
-
264
- .list-heading .icon-sync {
265
- opacity: 1;
266
- animation: spin 2s infinite linear;
267
- display: inline-block;
268
- margin-right: 4px;
269
- }
270
-
271
- .list-item {
272
- font-size: 14px;
273
- line-height: 20px;
274
- display: flex;
275
- flex-wrap: wrap;
276
- height: 3rem;
277
- width: 100%;
278
- background: white;
279
- transition: all ease-out 150ms;
280
- }
281
-
282
- .list-item .title {
283
- overflow: hidden;
284
- text-overflow: ellipsis;
285
- white-space: nowrap;
286
- flex: 1;
287
- }
288
-
289
- .list-item input[type="text"] {
290
- background: transparent;
291
- width: 100%;
292
- }
293
-
294
- .list-item input[type="text"]:focus {
295
- cursor: text;
296
- }
297
-
298
- .pin-button {
299
- width: 3rem;
300
- height: 3rem;
301
- background: transparent;
302
- border: none;
303
- text-align: center;
304
- transition: all 200ms ease-in;
305
- color: #eee;
306
- font-size: 16px;
307
- line-height: 3rem;
308
- outline: none;
309
- }
310
-
311
- .pin-button:hover {
312
- color: #2cc5d2;
313
- }
314
- .pin-button:focus {
315
- outline-color: transparent;
316
- }
317
-
318
- .pin-button:active {
319
- color: #555;
320
- }
321
-
322
- .list-item.TASK_PINNED .icon-star {
323
- color: #2cc5d2;
324
- }
325
-
326
- .list-item.TASK_ARCHIVED input[type="text"] {
327
- color: #a0aec0;
328
- text-decoration: line-through;
329
- }
330
-
331
- .list-item:hover {
332
- background-image: linear-gradient(to bottom, #e5f9f7 0%, #f0fffd 100%);
333
- }
334
-
335
- .list-item:hover .checkbox {
336
- cursor: pointer;
337
- }
338
-
339
- .list-item + .list-item {
340
- border-top: 1px solid #f0f9fb;
341
- }
342
-
343
- .list-item.checked input[type="text"] {
344
- color: #ccc;
345
- text-decoration: line-through;
346
- }
347
-
348
- .list-item.checked .delete-item {
349
- display: inline-block;
350
- }
351
-
352
- .loading-item {
353
- height: 3rem;
354
- width: 100%;
355
- background: white;
356
- display: flex;
357
- align-items: center;
358
- line-height: 1rem;
359
- padding-left: 16px;
360
- }
361
-
362
- .loading-item .glow-checkbox,
363
- .loading-item .glow-text span {
364
- animation: glow 1.5s ease-in-out infinite;
365
- background: #eee;
366
- color: transparent;
367
- cursor: progress;
368
- display: inline-block;
369
- }
370
-
371
- .loading-item .glow-checkbox {
372
- margin-right: 16px;
373
- width: 12px;
374
- height: 12px;
375
- }
376
-
377
- .loading-item + .loading-item {
378
- border-top: 1px solid #f0f9fb;
379
- }
380
-
381
- .list-items {
382
- position: relative;
383
- background: white;
384
- min-height: 288px;
385
- }
386
-
387
- .list-items .select-placeholder {
388
- border: none;
389
- width: 48px;
390
- }
391
-
392
- .wrapper-message {
393
- position: absolute;
394
- top: 45%;
395
- right: 0;
396
- bottom: auto;
397
- left: 0;
398
- width: auto;
399
- height: auto;
400
- transform: translate3d(0, -50%, 0);
401
- text-align: center;
402
- }
403
-
404
- .wrapper-message [class^="icon-"],
405
- .wrapper-message [class*=" icon-"] {
406
- font-size: 48px;
407
- line-height: 56px;
408
- color: #2cc5d2;
409
- display: block;
410
- }
411
-
412
- .wrapper-message .title-message {
413
- font-size: 16px;
414
- line-height: 24px;
415
- font-family: "Nunito Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
416
- font-weight: 800;
417
- color: #4a5568;
418
- }
419
-
420
- .wrapper-message .subtitle-message {
421
- font-size: 14px;
422
- line-height: 20px;
423
- color: #4a5568;
424
- }
425
-
426
- .page.lists-show {
427
- min-height: 100vh;
428
- background: white;
429
- }
430
-
431
- .page.lists-show nav {
432
- background: #d3edf4;
433
- padding: 1.5rem 1.25rem;
434
- text-align: center;
435
- }
436
-
437
- @media screen and (min-width: 40em) {
438
- .page.lists-show nav {
439
- text-align: left;
440
- }
441
- }
442
-
443
- .page.lists-show nav .title-page {
444
- font-size: 20px;
445
- line-height: 24px;
446
- line-height: 2rem;
447
- cursor: pointer;
448
- white-space: nowrap;
449
- font-family: "Nunito Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
450
- overflow: hidden;
451
- text-overflow: ellipsis;
452
- font-weight: 800;
453
- color: #1c3f53;
454
- display: inline-block;
455
- vertical-align: top;
456
- max-width: 100%;
457
- }
package/src/index.ts DELETED
@@ -1,3 +0,0 @@
1
- export * from "./components";
2
- // Path: src\index.js
3
- export * from "./providers";
package/src/main.tsx DELETED
@@ -1,11 +0,0 @@
1
- import * as React from "react";
2
- import * as ReactDOM from "react-dom/client";
3
- import App from "./App";
4
- import "./index.css";
5
-
6
- // @ts-ignore
7
- ReactDOM.createRoot(document.getElementById("root")).render(
8
- <React.StrictMode>
9
- <App />
10
- </React.StrictMode>
11
- );
@@ -1,245 +0,0 @@
1
- import * as React from "react";
2
- import {
3
- useState,
4
- useEffect,
5
- useCallback,
6
- useRef,
7
- useLayoutEffect,
8
- } from "react";
9
- import gsap from "gsap";
10
- import { emitCustomEvent, useCustomEventListener } from "react-custom-events";
11
- import { useDebounce } from "../utils/useDebounce";
12
-
13
- interface GsapPixieContextProps {
14
- gsapCtx: React.MutableRefObject<any>;
15
- tl: React.MutableRefObject<any>;
16
- play: boolean;
17
- isDragging: boolean;
18
- handlePlay: () => void;
19
- handlePause: () => void;
20
- handleReset: () => void;
21
- handleSeek: (value: number) => void;
22
- handleSeekTest: () => void;
23
- handleRestart: () => void;
24
- handleRepeat: () => void;
25
- playerTimeRef: React.MutableRefObject<number>;
26
- totalDuration: number;
27
- }
28
-
29
- // Context has been created
30
- // @ts-ignore
31
- const GsapPixieContext = React.createContext<GsapPixieContextProps>({});
32
-
33
- const Events = {
34
- STOP: "GSAP_STOP",
35
- PAUSE: "GSAP_PAUSE",
36
- PLAY: "GSAP_PLAY",
37
- RESUME: "GSAP_RESUME",
38
- RESTART: "GSAP_RESTART",
39
- REPEAT: "GSAP_REPEAT",
40
- SEEK: "GSAP_SEEK",
41
- RESET: "GSAP_RESET",
42
- DRAGGING_START: "GSAP_DRAGGING_START",
43
- DRAGGING_END: "GSAP_DRAGGING_END",
44
- };
45
-
46
- // Provider
47
- const GsapPixieContextProvider: React.FC<{ children: React.ReactNode }> = ({
48
- children,
49
- }) => {
50
- const [play, setPlay] = useState<boolean>(false);
51
- const [isDragging, setIsDragging] = useState<boolean>(false);
52
- const [internalDuration, setInternalDuration] = useState<number>(0);
53
- const [totalDuration, setTotalDuration] = useState<number>(0);
54
- const delayedDuration = useDebounce(internalDuration, 600);
55
-
56
- const tl = useRef<any>();
57
- const gsapCtx = useRef<any>();
58
- const playerTimeRef = useRef<number>(0.001);
59
-
60
- // const parentElementRef = useRef<any>();
61
- // передаем предка анимируемых элементов
62
- // const q = gsap.utils.selector(parentElementRef);
63
-
64
- useLayoutEffect(() => {
65
- gsapCtx.current = gsap.context(() => {
66
- // add a box and circle animation to our timeline and play on first render
67
- // console.log("creating timeline");
68
- tl.current && tl.current.progress(0).kill();
69
- tl.current = gsap.timeline({
70
- paused: true,
71
- defaults: { duration: 0 },
72
- });
73
- });
74
- return () => gsapCtx.current.revert();
75
- }, []);
76
-
77
- gsap.ticker.add(() => {
78
- // console.log("timeframe", time, deltaTime, frame);
79
- // setFrameNumber(frame);
80
- if (tl.current && getTimelineDuration) {
81
- setInternalDuration(getTimelineDuration());
82
- }
83
- });
84
-
85
- const onUpdate = useCallback(() => {
86
- /// console.log("update event callback");
87
- const timeline = tl.current;
88
- let now = timeline.time();
89
- // let elapsedTime;
90
- // if (playerTimeRef.current) {
91
- // elapsedTime = now - playerTimeRef.current;
92
- // }
93
- // console.log(`elapseTime :${elapsedTime} and frame: ${frameNumber}`);
94
- //time = now;
95
- playerTimeRef.current = now;
96
- }, []);
97
-
98
- // set the total duration based on the delayed duration value
99
- useEffect(() => {
100
- setTotalDuration(delayedDuration);
101
- }, [delayedDuration]);
102
-
103
- useEffect(() => {
104
- const timeline = tl.current;
105
- timeline
106
- .eventCallback("onStart", function () {
107
- // console.log("onstart", timeline.progress());
108
- // setPlay(true);
109
- // onUpdate();
110
- })
111
- .eventCallback("onInterrupt", function () {
112
- /// console.log("onInterrupt", timeline.progress());
113
- setPlay(false);
114
- onUpdate();
115
- })
116
- .eventCallback("onUpdate", function () {
117
- /// console.log("onupdate", timeline.progress());
118
- onUpdate();
119
- })
120
- // .eventCallback("onRepeat", function () {
121
- // /// console.log("onrepeat", timeline.progress());
122
- // onUpdate();
123
- // })
124
- // .eventCallback("onReverseComplete", function () {
125
- // /// console.log("onReverseComplete", timeline.progress());
126
- // onUpdate();
127
- // })
128
- // write a pause event
129
- .eventCallback("onPause", function () {
130
- console.log("onPause", timeline.progress());
131
- setPlay(false);
132
- onUpdate();
133
- })
134
- .eventCallback("onResume", function () {
135
- console.log("onResume", timeline.progress());
136
- setPlay(true);
137
- onUpdate();
138
- })
139
- .eventCallback("onComplete", function () {
140
- timeline.seek(0);
141
- timeline.pause();
142
- setPlay(false);
143
- onUpdate();
144
- });
145
- }, []);
146
-
147
- useEffect(() => {
148
- const timeline = tl.current;
149
- if (!play) {
150
- timeline.pause();
151
- } else {
152
- timeline.resume();
153
- }
154
- }, [play]);
155
-
156
- const handleReset = useCallback(() => {
157
- const timeline = tl.current;
158
-
159
- timeline.revert();
160
- }, []);
161
-
162
- const handleRestart = useCallback(() => {
163
- const timeline = tl.current;
164
- timeline.restart();
165
- setPlay(true);
166
- }, []);
167
-
168
- const handleRepeat = useCallback(() => {
169
- const timeline = tl.current;
170
- timeline.repeat(1);
171
- timeline.restart();
172
- // setPlay(true);
173
- }, []);
174
-
175
- const handleSeek = useCallback((value: number) => {
176
- const timeline = tl.current;
177
- timeline.seek(value);
178
- }, []);
179
-
180
- const handleSeekTest = useCallback(() => {
181
- const timeline = tl.current;
182
- timeline.seek(4);
183
- }, []);
184
-
185
- // const setTimelineDuration = useCallback(() => {
186
- // const timeline = tl.current;
187
- // timeline.totalDuration(3);
188
- // }, []);
189
-
190
- const getTimelineDuration = useCallback(() => {
191
- const timeline = tl.current;
192
- if (!timeline) return 0;
193
- return timeline.totalDuration();
194
- }, []);
195
-
196
- const handlePause = () => {
197
- const timeline = tl.current;
198
- timeline.pause();
199
- emitCustomEvent(Events.PAUSE);
200
- setPlay(false);
201
- };
202
-
203
- const handlePlay = () => {
204
- const timeline = tl.current;
205
- setPlay(true);
206
- timeline.resume();
207
- emitCustomEvent(Events.RESUME);
208
- };
209
-
210
- /** Event listener dragging */
211
- useCustomEventListener(Events.DRAGGING_START, () => {
212
- console.log("dragging start");
213
- setIsDragging(true);
214
- });
215
-
216
- useCustomEventListener(Events.DRAGGING_END, () => {
217
- setIsDragging(false);
218
- console.log("dragging end");
219
- });
220
-
221
- console.log("set play updated", play);
222
- return (
223
- <GsapPixieContext.Provider
224
- value={{
225
- gsapCtx,
226
- tl,
227
- handlePlay,
228
- handlePause,
229
- handleReset,
230
- handleSeek,
231
- handleSeekTest,
232
- handleRestart,
233
- handleRepeat,
234
- playerTimeRef,
235
- play,
236
- totalDuration,
237
- isDragging,
238
- }}
239
- >
240
- {children}
241
- </GsapPixieContext.Provider>
242
- );
243
- };
244
-
245
- export { GsapPixieContext, GsapPixieContextProvider, Events };
@@ -1 +0,0 @@
1
- export * from "./GsapPixieContextProvider";