reacthub-pixitweenjs 0.2.10 → 0.2.12

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/dist/index.es.js +3586 -3583
  2. package/dist/index.umd.js +78 -78
  3. package/package.json +4 -1
  4. package/.storybook/main.ts +0 -31
  5. package/.storybook/preview.tsx +0 -26
  6. package/CHANGELOG.md +0 -100
  7. package/build-storybook.log +0 -94
  8. package/index.html +0 -13
  9. package/public/vite.svg +0 -1
  10. package/src/App.css +0 -42
  11. package/src/App.tsx +0 -29
  12. package/src/assets/font/OpenSans-Light-webfont.eot +0 -0
  13. package/src/assets/font/OpenSans-Light-webfont.svg +0 -252
  14. package/src/assets/font/OpenSans-Light-webfont.ttf +0 -0
  15. package/src/assets/font/OpenSans-Light-webfont.woff +0 -0
  16. package/src/assets/font/OpenSans-Regular-webfont.eot +0 -0
  17. package/src/assets/font/OpenSans-Regular-webfont.svg +0 -252
  18. package/src/assets/font/OpenSans-Regular-webfont.ttf +0 -0
  19. package/src/assets/font/OpenSans-Regular-webfont.woff +0 -0
  20. package/src/assets/icon/percolate.eot +0 -0
  21. package/src/assets/icon/percolate.svg +0 -139
  22. package/src/assets/icon/percolate.ttf +0 -0
  23. package/src/assets/icon/percolate.woff +0 -0
  24. package/src/assets/react.svg +0 -1
  25. package/src/components/PixiAnimatedSprite/PixiAnimatedSprite.tsx +0 -51
  26. package/src/components/PixiAnimatedSprite/index.ts +0 -2
  27. package/src/components/PixiAudioSprite/PixiAudioSprite.stories.tsx +0 -61
  28. package/src/components/PixiAudioSprite/PixiAudioSprite.tsx +0 -202
  29. package/src/components/PixiAudioSprite/index.ts +0 -1
  30. package/src/components/PixiGifSprite/PixiGifSprite.stories.tsx +0 -172
  31. package/src/components/PixiGifSprite/PixiGifSprite.tsx +0 -420
  32. package/src/components/PixiGifSprite/index.ts +0 -2
  33. package/src/components/PixiImageSprite/PixiImageSprite.stories.tsx +0 -220
  34. package/src/components/PixiImageSprite/PixiImageSprite.tsx +0 -60
  35. package/src/components/PixiImageSprite/index.ts +0 -1
  36. package/src/components/PixiSVGSprite/PixiSvgPathSprite.stories.tsx +0 -174
  37. package/src/components/PixiSVGSprite/PixiSvgPathSprite.tsx +0 -158
  38. package/src/components/PixiSVGSprite/index.ts +0 -1
  39. package/src/components/PixiTextSprite/PixiTextSprite.stories.tsx +0 -228
  40. package/src/components/PixiTextSprite/PixiTextSprite.tsx +0 -361
  41. package/src/components/PixiTextSprite/index.ts +0 -1
  42. package/src/components/PixiVideoSprite/PixiVideoSprite.stories.tsx +0 -186
  43. package/src/components/PixiVideoSprite/PixiVideoSprite.tsx +0 -595
  44. package/src/components/PixiVideoSprite/PixiVideoSpriteBackup.txt +0 -755
  45. package/src/components/PixiVideoSprite/index.ts +0 -1
  46. package/src/components/index.ts +0 -7
  47. package/src/declare.module.ts +0 -5
  48. package/src/hocs/AbstractContainer.tsx +0 -199
  49. package/src/hocs/WithFilterContainer.tsx +0 -159
  50. package/src/index.css +0 -457
  51. package/src/index.ts +0 -3
  52. package/src/main.tsx +0 -11
  53. package/src/providers/GsapPixieContextProvider.tsx +0 -245
  54. package/src/providers/index.ts +0 -1
  55. package/src/reacthub-react-bindings.d.ts +0 -27
  56. package/src/stories/Installation.mdx +0 -40
  57. package/src/stories/Introduction.mdx +0 -140
  58. package/src/stories/assets/code-brackets.svg +0 -1
  59. package/src/stories/assets/colors.svg +0 -1
  60. package/src/stories/assets/comments.svg +0 -1
  61. package/src/stories/assets/direction.svg +0 -1
  62. package/src/stories/assets/flow.svg +0 -1
  63. package/src/stories/assets/plugin.svg +0 -1
  64. package/src/stories/assets/repo.svg +0 -1
  65. package/src/stories/assets/stackalt.svg +0 -1
  66. package/src/types/Animations.tsx +0 -41
  67. package/src/types/BaseProps.tsx +0 -56
  68. package/src/types/BlendModes.tsx +0 -19
  69. package/src/types/Effects.tsx +0 -11
  70. package/src/types/transformation.tsx +0 -13
  71. package/src/utils/AppStateProvider.tsx +0 -59
  72. package/src/utils/AppStateStage.tsx +0 -15
  73. package/src/utils/AppWrapper.tsx +0 -47
  74. package/src/utils/ContextBridge.tsx +0 -25
  75. package/src/utils/GsapAnim.tsx +0 -107
  76. package/src/utils/InteractionManager.tsx +0 -36
  77. package/src/utils/PixiStage.tsx +0 -29
  78. package/src/utils/PixiTransformer.tsx +0 -165
  79. package/src/utils/VideoSeekBar.tsx +0 -122
  80. package/src/utils/useDebounce.tsx +0 -15
  81. package/src/utils/useDeepEffect.tsx +0 -23
  82. package/src/vite-env.d.ts +0 -1
  83. package/tsconfig.json +0 -37
  84. package/tsconfig.node.json +0 -10
  85. package/vite.config.ts +0 -39
  86. package/vitest.config.ts +0 -11
