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.
- package/package.json +4 -1
- package/.storybook/main.ts +0 -31
- package/.storybook/preview.tsx +0 -26
- package/CHANGELOG.md +0 -98
- package/build-storybook.log +0 -94
- package/index.html +0 -13
- package/public/vite.svg +0 -1
- package/src/App.css +0 -42
- package/src/App.tsx +0 -29
- package/src/assets/font/OpenSans-Light-webfont.eot +0 -0
- package/src/assets/font/OpenSans-Light-webfont.svg +0 -252
- package/src/assets/font/OpenSans-Light-webfont.ttf +0 -0
- package/src/assets/font/OpenSans-Light-webfont.woff +0 -0
- package/src/assets/font/OpenSans-Regular-webfont.eot +0 -0
- package/src/assets/font/OpenSans-Regular-webfont.svg +0 -252
- package/src/assets/font/OpenSans-Regular-webfont.ttf +0 -0
- package/src/assets/font/OpenSans-Regular-webfont.woff +0 -0
- package/src/assets/icon/percolate.eot +0 -0
- package/src/assets/icon/percolate.svg +0 -139
- package/src/assets/icon/percolate.ttf +0 -0
- package/src/assets/icon/percolate.woff +0 -0
- package/src/assets/react.svg +0 -1
- package/src/components/PixiAnimatedSprite/PixiAnimatedSprite.tsx +0 -51
- package/src/components/PixiAnimatedSprite/index.ts +0 -2
- package/src/components/PixiAudioSprite/PixiAudioSprite.stories.tsx +0 -61
- package/src/components/PixiAudioSprite/PixiAudioSprite.tsx +0 -202
- package/src/components/PixiAudioSprite/index.ts +0 -1
- package/src/components/PixiGifSprite/PixiGifSprite.stories.tsx +0 -172
- package/src/components/PixiGifSprite/PixiGifSprite.tsx +0 -420
- package/src/components/PixiGifSprite/index.ts +0 -2
- package/src/components/PixiImageSprite/PixiImageSprite.stories.tsx +0 -220
- package/src/components/PixiImageSprite/PixiImageSprite.tsx +0 -60
- package/src/components/PixiImageSprite/index.ts +0 -1
- package/src/components/PixiSVGSprite/PixiSvgPathSprite.stories.tsx +0 -174
- package/src/components/PixiSVGSprite/PixiSvgPathSprite.tsx +0 -158
- package/src/components/PixiSVGSprite/index.ts +0 -1
- package/src/components/PixiTextSprite/PixiTextSprite.stories.tsx +0 -228
- package/src/components/PixiTextSprite/PixiTextSprite.tsx +0 -361
- package/src/components/PixiTextSprite/index.ts +0 -1
- package/src/components/PixiVideoSprite/PixiVideoSprite.stories.tsx +0 -186
- package/src/components/PixiVideoSprite/PixiVideoSprite.tsx +0 -595
- package/src/components/PixiVideoSprite/PixiVideoSpriteBackup.txt +0 -755
- package/src/components/PixiVideoSprite/index.ts +0 -1
- package/src/components/index.ts +0 -7
- package/src/declare.module.ts +0 -5
- package/src/hocs/AbstractContainer.tsx +0 -199
- package/src/hocs/WithFilterContainer.tsx +0 -159
- package/src/index.css +0 -457
- package/src/index.ts +0 -3
- package/src/main.tsx +0 -11
- package/src/providers/GsapPixieContextProvider.tsx +0 -245
- package/src/providers/index.ts +0 -1
- package/src/reacthub-react-bindings.d.ts +0 -27
- package/src/stories/Installation.mdx +0 -40
- package/src/stories/Introduction.mdx +0 -140
- package/src/stories/assets/code-brackets.svg +0 -1
- package/src/stories/assets/colors.svg +0 -1
- package/src/stories/assets/comments.svg +0 -1
- package/src/stories/assets/direction.svg +0 -1
- package/src/stories/assets/flow.svg +0 -1
- package/src/stories/assets/plugin.svg +0 -1
- package/src/stories/assets/repo.svg +0 -1
- package/src/stories/assets/stackalt.svg +0 -1
- package/src/types/Animations.tsx +0 -41
- package/src/types/BaseProps.tsx +0 -56
- package/src/types/BlendModes.tsx +0 -19
- package/src/types/Effects.tsx +0 -11
- package/src/types/transformation.tsx +0 -13
- package/src/utils/AppStateProvider.tsx +0 -59
- package/src/utils/AppStateStage.tsx +0 -15
- package/src/utils/AppWrapper.tsx +0 -47
- package/src/utils/ContextBridge.tsx +0 -25
- package/src/utils/GsapAnim.tsx +0 -107
- package/src/utils/InteractionManager.tsx +0 -36
- package/src/utils/PixiStage.tsx +0 -29
- package/src/utils/PixiTransformer.tsx +0 -165
- package/src/utils/VideoSeekBar.tsx +0 -122
- package/src/utils/useDebounce.tsx +0 -15
- package/src/utils/useDeepEffect.tsx +0 -23
- package/src/vite-env.d.ts +0 -1
- package/tsconfig.json +0 -37
- package/tsconfig.node.json +0 -10
- package/vite.config.ts +0 -39
- package/vitest.config.ts +0 -11
- /package/dist/{reacthub-pixitweenjs.es.js → index.es.js} +0 -0
- /package/dist/{reacthub-pixitweenjs.umd.js → index.umd.js} +0 -0
|
@@ -1,361 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { useRef, useState } from "react";
|
|
3
|
-
import { Container, Text } from "@pixi/react";
|
|
4
|
-
import * as PIXI from "pixi.js";
|
|
5
|
-
import Quill from "quill";
|
|
6
|
-
import "quill/dist/quill.snow.css";
|
|
7
|
-
// @ts-ignore
|
|
8
|
-
import isEmpty from "lodash/isEmpty";
|
|
9
|
-
// @ts-ignore
|
|
10
|
-
import isEqual from "lodash/isEqual";
|
|
11
|
-
// @ts-ignore
|
|
12
|
-
import pick from "lodash/pick";
|
|
13
|
-
import { PixiBaseSpriteProps } from "../../types/BaseProps";
|
|
14
|
-
import AbstractContainer from "../../hocs/AbstractContainer";
|
|
15
|
-
import { Effects } from "../../types/Effects";
|
|
16
|
-
|
|
17
|
-
interface PixiTextSpriteProps extends PixiBaseSpriteProps {
|
|
18
|
-
text: string;
|
|
19
|
-
startAt: number;
|
|
20
|
-
endAt: number;
|
|
21
|
-
initialAlpha: number;
|
|
22
|
-
locked: boolean;
|
|
23
|
-
transformation: {
|
|
24
|
-
x: number;
|
|
25
|
-
y: number;
|
|
26
|
-
width: number;
|
|
27
|
-
height: number;
|
|
28
|
-
anchor: number;
|
|
29
|
-
rotation?: number;
|
|
30
|
-
alpha?: number;
|
|
31
|
-
scale?: number | [number, number];
|
|
32
|
-
tint?: number;
|
|
33
|
-
blendMode?: number;
|
|
34
|
-
animation?: string;
|
|
35
|
-
fontWeight?: string;
|
|
36
|
-
fontSize?: number;
|
|
37
|
-
fontFamily?: string;
|
|
38
|
-
fontStyle?: string;
|
|
39
|
-
fontColor?: string;
|
|
40
|
-
fontVariant?: string;
|
|
41
|
-
lineHeight?: number;
|
|
42
|
-
letterSpacing?: number;
|
|
43
|
-
textDecoration?: string;
|
|
44
|
-
wordWrap?: boolean;
|
|
45
|
-
wordWrapWidth?: number;
|
|
46
|
-
leading?: number;
|
|
47
|
-
padding?: number;
|
|
48
|
-
border?: string;
|
|
49
|
-
dropShadow?: boolean;
|
|
50
|
-
dropShadowColor?: string | number;
|
|
51
|
-
shadowOffsetX?: number;
|
|
52
|
-
shadowOffsetY?: number;
|
|
53
|
-
dropShadowBlur?: number;
|
|
54
|
-
blurEnabled?: boolean;
|
|
55
|
-
blurRadius?: number;
|
|
56
|
-
fill: string | number;
|
|
57
|
-
stroke?: string | number;
|
|
58
|
-
strokeThickness?: number;
|
|
59
|
-
zIndex?: number;
|
|
60
|
-
align?: string;
|
|
61
|
-
textBaseline?: string;
|
|
62
|
-
trim?: boolean;
|
|
63
|
-
|
|
64
|
-
colorCorrection?: {
|
|
65
|
-
enabled?: boolean;
|
|
66
|
-
temperature?: number;
|
|
67
|
-
hue?: number;
|
|
68
|
-
contrast?: number;
|
|
69
|
-
saturation?: number;
|
|
70
|
-
exposure?: number;
|
|
71
|
-
reset?: boolean;
|
|
72
|
-
sharpness?: number;
|
|
73
|
-
value?: number;
|
|
74
|
-
levels?: number;
|
|
75
|
-
luminance?: number;
|
|
76
|
-
enhance?: number;
|
|
77
|
-
blurRadius?: number;
|
|
78
|
-
red?: number;
|
|
79
|
-
green?: number;
|
|
80
|
-
blue?: number;
|
|
81
|
-
alpha?: number;
|
|
82
|
-
scaleInput?: number;
|
|
83
|
-
};
|
|
84
|
-
effect?: Effects;
|
|
85
|
-
};
|
|
86
|
-
pointerdown?: () => void;
|
|
87
|
-
pointerup?: () => void;
|
|
88
|
-
mousedown?: () => void;
|
|
89
|
-
mouseup?: () => void;
|
|
90
|
-
pointerover?: () => void;
|
|
91
|
-
mouseover?: () => void;
|
|
92
|
-
mouseout?: () => void;
|
|
93
|
-
applyTransformer?: boolean;
|
|
94
|
-
onTextUpdate?: (data: any) => void;
|
|
95
|
-
onAnchorTransformationEnd?: (endData: any) => void;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
const PixiTextSprite: React.FC<PixiTextSpriteProps> = (props) => {
|
|
99
|
-
//// State
|
|
100
|
-
const [isEditing, setIsEditing] = useState(false);
|
|
101
|
-
|
|
102
|
-
console.log("allProps", props);
|
|
103
|
-
//// Refs
|
|
104
|
-
const parentNode = useRef<PIXI.Container>(null);
|
|
105
|
-
|
|
106
|
-
/// refs
|
|
107
|
-
const textRef = useRef<PIXI.Text>(null);
|
|
108
|
-
const textInputGroupRef = useRef(null);
|
|
109
|
-
const textInnerGroupRef = useRef(null);
|
|
110
|
-
const textFontSize = useRef<number>(16);
|
|
111
|
-
const textTransformDetailRef = useRef<any>(null);
|
|
112
|
-
|
|
113
|
-
/// 1001
|
|
114
|
-
// console.log("contxt Values", tl);
|
|
115
|
-
const {
|
|
116
|
-
uniqueId,
|
|
117
|
-
text,
|
|
118
|
-
locked,
|
|
119
|
-
transformation,
|
|
120
|
-
onTextUpdate,
|
|
121
|
-
pointerdown,
|
|
122
|
-
pointerup,
|
|
123
|
-
mousedown,
|
|
124
|
-
mouseup,
|
|
125
|
-
pointerover,
|
|
126
|
-
mouseover,
|
|
127
|
-
mouseout,
|
|
128
|
-
} = props;
|
|
129
|
-
|
|
130
|
-
const {
|
|
131
|
-
scale = [1, 1],
|
|
132
|
-
x,
|
|
133
|
-
y,
|
|
134
|
-
rotation = 1,
|
|
135
|
-
/// font
|
|
136
|
-
fontFamily = "Arial",
|
|
137
|
-
fontWeight = "normal",
|
|
138
|
-
fontStyle = "normal",
|
|
139
|
-
fontSize = 16,
|
|
140
|
-
|
|
141
|
-
// fill
|
|
142
|
-
fill = "black",
|
|
143
|
-
|
|
144
|
-
// stroke
|
|
145
|
-
stroke,
|
|
146
|
-
strokeThickness: strokeWidth,
|
|
147
|
-
// drop shadow
|
|
148
|
-
blurRadius = 0,
|
|
149
|
-
blurEnabled = false,
|
|
150
|
-
dropShadowColor: shadowColor = null,
|
|
151
|
-
|
|
152
|
-
// multiline
|
|
153
|
-
wordWrapWidth = 50000000,
|
|
154
|
-
leading = 0,
|
|
155
|
-
letterSpacing,
|
|
156
|
-
} = transformation;
|
|
157
|
-
|
|
158
|
-
React.useEffect(() => {
|
|
159
|
-
textFontSize.current = Number(fontSize);
|
|
160
|
-
}, [fontSize]);
|
|
161
|
-
|
|
162
|
-
const nFontStyle = ["italic", "oblique"].includes(fontStyle)
|
|
163
|
-
? fontStyle
|
|
164
|
-
: undefined;
|
|
165
|
-
|
|
166
|
-
const nFontWeight = ["bold", "lighter", "100", "200", "300"].includes(
|
|
167
|
-
fontWeight
|
|
168
|
-
)
|
|
169
|
-
? fontWeight
|
|
170
|
-
: undefined;
|
|
171
|
-
|
|
172
|
-
const nLetterSpacing = Number(letterSpacing) > 0 ? letterSpacing : undefined;
|
|
173
|
-
|
|
174
|
-
const pixiStyles = React.useMemo(() => {
|
|
175
|
-
return new PIXI.TextStyle({
|
|
176
|
-
fontFamily: fontFamily,
|
|
177
|
-
fontSize: fontSize,
|
|
178
|
-
fill: fill || "white", //[color, '#00ff99'], // gradient
|
|
179
|
-
stroke: stroke,
|
|
180
|
-
strokeThickness: strokeWidth,
|
|
181
|
-
...(nFontStyle && {
|
|
182
|
-
fontStyle: nFontStyle as unknown as PIXI.TextStyleFontStyle,
|
|
183
|
-
}),
|
|
184
|
-
...(nFontWeight && {
|
|
185
|
-
fontWeight: nFontWeight as unknown as PIXI.TextStyleFontWeight,
|
|
186
|
-
}),
|
|
187
|
-
...(nLetterSpacing && { letterSpacing: nLetterSpacing }),
|
|
188
|
-
...(blurEnabled && {
|
|
189
|
-
dropShadow: true,
|
|
190
|
-
dropShadowBlur: Number(blurRadius),
|
|
191
|
-
dropShadowColor: shadowColor?.toString() || "black",
|
|
192
|
-
// / dropShadowAngle: Math.PI / 6,
|
|
193
|
-
dropShadowDistance: 0,
|
|
194
|
-
}),
|
|
195
|
-
wordWrap: true,
|
|
196
|
-
breakWords: true,
|
|
197
|
-
wordWrapWidth: wordWrapWidth || 500,
|
|
198
|
-
leading: leading || 0,
|
|
199
|
-
// lineHeight: lineHeight,
|
|
200
|
-
});
|
|
201
|
-
}, [
|
|
202
|
-
blurEnabled,
|
|
203
|
-
blurRadius,
|
|
204
|
-
fill,
|
|
205
|
-
fontFamily,
|
|
206
|
-
fontSize,
|
|
207
|
-
leading,
|
|
208
|
-
nFontStyle,
|
|
209
|
-
nFontWeight,
|
|
210
|
-
nLetterSpacing,
|
|
211
|
-
shadowColor,
|
|
212
|
-
stroke,
|
|
213
|
-
strokeWidth,
|
|
214
|
-
wordWrapWidth,
|
|
215
|
-
]);
|
|
216
|
-
|
|
217
|
-
// let textMetrics = {};
|
|
218
|
-
// if (!isEmpty(text) && !isEmpty(pixiStyles)) {
|
|
219
|
-
// textMetrics = PIXI.TextMetrics.measureText(text, pixiStyles);
|
|
220
|
-
// }
|
|
221
|
-
|
|
222
|
-
// On transformation change, update the textTransformDetailRef
|
|
223
|
-
React.useEffect(() => {
|
|
224
|
-
textTransformDetailRef.current = {
|
|
225
|
-
...transformation,
|
|
226
|
-
};
|
|
227
|
-
}, [transformation]);
|
|
228
|
-
|
|
229
|
-
// @ts-ignore
|
|
230
|
-
const handleOnDoubleClickEditText = () => {
|
|
231
|
-
console.log("double click triggered");
|
|
232
|
-
setIsEditing(true);
|
|
233
|
-
};
|
|
234
|
-
|
|
235
|
-
const handleTextChange = (e: string) => {
|
|
236
|
-
if (onTextUpdate) {
|
|
237
|
-
onTextUpdate({
|
|
238
|
-
text: e,
|
|
239
|
-
uniqueId: uniqueId,
|
|
240
|
-
droptype: "titles",
|
|
241
|
-
});
|
|
242
|
-
}
|
|
243
|
-
};
|
|
244
|
-
|
|
245
|
-
// const handleOnMoveOver = (interactionData) => {
|
|
246
|
-
// if (!isDragging) {
|
|
247
|
-
// setMouseOverSprite(true);
|
|
248
|
-
// }
|
|
249
|
-
// };
|
|
250
|
-
|
|
251
|
-
// const handleOnMoveOut = () => {
|
|
252
|
-
// if (!isDragging) {
|
|
253
|
-
// setMouseOverSprite(false);
|
|
254
|
-
// }
|
|
255
|
-
// };
|
|
256
|
-
|
|
257
|
-
React.useEffect(() => {
|
|
258
|
-
if (isEditing && textInputGroupRef.current) {
|
|
259
|
-
let el = document.getElementById("note-editor");
|
|
260
|
-
if (el) {
|
|
261
|
-
el.style.position = "absolute";
|
|
262
|
-
el.style.zIndex = "10";
|
|
263
|
-
el.style.left = x + "px";
|
|
264
|
-
el.style.top = y + "px";
|
|
265
|
-
el.style.backgroundColor = "var(--chakra-color-darkShark)";
|
|
266
|
-
el.style.transform = "scale(1.5)";
|
|
267
|
-
el.style.width = 300 + "px";
|
|
268
|
-
el.style.height = 100 + "px";
|
|
269
|
-
el.style.color = "#fff";
|
|
270
|
-
el.style.fontSize = "20px";
|
|
271
|
-
el.style.border = "1px solid #CBCEE0";
|
|
272
|
-
|
|
273
|
-
const keyboardbindings = {
|
|
274
|
-
// This will overwrite the default binding also named 'tab'
|
|
275
|
-
esc: {
|
|
276
|
-
key: 27,
|
|
277
|
-
handler: function () {
|
|
278
|
-
setIsEditing(false);
|
|
279
|
-
/// onUnSelectKeyFrame();
|
|
280
|
-
},
|
|
281
|
-
},
|
|
282
|
-
enter: {
|
|
283
|
-
key: 13,
|
|
284
|
-
handler: function () {
|
|
285
|
-
setIsEditing(false);
|
|
286
|
-
/// onUnSelectKeyFrame();
|
|
287
|
-
},
|
|
288
|
-
},
|
|
289
|
-
};
|
|
290
|
-
|
|
291
|
-
var quill = new Quill("#note-editor", {
|
|
292
|
-
modules: {
|
|
293
|
-
toolbar: false,
|
|
294
|
-
keyboard: {
|
|
295
|
-
bindings: {
|
|
296
|
-
...keyboardbindings,
|
|
297
|
-
},
|
|
298
|
-
},
|
|
299
|
-
},
|
|
300
|
-
placeholder: "Compose your text here...",
|
|
301
|
-
theme: "snow", // or 'bubble'
|
|
302
|
-
});
|
|
303
|
-
|
|
304
|
-
quill.on("text-change", function () {
|
|
305
|
-
handleTextChange(quill.root.innerText);
|
|
306
|
-
});
|
|
307
|
-
|
|
308
|
-
quill.setText(text);
|
|
309
|
-
quill.focus();
|
|
310
|
-
quill.off("text-change", () => {
|
|
311
|
-
console.log("removed");
|
|
312
|
-
});
|
|
313
|
-
if (!quill.hasFocus()) {
|
|
314
|
-
el.style.display = "none";
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
}, [x, y, isEditing]);
|
|
319
|
-
|
|
320
|
-
return (
|
|
321
|
-
<AbstractContainer {...props}>
|
|
322
|
-
<Container ref={parentNode}>
|
|
323
|
-
{/* @ts-ignore */}
|
|
324
|
-
{isEditing && <Container ref={textInputGroupRef}></Container>}
|
|
325
|
-
{/* @ts-ignore */}
|
|
326
|
-
<Container alpha={isEditing ? 0 : 1} ref={textInnerGroupRef}>
|
|
327
|
-
<Text
|
|
328
|
-
style={pixiStyles}
|
|
329
|
-
x={x}
|
|
330
|
-
y={y}
|
|
331
|
-
rotation={rotation}
|
|
332
|
-
anchor={0.5}
|
|
333
|
-
text={text}
|
|
334
|
-
{...(!isEditing &&
|
|
335
|
-
!locked && {
|
|
336
|
-
interactive: true,
|
|
337
|
-
buttonMode: true,
|
|
338
|
-
pointerdown: pointerdown,
|
|
339
|
-
pointerout: mouseout,
|
|
340
|
-
pointerover: pointerover,
|
|
341
|
-
pointerup: pointerup,
|
|
342
|
-
mousedown: mousedown,
|
|
343
|
-
mouseup: mouseup,
|
|
344
|
-
mouseover: mouseover,
|
|
345
|
-
})}
|
|
346
|
-
ref={textRef}
|
|
347
|
-
scale={scale}
|
|
348
|
-
/>
|
|
349
|
-
</Container>
|
|
350
|
-
</Container>
|
|
351
|
-
</AbstractContainer>
|
|
352
|
-
);
|
|
353
|
-
};
|
|
354
|
-
|
|
355
|
-
export default PixiTextSprite;
|
|
356
|
-
|
|
357
|
-
// @ts-ignore
|
|
358
|
-
// PixiTextSprite.whyDidYouRender = {
|
|
359
|
-
// logOnDifferentValues: true,
|
|
360
|
-
// customName: "PixiTextSprite",
|
|
361
|
-
// };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as PixiTextSprite } from "./PixiTextSprite";
|
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
-
import { PixiVideoSprite } 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/VideoSprite",
|
|
8
|
-
component: PixiVideoSprite,
|
|
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
|
-
frameStartAt: { control: "number", description: "frameStartAt" },
|
|
57
|
-
frameEndAt: { control: "number", description: "frameEndAt" },
|
|
58
|
-
mute: { control: "boolean", description: "mute" },
|
|
59
|
-
locked: { control: "boolean", description: "locked" },
|
|
60
|
-
initialAlpha: {
|
|
61
|
-
control: "number",
|
|
62
|
-
min: 0,
|
|
63
|
-
max: 1,
|
|
64
|
-
description: "sprite initial alpha value (default 1)",
|
|
65
|
-
},
|
|
66
|
-
onAnchorTransformationEnd: {
|
|
67
|
-
action: "onAnchorTransformationEnd",
|
|
68
|
-
description:
|
|
69
|
-
"on transforamtion end the event is fire callback with latest sprite transformation properties.",
|
|
70
|
-
},
|
|
71
|
-
pointerdown: {
|
|
72
|
-
action: "pointerdown",
|
|
73
|
-
description: "pointerdown event",
|
|
74
|
-
},
|
|
75
|
-
},
|
|
76
|
-
} satisfies Meta<typeof PixiVideoSprite>;
|
|
77
|
-
|
|
78
|
-
export default meta;
|
|
79
|
-
type Story = StoryObj<typeof meta>;
|
|
80
|
-
|
|
81
|
-
// More on writing stories with args: https://storybook.js.org/docs/react/writing-stories/args
|
|
82
|
-
export const Normal: Story = {
|
|
83
|
-
render: (args: any) => (
|
|
84
|
-
<AppStateContextProvider {...args}>
|
|
85
|
-
<PixiVideoSprite {...args} />
|
|
86
|
-
</AppStateContextProvider>
|
|
87
|
-
),
|
|
88
|
-
args: {
|
|
89
|
-
uniqueId: "oceanv1", // uniqueId of the sprite
|
|
90
|
-
src: "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerBlazes.mp4",
|
|
91
|
-
transformation: {
|
|
92
|
-
x: 290,
|
|
93
|
-
y: 250,
|
|
94
|
-
width: 550,
|
|
95
|
-
height: 400,
|
|
96
|
-
anchor: 0.5,
|
|
97
|
-
rotation: 0,
|
|
98
|
-
alpha: 1,
|
|
99
|
-
scale: 1,
|
|
100
|
-
tint: 0xffffff,
|
|
101
|
-
blendMode: 0,
|
|
102
|
-
colorCorrection: {},
|
|
103
|
-
},
|
|
104
|
-
applyTransformer: false,
|
|
105
|
-
startAt: 0,
|
|
106
|
-
endAt: 10,
|
|
107
|
-
frameStartAt: 0,
|
|
108
|
-
frameEndAt: 10,
|
|
109
|
-
initialAlpha: 1,
|
|
110
|
-
mute: false,
|
|
111
|
-
locked: false,
|
|
112
|
-
},
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
export const FadeIn: Story = {
|
|
116
|
-
render: (args: any) => (
|
|
117
|
-
<AppStateContextProvider {...args}>
|
|
118
|
-
<PixiVideoSprite {...args} />
|
|
119
|
-
</AppStateContextProvider>
|
|
120
|
-
),
|
|
121
|
-
args: {
|
|
122
|
-
uniqueId: "ForBiggerBlazes002", // uniqueId of the sprite
|
|
123
|
-
src: "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerBlazes.mp4",
|
|
124
|
-
transformation: {
|
|
125
|
-
x: 100,
|
|
126
|
-
y: 100,
|
|
127
|
-
width: 150,
|
|
128
|
-
height: 150,
|
|
129
|
-
anchor: 0.5,
|
|
130
|
-
rotation: 0,
|
|
131
|
-
alpha: 1,
|
|
132
|
-
scale: 1,
|
|
133
|
-
tint: 0xffffff,
|
|
134
|
-
blendMode: 0,
|
|
135
|
-
animation: "FADE_IN",
|
|
136
|
-
colorCorrection: {},
|
|
137
|
-
},
|
|
138
|
-
applyTransformer: false,
|
|
139
|
-
startAt: 0,
|
|
140
|
-
endAt: 10,
|
|
141
|
-
frameStartAt: 0,
|
|
142
|
-
frameEndAt: 10,
|
|
143
|
-
initialAlpha: 0,
|
|
144
|
-
mute: false,
|
|
145
|
-
locked: false,
|
|
146
|
-
},
|
|
147
|
-
};
|
|
148
|
-
|
|
149
|
-
export const Filters: Story = {
|
|
150
|
-
render: (args: any) => (
|
|
151
|
-
<AppStateContextProvider {...args}>
|
|
152
|
-
<PixiVideoSprite {...args} />
|
|
153
|
-
</AppStateContextProvider>
|
|
154
|
-
),
|
|
155
|
-
args: {
|
|
156
|
-
uniqueId: "videofiter002", // uniqueId of the sprite
|
|
157
|
-
src: "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerBlazes.mp4",
|
|
158
|
-
transformation: {
|
|
159
|
-
x: 290,
|
|
160
|
-
y: 250,
|
|
161
|
-
width: 550,
|
|
162
|
-
height: 400,
|
|
163
|
-
anchor: 0.5,
|
|
164
|
-
rotation: 0,
|
|
165
|
-
alpha: 1,
|
|
166
|
-
scale: 1,
|
|
167
|
-
tint: 0xffffff,
|
|
168
|
-
blendMode: 0,
|
|
169
|
-
colorCorrection: {
|
|
170
|
-
enabled: true,
|
|
171
|
-
contrast: 2,
|
|
172
|
-
saturation: 2,
|
|
173
|
-
exposure: 2,
|
|
174
|
-
blurRadius: 1,
|
|
175
|
-
},
|
|
176
|
-
},
|
|
177
|
-
applyTransformer: false,
|
|
178
|
-
startAt: 0,
|
|
179
|
-
endAt: 10,
|
|
180
|
-
frameStartAt: 0,
|
|
181
|
-
frameEndAt: 10,
|
|
182
|
-
initialAlpha: 1,
|
|
183
|
-
mute: false,
|
|
184
|
-
locked: false,
|
|
185
|
-
},
|
|
186
|
-
};
|