@@ -1,202 +0,0 @@
1
- import * as React from "react";
2
- import { useContext, useEffect, useRef } from "react";
3
- // @ts-ignore
4
- import PropTypes from "prop-types";
5
- import {
6
- GsapPixieContext,
7
- Events,
8
- } from "../../providers/GsapPixieContextProvider";
9
- import { Container } from "@pixi/react";
10
- import { useCustomEventListener } from "react-custom-events";
11
- import gsap from "gsap";
12
- import { Sound } from "@pixi/sound";
13
- import * as PIXI from "pixi.js";
14
- // @ts-ignore
15
- import isEmpty from "lodash/isEmpty";
16
-
17
- type PixiAudioSpriteProps = {
18
- uniqueId: string;
19
- src: string;
20
- startAt: number;
21
- endAt: number;
22
- mute: boolean;
23
- speed: number;
24
- };
25
- interface AudioState {
26
- isPlaying: boolean;
27
- progress: number;
28
- speed: number;
29
- mute: boolean;
30
- isWaiting: boolean;
31
- loaded: boolean;
32
- size: { width: number; height: number };
33
- isDragging: boolean;
34
- completed?: boolean;
35
- }
36
-
37
- const PixiAudioSprite: React.FC<PixiAudioSpriteProps> = (props) => {
38
- const initialState: AudioState = {
39
- isPlaying: false,
40
- progress: 0,
41
- speed: 1,
42
- mute: false,
43
- isWaiting: false,
44
- loaded: false,
45
- size: { width: 50, height: 50 },
46
- isDragging: false,
47
- };
48
- //// State
49
- const [, setIsMounted] = React.useState(false);
50
-
51
- const audioStateRef = useRef<AudioState>(initialState);
52
-
53
- console.log("allProps", props);
54
- //// Refs
55
- const containerRef = useRef<PIXI.Container>(null);
56
- const imgGroupRef = useRef<PIXI.Container>(null);
57
-
58
- //// Context
59
- //// Context
60
- const { tl, playerTimeRef } = useContext(GsapPixieContext);
61
-
62
- /// 1001
63
- // console.log("contxt Values", tl);
64
- const { uniqueId, src, startAt, endAt, mute, speed } = props;
65
-
66
- const audioContainerRef = React.useRef<Sound>(null);
67
-
68
- /** Adding custom event listners */
69
- /** Event Listeneres */
70
- useCustomEventListener(Events.PAUSE, () => {
71
- console.log("pause event");
72
- if (containerRef.current) {
73
- // @ts-ignore
74
- audioContainerRef.current?.pause();
75
- audioStateRef.current.isPlaying = false;
76
- }
77
- });
78
-
79
- const gsapOnStart = (startAt: number) => {
80
- if (containerRef.current) {
81
- console.log("audio gsapOnStart", startAt);
82
- if (playerTimeRef.current >= startAt && playerTimeRef.current <= endAt) {
83
- // @ts-ignore
84
- audioContainerRef.current?.play({
85
- volume: mute ? 0 : 1,
86
- start: startAt,
87
- end: endAt,
88
- speed: speed || 1,
89
- });
90
- audioStateRef.current.isPlaying = true;
91
- audioStateRef.current.completed = false;
92
- }
93
- }
94
- };
95
-
96
- const gsapOnComplete = () => {
97
- if (containerRef.current) {
98
- console.log("audio gsapOnStart", startAt);
99
- // @ts-ignore
100
- audioContainerRef.current?.stop();
101
- audioStateRef.current.isPlaying = false;
102
- audioStateRef.current.completed = true;
103
- }
104
- };
105
-
106
- const gsapOnUpdate = (startAt: number) => {
107
- if (
108
- containerRef.current &&
109
- !audioStateRef.current.isPlaying &&
110
- !audioStateRef.current.completed
111
- ) {
112
- console.log("audio gsapOnUpdate", startAt);
113
- // @ts-ignore
114
- audioContainerRef.current?.refresh();
115
- // @ts-ignore
116
- audioContainerRef.current?.refreshPaused();
117
-
118
- // @ts-ignore
119
- audioContainerRef.current?.resume();
120
- audioStateRef.current.isPlaying = true;
121
- }
122
- };
123
-
124
- const onInterrupt = () => {};
125
-
126
- useEffect(() => {
127
- let ctx = gsap.context(() => {});
128
- if (containerRef.current && tl.current) {
129
- const data = {
130
- duration: Number(endAt) - Number(startAt),
131
- onStart: gsapOnStart,
132
- onComplete: gsapOnComplete,
133
- onStartParams: [startAt],
134
- onCompleteParams: [],
135
- onInterrupt: onInterrupt,
136
- onUpdate: gsapOnUpdate,
137
- onUpdateParams: [],
138
- };
139
- ctx = gsap.context(() => {
140
- tl.current
141
- .to(containerRef.current, { alpha: 1, duration: 0.01 }, startAt)
142
- .from(imgGroupRef.current, { ...data }, startAt)
143
- .to(
144
- containerRef.current,
145
- { alpha: 0, duration: 0.1 },
146
- Number(endAt) - Number(0.1)
147
- );
148
- });
149
- }
150
- return () => ctx.revert(); // cleanup!
151
- }, [startAt, endAt]);
152
-
153
- React.useEffect(() => {
154
- if (containerRef.current) {
155
- setIsMounted(true);
156
- }
157
- }, []);
158
-
159
- React.useEffect(() => {
160
- if (containerRef.current && audioContainerRef.current) {
161
- console.log("soundref", audioContainerRef.current);
162
- // @ts-ignore
163
- audioStateRef.current.mute = mute;
164
- audioStateRef.current.speed = speed;
165
- console.log("containerAudio", audioContainerRef.current.volume);
166
- audioContainerRef.current.volume = mute ? 0 : 1;
167
- }
168
- }, [mute, speed]);
169
-
170
- const onSoundLoaded = React.useCallback(
171
- (_: any, sound: Sound | undefined) => {
172
- //@ts-ignore
173
- audioContainerRef.current = sound;
174
- audioStateRef.current.loaded = true;
175
- // const instance = sound.play();
176
- },
177
- []
178
- );
179
-
180
- React.useEffect(() => {
181
- if (!isEmpty(src)) {
182
- // @pixi/sound package usage
183
- //@ts-ignore
184
- audioContainerRef.current = Sound.from({
185
- url: src,
186
- preload: true,
187
- singleInstance: true,
188
- loaded: onSoundLoaded,
189
- });
190
- }
191
- return () => {
192
- // app.loader.reset();
193
- };
194
- }, [uniqueId, src, onSoundLoaded]);
195
-
196
- return (
197
- // @ts-ignore
198
- <Container ref={containerRef}></Container>
199
- );
200
- };
201
-
202
- export default PixiAudioSprite;
@@ -1 +0,0 @@
1
- export { default as PixiAudioSprite } from "./PixiAudioSprite";
@@ -1,172 +0,0 @@
1
- import type { Meta, StoryObj } from "@storybook/react";
2
- import { PixiGifSprite } from ".";
3
- import { AppStateContextProvider } from "../../utils/AppStateProvider";
4
-
5
- // More on how to set up stories at: https://storybook.js.org/docs/react/writing-stories/introduction
6
- const meta = {
7
- title: "Components/GifSprite",
8
- component: PixiGifSprite,
9
-
10
- tags: ["autodocs"],
11
- argTypes: {
12
- uniqueId: {
13
- control: "text",
14
- description: "uniqueId of the sprite",
15
- },
16
- src: {
17
- control: "text",
18
- description: "source of the image",
19
- },
20
- transformation: {
21
- control: "object",
22
- description: "transformation of the sprite",
23
- x: { control: "number", description: "x position of the sprite" },
24
- y: { control: "number", description: "y position of the sprite" },
25
- width: { control: "number", description: "width of the sprite" },
26
- height: { control: "number", description: "height of the sprite" },
27
- anchor: { control: "number", description: "anchor of the sprite" },
28
- rotation: { control: "number", description: "rotation of the sprite" },
29
- alpha: {
30
- control: "number",
31
- min: 0,
32
- max: 1,
33
- description: "alpha of the sprite",
34
- },
35
- scale: { control: "number", description: "scale of the sprite" },
36
- tint: { control: "number", description: "tint of the sprite" },
37
- blendMode: { control: "number", description: "blendMode of the sprite" },
38
- colorCorrection: {
39
- control: "object",
40
- description: "colorCorrection of the sprite",
41
- brightness: {
42
- control: "number",
43
- description: "brightness of the sprite",
44
- },
45
- contrast: { control: "number", description: "contrast of the sprite" },
46
- saturation: {
47
- control: "number",
48
- description: "saturation of the sprite",
49
- },
50
- alpha: { control: "number", description: "alpha of the sprite" },
51
- },
52
- },
53
- applyTransformer: { control: "boolean", description: "applyTransformer" },
54
- startAt: { control: "number", description: "startAt" },
55
- endAt: { control: "number", description: "endAt" },
56
- initialAlpha: {
57
- control: "number",
58
- min: 0,
59
- max: 1,
60
- description: "sprite initial alpha value (default 1)",
61
- },
62
- onAnchorTransformationEnd: {
63
- action: "onAnchorTransformationEnd",
64
- description:
65
- "on transforamtion end the event is fire callback with latest sprite transformation properties.",
66
- },
67
- pointerdown: {
68
- action: "pointerdown",
69
- description: "pointerdown event",
70
- },
71
- pointerup: {
72
- action: "pointerup",
73
- description: "pointerup event",
74
- },
75
- mousedown: {
76
- action: "mousedown",
77
- description: "mousedown event",
78
- },
79
- mouseup: {
80
- action: "mouseup",
81
- description: "mouseup event",
82
- },
83
- pointerover: {
84
- action: "pointerover",
85
- description: "pointerover event",
86
- },
87
- mouseover: {
88
- action: "mouseover",
89
- description: "mouseover event",
90
- },
91
- mouseout: {
92
- action: "mouseout",
93
- description: "mouseout event",
94
- },
95
- pointerout: {
96
- action: "pointerout",
97
- description: "pointerout event",
98
- },
99
- },
100
- } satisfies Meta<typeof PixiGifSprite>;
101
-
102
- export default meta;
103
- type Story = StoryObj<typeof meta>;
104
-
105
- // More on writing stories with args: https://storybook.js.org/docs/react/writing-stories/args
106
- export const Normal: Story = {
107
- render: (args: any) => (
108
- <AppStateContextProvider {...args}>
109
- <PixiGifSprite {...args} />
110
- </AppStateContextProvider>
111
- ),
112
- args: {
113
- uniqueId: "suryaGify001", // uniqueId of the sprite
114
- src: "https://media.giphy.com/media/5VKbvrjxpVJCM/giphy.gif",
115
- locked: false,
116
- loop: false,
117
- applyTransformer: false,
118
- startAt: 0,
119
- endAt: 4,
120
- transformation: {
121
- x: 200,
122
- y: 200,
123
- width: 200,
124
- height: 200,
125
- anchor: 0.5,
126
- rotation: 0,
127
- alpha: 1,
128
- scale: 1,
129
- tint: 0xffffff,
130
- blendMode: 0,
131
- colorCorrection: {},
132
- },
133
- initialAlpha: 1,
134
- },
135
- };
136
-
137
- export const Filters: Story = {
138
- render: (args: any) => (
139
- <AppStateContextProvider {...args}>
140
- <PixiGifSprite {...args} />
141
- </AppStateContextProvider>
142
- ),
143
- args: {
144
- uniqueId: "suryaGify001", // uniqueId of the sprite
145
- src: "https://media.giphy.com/media/5VKbvrjxpVJCM/giphy.gif",
146
- locked: false,
147
- loop: false,
148
- applyTransformer: false,
149
- startAt: 0,
150
- endAt: 4,
151
- transformation: {
152
- x: 200,
153
- y: 200,
154
- width: 200,
155
- height: 200,
156
- anchor: 0.5,
157
- rotation: 0,
158
- alpha: 1,
159
- scale: 1,
160
- tint: 0xffffff,
161
- blendMode: 0,
162
- colorCorrection: {
163
- enabled: true,
164
- contrast: 2,
165
- saturation: 2,
166
- exposure: 2,
167
- blurRadius: 1,
168
- },
169
- },
170
- initialAlpha: 1,
171
- },
172
- };