@designcombo/video 0.0.2 → 0.0.3
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/dist/{SharedSystems-BWe03l6N.js → SharedSystems-s9Js69L7.js} +1 -1
- package/dist/{WebGLRenderer-CKduQ9yw.js → WebGLRenderer-C-0unSMy.js} +2 -2
- package/dist/{WebGPURenderer-BSX8DZj-.js → WebGPURenderer-D7pcgSJJ.js} +2 -2
- package/dist/{browserAll-CwPYLzJJ.js → browserAll-D5pTiGnC.js} +2 -2
- package/dist/clips/audio-clip.d.ts +1 -1
- package/dist/clips/base-clip.d.ts +1 -0
- package/dist/clips/caption-clip.d.ts +8 -7
- package/dist/clips/effect-clip.d.ts +33 -0
- package/dist/clips/iclip.d.ts +4 -0
- package/dist/clips/image-clip.d.ts +2 -1
- package/dist/clips/index.d.ts +1 -0
- package/dist/clips/text-clip.d.ts +23 -10
- package/dist/clips/video-clip.d.ts +9 -7
- package/dist/effect/glsl/custom-glsl.d.ts +499 -5
- package/dist/{index-C333riU-.js → index-BVO9qrk3.js} +14718 -10667
- package/dist/index.d.ts +1 -1
- package/dist/index.es.js +15 -14
- package/dist/index.umd.js +1994 -150
- package/dist/json-serialization.d.ts +11 -0
- package/dist/sprite/base-sprite.d.ts +41 -0
- package/dist/sprite/pixi-sprite-renderer.d.ts +3 -12
- package/dist/studio.d.ts +65 -6
- package/dist/{webworkerAll-aNnyDpl9.js → webworkerAll-zvzmYHny.js} +36 -63
- package/package.json +3 -3
|
@@ -23,6 +23,10 @@ interface BaseClipJSON {
|
|
|
23
23
|
zIndex: number;
|
|
24
24
|
opacity: number;
|
|
25
25
|
flip: 'horizontal' | 'vertical' | null;
|
|
26
|
+
trim?: {
|
|
27
|
+
from: number;
|
|
28
|
+
to: number;
|
|
29
|
+
};
|
|
26
30
|
animation?: {
|
|
27
31
|
keyFrames: Record<string, Partial<{
|
|
28
32
|
x: number;
|
|
@@ -130,7 +134,14 @@ export interface CaptionClipJSON extends BaseClipJSON {
|
|
|
130
134
|
fontUrl?: string;
|
|
131
135
|
}
|
|
132
136
|
export type ClipJSON = VideoClipJSON | AudioClipJSON | ImageClipJSON | TextClipJSON | CaptionClipJSON;
|
|
137
|
+
export interface StudioTrackJSON {
|
|
138
|
+
id: string;
|
|
139
|
+
name: string;
|
|
140
|
+
type: string;
|
|
141
|
+
clipIds: string[];
|
|
142
|
+
}
|
|
133
143
|
export interface ProjectJSON {
|
|
144
|
+
tracks?: StudioTrackJSON[];
|
|
134
145
|
clips: ClipJSON[];
|
|
135
146
|
globalEffects?: Array<{
|
|
136
147
|
id: string;
|
|
@@ -15,6 +15,10 @@ type TKeyFrameOpts = Partial<Record<`${number}%` | 'from' | 'to', Partial<TAnima
|
|
|
15
15
|
* @see {@link OffscreenSprite}
|
|
16
16
|
*/
|
|
17
17
|
export declare abstract class BaseSprite {
|
|
18
|
+
/**
|
|
19
|
+
* Unique identifier for the sprite/clip
|
|
20
|
+
*/
|
|
21
|
+
id: string;
|
|
18
22
|
/**
|
|
19
23
|
* Control display time range of clips, commonly used in editing scenario timeline (track) module
|
|
20
24
|
* from: start time offset in microseconds
|
|
@@ -36,6 +40,15 @@ export declare abstract class BaseSprite {
|
|
|
36
40
|
* 2. Audio uses the simplest interpolation algorithm to change rate, so changing rate will cause pitch variation, for custom algorithm please use {@link VideoClip.tickInterceptor} to implement
|
|
37
41
|
*/
|
|
38
42
|
playbackRate: number;
|
|
43
|
+
/**
|
|
44
|
+
* Trim range of the source media in microseconds
|
|
45
|
+
* from: start time in microseconds
|
|
46
|
+
* to: end time in microseconds
|
|
47
|
+
*/
|
|
48
|
+
trim: {
|
|
49
|
+
from: number;
|
|
50
|
+
to: number;
|
|
51
|
+
};
|
|
39
52
|
private evtTool;
|
|
40
53
|
/**
|
|
41
54
|
* Listen to property change events
|
|
@@ -50,6 +63,10 @@ export declare abstract class BaseSprite {
|
|
|
50
63
|
height: number;
|
|
51
64
|
angle: number;
|
|
52
65
|
zIndex: number;
|
|
66
|
+
blur: number;
|
|
67
|
+
brightness: number;
|
|
68
|
+
round: number;
|
|
69
|
+
volume: number;
|
|
53
70
|
}>) => void;
|
|
54
71
|
}[Type]) => (() => void);
|
|
55
72
|
private _left;
|
|
@@ -96,6 +113,30 @@ export declare abstract class BaseSprite {
|
|
|
96
113
|
* Control layering relationship between clips, clips with smaller zIndex will be occluded
|
|
97
114
|
*/
|
|
98
115
|
set zIndex(v: number);
|
|
116
|
+
private _blur;
|
|
117
|
+
/**
|
|
118
|
+
* Blur intensity (0.0 to 1.0, where 1.0 is max useful blur, e.g. 50px)
|
|
119
|
+
*/
|
|
120
|
+
get blur(): number;
|
|
121
|
+
set blur(v: number);
|
|
122
|
+
private _brightness;
|
|
123
|
+
/**
|
|
124
|
+
* Brightness intensity (0.0 to 1.0, where 0.0 is Normal, 1.0 is Maximum)
|
|
125
|
+
*/
|
|
126
|
+
get brightness(): number;
|
|
127
|
+
set brightness(v: number);
|
|
128
|
+
private _round;
|
|
129
|
+
/**
|
|
130
|
+
* Rounded corners intensity (0.0 to 1.0, where 1.0 is a perfect circle/capsule)
|
|
131
|
+
*/
|
|
132
|
+
get round(): number;
|
|
133
|
+
set round(v: number);
|
|
134
|
+
private _volume;
|
|
135
|
+
/**
|
|
136
|
+
* Audio volume (0.0 to 1.0)
|
|
137
|
+
*/
|
|
138
|
+
get volume(): number;
|
|
139
|
+
set volume(v: number);
|
|
99
140
|
/**
|
|
100
141
|
* Opacity
|
|
101
142
|
*/
|
|
@@ -19,6 +19,9 @@ export declare class PixiSpriteRenderer {
|
|
|
19
19
|
private canvas;
|
|
20
20
|
private context;
|
|
21
21
|
private destroyed;
|
|
22
|
+
private blurFilter;
|
|
23
|
+
private colorMatrixFilter;
|
|
24
|
+
private roundMask;
|
|
22
25
|
constructor(_pixiApp: Application | null, sprite: IClip, targetContainer?: Container | null);
|
|
23
26
|
/**
|
|
24
27
|
* Update the sprite with a new video frame or Texture
|
|
@@ -28,21 +31,9 @@ export declare class PixiSpriteRenderer {
|
|
|
28
31
|
updateFrame(frame: ImageBitmap | Texture | null): Promise<void>;
|
|
29
32
|
/**
|
|
30
33
|
* Apply sprite transformations to the Pixi Sprite
|
|
31
|
-
* This reads the current sprite properties (which may have been updated by animations)
|
|
32
|
-
* and applies them to the Pixi sprite
|
|
33
34
|
*/
|
|
34
35
|
private applySpriteTransforms;
|
|
35
|
-
/**
|
|
36
|
-
* Update sprite properties without changing the frame
|
|
37
|
-
* Useful when sprite properties change but frame stays the same
|
|
38
|
-
*/
|
|
39
36
|
updateTransforms(): void;
|
|
40
|
-
/**
|
|
41
|
-
* Get the Pixi Sprite instance
|
|
42
|
-
*/
|
|
43
37
|
getSprite(): Sprite | null;
|
|
44
|
-
/**
|
|
45
|
-
* Destroy the renderer and clean up resources
|
|
46
|
-
*/
|
|
47
38
|
destroy(): void;
|
|
48
39
|
}
|
package/dist/studio.d.ts
CHANGED
|
@@ -11,18 +11,46 @@ export interface IStudioOpts {
|
|
|
11
11
|
interactivity?: boolean;
|
|
12
12
|
}
|
|
13
13
|
export interface StudioEvents {
|
|
14
|
-
|
|
14
|
+
'selection:created': {
|
|
15
15
|
selected: IClip[];
|
|
16
16
|
};
|
|
17
|
-
|
|
17
|
+
'selection:updated': {
|
|
18
18
|
selected: IClip[];
|
|
19
19
|
};
|
|
20
|
-
|
|
20
|
+
'selection:cleared': {
|
|
21
21
|
deselected: IClip[];
|
|
22
22
|
};
|
|
23
|
+
'track:added': {
|
|
24
|
+
track: StudioTrack;
|
|
25
|
+
};
|
|
26
|
+
'track:removed': {
|
|
27
|
+
trackId: string;
|
|
28
|
+
};
|
|
29
|
+
'clip:added': {
|
|
30
|
+
clip: IClip;
|
|
31
|
+
trackId: string;
|
|
32
|
+
};
|
|
33
|
+
'clip:removed': {
|
|
34
|
+
clipId: string;
|
|
35
|
+
};
|
|
36
|
+
currentTime: {
|
|
37
|
+
currentTime: number;
|
|
38
|
+
};
|
|
39
|
+
play: {
|
|
40
|
+
isPlaying: boolean;
|
|
41
|
+
};
|
|
42
|
+
pause: {
|
|
43
|
+
isPlaying: boolean;
|
|
44
|
+
};
|
|
23
45
|
[key: string]: any;
|
|
24
46
|
[key: symbol]: any;
|
|
25
47
|
}
|
|
48
|
+
export interface StudioTrack {
|
|
49
|
+
id: string;
|
|
50
|
+
name: string;
|
|
51
|
+
type: string;
|
|
52
|
+
clipIds: string[];
|
|
53
|
+
}
|
|
26
54
|
/**
|
|
27
55
|
* Interactive preview studio for clips with playback controls
|
|
28
56
|
* Useful for previewing clips before rendering with Compositor
|
|
@@ -45,6 +73,7 @@ export interface StudioEvents {
|
|
|
45
73
|
*/
|
|
46
74
|
export declare class Studio extends EventEmitter<StudioEvents> {
|
|
47
75
|
private pixiApp;
|
|
76
|
+
private tracks;
|
|
48
77
|
private clips;
|
|
49
78
|
private spriteRenderers;
|
|
50
79
|
private artboard;
|
|
@@ -66,15 +95,15 @@ export declare class Studio extends EventEmitter<StudioEvents> {
|
|
|
66
95
|
private destroyed;
|
|
67
96
|
private globalEffects;
|
|
68
97
|
private activeGlobalEffect;
|
|
69
|
-
private
|
|
98
|
+
private currentGlobalEffectSprite;
|
|
70
99
|
private effectFilters;
|
|
71
|
-
private scale;
|
|
72
100
|
private clipsNormalContainer;
|
|
73
101
|
private clipsEffectContainer;
|
|
74
102
|
/**
|
|
75
103
|
* Convert hex color string to number
|
|
76
104
|
*/
|
|
77
105
|
private hexToNumber;
|
|
106
|
+
ready: Promise<void>;
|
|
78
107
|
/**
|
|
79
108
|
* Create a new Studio instance
|
|
80
109
|
*/
|
|
@@ -91,7 +120,35 @@ export declare class Studio extends EventEmitter<StudioEvents> {
|
|
|
91
120
|
* @param clip The clip to add
|
|
92
121
|
* @param audioSource Optional audio source (URL, File, or Blob) for AudioClip playback
|
|
93
122
|
*/
|
|
94
|
-
addClip(clip: IClip,
|
|
123
|
+
addClip(clip: IClip, options?: {
|
|
124
|
+
trackId?: string;
|
|
125
|
+
audioSource?: string | File | Blob;
|
|
126
|
+
} | string | File | Blob): Promise<void>;
|
|
127
|
+
/**
|
|
128
|
+
* Add a new track to the studio
|
|
129
|
+
*/
|
|
130
|
+
addTrack(track: {
|
|
131
|
+
name: string;
|
|
132
|
+
type: string;
|
|
133
|
+
id?: string;
|
|
134
|
+
}): StudioTrack;
|
|
135
|
+
/**
|
|
136
|
+
* Set tracks (and implicitly clips if they are new)
|
|
137
|
+
*/
|
|
138
|
+
setTracks(tracks: StudioTrack[]): Promise<void>;
|
|
139
|
+
/**
|
|
140
|
+
* Remove a track and all its clips
|
|
141
|
+
*/
|
|
142
|
+
removeTrack(trackId: string): Promise<void>;
|
|
143
|
+
/**
|
|
144
|
+
* Update a clip's properties
|
|
145
|
+
* Handles consistency between display (from/to) and duration
|
|
146
|
+
*/
|
|
147
|
+
updateClip(id: string, updates: Partial<IClip>): Promise<void>;
|
|
148
|
+
/**
|
|
149
|
+
* Get all tracks
|
|
150
|
+
*/
|
|
151
|
+
getTracks(): StudioTrack[];
|
|
95
152
|
/**
|
|
96
153
|
* Setup sprite interactivity for click selection
|
|
97
154
|
*/
|
|
@@ -150,6 +207,7 @@ export declare class Studio extends EventEmitter<StudioEvents> {
|
|
|
150
207
|
duration?: number;
|
|
151
208
|
id?: string;
|
|
152
209
|
}, clips: IClip[]): string;
|
|
210
|
+
getTrackIndex(clipId: string): number;
|
|
153
211
|
removeGlobalEffect(id: string): void;
|
|
154
212
|
clearGlobalEffects(): void;
|
|
155
213
|
private updateActiveGlobalEffect;
|
|
@@ -193,4 +251,5 @@ export declare class Studio extends EventEmitter<StudioEvents> {
|
|
|
193
251
|
* @param json The JSON project data
|
|
194
252
|
*/
|
|
195
253
|
loadFromJSON(json: ProjectJSON): Promise<void>;
|
|
254
|
+
private loadClipIntoTrack;
|
|
196
255
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { E as p, U as Ne, T as ee, F as je, G as he, v as fe, M as P, l as C, d as pe, I as v, t as w, a8 as $, R as N, w as L, H as me, a5 as G, a6 as ge, c as F, B as T, D as j, S as M, y as D,
|
|
2
|
-
import { c as
|
|
1
|
+
import { E as p, U as Ne, T as ee, F as je, G as he, v as fe, af as qe, M as P, l as C, d as pe, I as v, t as w, a8 as $, R as N, w as L, H as me, a5 as G, a6 as ge, c as F, B as T, D as j, S as M, y as D, ag as Qe, ah as q, L as Y, ai as U, s as Q, a0 as Je, $ as X, n as xe, q as _e, aa as be, ad as ye, o as Ze, p as et, ab as tt, ac as rt, ae as nt, aj as st, ak as it, al as at, am as H, an as ot, ao as ut, m as ve, ap as te, aq as k, e as b, ar as lt } from "./index-BVO9qrk3.js";
|
|
2
|
+
import { c as A, a as ct, b as dt, B as Te } from "./colorToUniform-C2jGzNe1.js";
|
|
3
3
|
class Pe {
|
|
4
4
|
/**
|
|
5
5
|
* Initialize the plugin with scope of application instance
|
|
@@ -86,34 +86,7 @@ class we {
|
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
88
|
we.extension = p.Application;
|
|
89
|
-
var
|
|
90
|
-
out vec2 vTextureCoord;
|
|
91
|
-
|
|
92
|
-
uniform vec4 uInputSize;
|
|
93
|
-
uniform vec4 uOutputFrame;
|
|
94
|
-
uniform vec4 uOutputTexture;
|
|
95
|
-
|
|
96
|
-
vec4 filterVertexPosition( void )
|
|
97
|
-
{
|
|
98
|
-
vec2 position = aPosition * uOutputFrame.zw + uOutputFrame.xy;
|
|
99
|
-
|
|
100
|
-
position.x = position.x * (2.0 / uOutputTexture.x) - 1.0;
|
|
101
|
-
position.y = position.y * (2.0*uOutputTexture.z / uOutputTexture.y) - uOutputTexture.z;
|
|
102
|
-
|
|
103
|
-
return vec4(position, 0.0, 1.0);
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
vec2 filterTextureCoord( void )
|
|
107
|
-
{
|
|
108
|
-
return aPosition * (uOutputFrame.zw * uInputSize.zw);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
void main(void)
|
|
112
|
-
{
|
|
113
|
-
gl_Position = filterVertexPosition();
|
|
114
|
-
vTextureCoord = filterTextureCoord();
|
|
115
|
-
}
|
|
116
|
-
`, ht = `in vec2 vTextureCoord;
|
|
89
|
+
var ht = `in vec2 vTextureCoord;
|
|
117
90
|
out vec4 finalColor;
|
|
118
91
|
uniform sampler2D uTexture;
|
|
119
92
|
void main() {
|
|
@@ -176,7 +149,7 @@ class ft extends je {
|
|
|
176
149
|
fragment: { source: re, entryPoint: "mainFragment" },
|
|
177
150
|
name: "passthrough-filter"
|
|
178
151
|
}), t = fe.from({
|
|
179
|
-
vertex:
|
|
152
|
+
vertex: qe,
|
|
180
153
|
fragment: ht,
|
|
181
154
|
name: "passthrough-filter"
|
|
182
155
|
});
|
|
@@ -756,7 +729,7 @@ class Be {
|
|
|
756
729
|
const s = r.customShader || this._adaptor.shader;
|
|
757
730
|
this.state.blendMode = e.groupBlendMode;
|
|
758
731
|
const i = s.resources.localUniforms.uniforms;
|
|
759
|
-
i.uTransformMatrix = e.groupTransform, i.uRound = t._roundPixels | e._roundPixels,
|
|
732
|
+
i.uTransformMatrix = e.groupTransform, i.uRound = t._roundPixels | e._roundPixels, A(
|
|
760
733
|
e.groupColorAlpha,
|
|
761
734
|
i.uColor,
|
|
762
735
|
0
|
|
@@ -783,7 +756,7 @@ class Be {
|
|
|
783
756
|
_updateBatchesForRenderable(e, t) {
|
|
784
757
|
const r = e.context, n = this.renderer.graphicsContext.getGpuContext(r), s = this.renderer._roundPixels | e._roundPixels;
|
|
785
758
|
t.batches = n.batches.map((i) => {
|
|
786
|
-
const o = D.get(
|
|
759
|
+
const o = D.get(Qe);
|
|
787
760
|
return i.copyTo(o), o.renderable = e, o.roundPixels = s, o;
|
|
788
761
|
});
|
|
789
762
|
}
|
|
@@ -942,7 +915,7 @@ class De {
|
|
|
942
915
|
return;
|
|
943
916
|
e.state.blendMode = q(e.groupBlendMode, e.texture._source);
|
|
944
917
|
const t = this.localUniforms;
|
|
945
|
-
t.uniforms.uTransformMatrix = e.groupTransform, t.uniforms.uRound = this.renderer._roundPixels | e._roundPixels, t.update(),
|
|
918
|
+
t.uniforms.uTransformMatrix = e.groupTransform, t.uniforms.uRound = this.renderer._roundPixels | e._roundPixels, t.update(), A(
|
|
946
919
|
e.groupColorAlpha,
|
|
947
920
|
t.uniforms.uColor,
|
|
948
921
|
0
|
|
@@ -1262,7 +1235,7 @@ class Ft extends Q {
|
|
|
1262
1235
|
// this will be replaced with the local uniforms from the particle container
|
|
1263
1236
|
uniforms: {
|
|
1264
1237
|
uTranslationMatrix: { value: new P(), type: "mat3x3<f32>" },
|
|
1265
|
-
uColor: { value: new
|
|
1238
|
+
uColor: { value: new Je(16777215), type: "vec4<f32>" },
|
|
1266
1239
|
uRound: { value: 1, type: "f32" },
|
|
1267
1240
|
uResolution: { value: [0, 0], type: "vec2<f32>" }
|
|
1268
1241
|
}
|
|
@@ -1270,7 +1243,7 @@ class Ft extends Q {
|
|
|
1270
1243
|
});
|
|
1271
1244
|
}
|
|
1272
1245
|
}
|
|
1273
|
-
class
|
|
1246
|
+
class Ae {
|
|
1274
1247
|
/**
|
|
1275
1248
|
* @param renderer - The renderer this sprite batch works for.
|
|
1276
1249
|
* @param adaptor
|
|
@@ -1309,7 +1282,7 @@ class ze {
|
|
|
1309
1282
|
const s = this.state;
|
|
1310
1283
|
n.update(t, e._childrenDirty), e._childrenDirty = !1, s.blendMode = q(e.blendMode, e.texture._source);
|
|
1311
1284
|
const i = this.localUniforms.uniforms, o = i.uTranslationMatrix;
|
|
1312
|
-
e.worldTransform.copyTo(o), o.prepend(r.globalUniforms.globalUniformData.projectionMatrix), i.uResolution = r.globalUniforms.globalUniformData.resolution, i.uRound = r._roundPixels | e._roundPixels,
|
|
1285
|
+
e.worldTransform.copyTo(o), o.prepend(r.globalUniforms.globalUniformData.projectionMatrix), i.uResolution = r.globalUniforms.globalUniformData.resolution, i.uRound = r._roundPixels | e._roundPixels, A(
|
|
1313
1286
|
e.groupColorAlpha,
|
|
1314
1287
|
i.uColor,
|
|
1315
1288
|
0
|
|
@@ -1320,18 +1293,18 @@ class ze {
|
|
|
1320
1293
|
this.renderer = null, this.defaultShader && (this.defaultShader.destroy(), this.defaultShader = null);
|
|
1321
1294
|
}
|
|
1322
1295
|
}
|
|
1323
|
-
class
|
|
1296
|
+
class ze extends Ae {
|
|
1324
1297
|
constructor(e) {
|
|
1325
1298
|
super(e, new yt());
|
|
1326
1299
|
}
|
|
1327
1300
|
}
|
|
1328
|
-
|
|
1301
|
+
ze.extension = {
|
|
1329
1302
|
type: [
|
|
1330
1303
|
p.WebGLPipes
|
|
1331
1304
|
],
|
|
1332
1305
|
name: "particle"
|
|
1333
1306
|
};
|
|
1334
|
-
class ke extends
|
|
1307
|
+
class ke extends Ae {
|
|
1335
1308
|
constructor(e) {
|
|
1336
1309
|
super(e, new vt());
|
|
1337
1310
|
}
|
|
@@ -1564,14 +1537,14 @@ class Mt extends Q {
|
|
|
1564
1537
|
O ?? (O = xe({
|
|
1565
1538
|
name: "tiling-sprite-shader",
|
|
1566
1539
|
bits: [
|
|
1567
|
-
|
|
1540
|
+
ct,
|
|
1568
1541
|
Bt,
|
|
1569
1542
|
_e
|
|
1570
1543
|
]
|
|
1571
1544
|
})), I ?? (I = be({
|
|
1572
1545
|
name: "tiling-sprite-shader",
|
|
1573
1546
|
bits: [
|
|
1574
|
-
|
|
1547
|
+
dt,
|
|
1575
1548
|
Gt,
|
|
1576
1549
|
ye
|
|
1577
1550
|
]
|
|
@@ -1619,11 +1592,11 @@ class Dt extends J {
|
|
|
1619
1592
|
});
|
|
1620
1593
|
}
|
|
1621
1594
|
}
|
|
1622
|
-
function
|
|
1595
|
+
function At(a, e) {
|
|
1623
1596
|
const t = a.anchor.x, r = a.anchor.y;
|
|
1624
1597
|
e[0] = -t * a.width, e[1] = -r * a.height, e[2] = (1 - t) * a.width, e[3] = -r * a.height, e[4] = (1 - t) * a.width, e[5] = (1 - r) * a.height, e[6] = -t * a.width, e[7] = (1 - r) * a.height;
|
|
1625
1598
|
}
|
|
1626
|
-
function
|
|
1599
|
+
function zt(a, e, t, r) {
|
|
1627
1600
|
let n = 0;
|
|
1628
1601
|
const s = a.length / e, i = r.a, o = r.b, u = r.c, c = r.d, h = r.tx, l = r.ty;
|
|
1629
1602
|
for (t *= e; n < s; ) {
|
|
@@ -1636,7 +1609,7 @@ function kt(a, e) {
|
|
|
1636
1609
|
let s = 0, i = 0;
|
|
1637
1610
|
a.applyAnchorToTexture && (s = a.anchor.x, i = a.anchor.y), e[0] = e[6] = -s, e[2] = e[4] = 1 - s, e[1] = e[3] = -i, e[5] = e[7] = 1 - i;
|
|
1638
1611
|
const o = P.shared;
|
|
1639
|
-
o.copyFrom(a._tileTransform.matrix), o.tx /= a.width, o.ty /= a.height, o.invert(), o.scale(a.width / r, a.height / n),
|
|
1612
|
+
o.copyFrom(a._tileTransform.matrix), o.tx /= a.width, o.ty /= a.height, o.invert(), o.scale(a.width / r, a.height / n), zt(e, 2, 0, o);
|
|
1640
1613
|
}
|
|
1641
1614
|
const B = new Dt();
|
|
1642
1615
|
class Ot {
|
|
@@ -1683,7 +1656,7 @@ class Ve {
|
|
|
1683
1656
|
const { shader: t } = this._getTilingSpriteData(e);
|
|
1684
1657
|
t.groups[0] = this._renderer.globalUniforms.bindGroup;
|
|
1685
1658
|
const r = t.resources.localUniforms.uniforms;
|
|
1686
|
-
r.uTransformMatrix = e.groupTransform, r.uRound = this._renderer._roundPixels | e._roundPixels,
|
|
1659
|
+
r.uTransformMatrix = e.groupTransform, r.uRound = this._renderer._roundPixels | e._roundPixels, A(
|
|
1687
1660
|
e.groupColorAlpha,
|
|
1688
1661
|
r.uColor,
|
|
1689
1662
|
0
|
|
@@ -1719,7 +1692,7 @@ class Ve {
|
|
|
1719
1692
|
}
|
|
1720
1693
|
_updateBatchableMesh(e) {
|
|
1721
1694
|
const t = this._getTilingSpriteData(e), { geometry: r } = t, n = e.texture.source.style;
|
|
1722
|
-
n.addressMode !== "repeat" && (n.addressMode = "repeat", n.update()), kt(e, r.uvs),
|
|
1695
|
+
n.addressMode !== "repeat" && (n.addressMode = "repeat", n.update()), kt(e, r.uvs), At(e, r.positions);
|
|
1723
1696
|
}
|
|
1724
1697
|
destroy() {
|
|
1725
1698
|
this._renderer = null;
|
|
@@ -1916,8 +1889,8 @@ class Lt extends Q {
|
|
|
1916
1889
|
E ?? (E = xe({
|
|
1917
1890
|
name: "sdf-shader",
|
|
1918
1891
|
bits: [
|
|
1919
|
-
|
|
1920
|
-
|
|
1892
|
+
Ze,
|
|
1893
|
+
et(e),
|
|
1921
1894
|
It,
|
|
1922
1895
|
Vt,
|
|
1923
1896
|
_e
|
|
@@ -1925,8 +1898,8 @@ class Lt extends Q {
|
|
|
1925
1898
|
})), V ?? (V = be({
|
|
1926
1899
|
name: "sdf-shader",
|
|
1927
1900
|
bits: [
|
|
1928
|
-
|
|
1929
|
-
|
|
1901
|
+
tt,
|
|
1902
|
+
rt(e),
|
|
1930
1903
|
Et,
|
|
1931
1904
|
Wt,
|
|
1932
1905
|
ye
|
|
@@ -1936,12 +1909,12 @@ class Lt extends Q {
|
|
|
1936
1909
|
gpuProgram: E,
|
|
1937
1910
|
resources: {
|
|
1938
1911
|
localUniforms: t,
|
|
1939
|
-
batchSamplers:
|
|
1912
|
+
batchSamplers: nt(e)
|
|
1940
1913
|
}
|
|
1941
1914
|
});
|
|
1942
1915
|
}
|
|
1943
1916
|
}
|
|
1944
|
-
class Yt extends
|
|
1917
|
+
class Yt extends ot {
|
|
1945
1918
|
destroy() {
|
|
1946
1919
|
this.context.customShader && this.context.customShader.destroy(), super.destroy();
|
|
1947
1920
|
}
|
|
@@ -1963,11 +1936,11 @@ class We {
|
|
|
1963
1936
|
de(e, t), this._renderer.renderPipes.graphics.updateRenderable(t), t.context.customShader && this._updateDistanceField(e);
|
|
1964
1937
|
}
|
|
1965
1938
|
_updateContext(e, t) {
|
|
1966
|
-
const { context: r } = t, n =
|
|
1939
|
+
const { context: r } = t, n = st.getFont(e.text, e._style);
|
|
1967
1940
|
r.clear(), n.distanceField.type !== "none" && (r.customShader || (r.customShader = new Lt(this._renderer.limits.maxBatchableTextures)));
|
|
1968
|
-
const s =
|
|
1941
|
+
const s = it.graphemeSegmenter(e.text), i = e._style;
|
|
1969
1942
|
let o = n.baseLineOffset;
|
|
1970
|
-
const u =
|
|
1943
|
+
const u = at(s, i, n, !0), c = i.padding, h = u.scale;
|
|
1971
1944
|
let l = u.width, d = u.height + u.offsetY;
|
|
1972
1945
|
i._stroke && (l += i._stroke.width / h, d += i._stroke.width / h), r.translate(-e._anchor._x * l - c, -e._anchor._y * d - c).scale(h, h);
|
|
1973
1946
|
const f = n.applyFillAsTint ? i._fill.color : 16777215;
|
|
@@ -1980,14 +1953,14 @@ class We {
|
|
|
1980
1953
|
for (let S = 0; S < y.charPositions.length; S++) {
|
|
1981
1954
|
const $e = y.chars[S], R = n.chars[$e];
|
|
1982
1955
|
if (R?.texture) {
|
|
1983
|
-
const
|
|
1956
|
+
const z = R.texture;
|
|
1984
1957
|
r.texture(
|
|
1985
|
-
|
|
1958
|
+
z,
|
|
1986
1959
|
f || "black",
|
|
1987
1960
|
Math.round(y.charPositions[S] + R.xOffset),
|
|
1988
1961
|
Math.round(o + R.yOffset + x),
|
|
1989
|
-
|
|
1990
|
-
|
|
1962
|
+
z.orig.width,
|
|
1963
|
+
z.orig.height
|
|
1991
1964
|
);
|
|
1992
1965
|
}
|
|
1993
1966
|
}
|
|
@@ -2041,7 +2014,7 @@ class Xt extends Te {
|
|
|
2041
2014
|
}
|
|
2042
2015
|
function K(a, e) {
|
|
2043
2016
|
const { texture: t, bounds: r } = a, n = e._style._getFinalPadding();
|
|
2044
|
-
|
|
2017
|
+
ut(r, e._anchor, t);
|
|
2045
2018
|
const s = e._anchor._x * n * 2, i = e._anchor._y * n * 2;
|
|
2046
2019
|
r.minX -= n - s, r.minY -= n - i, r.maxX -= n - s, r.maxY -= n - i;
|
|
2047
2020
|
}
|
|
@@ -2482,9 +2455,9 @@ Ke.extension = {
|
|
|
2482
2455
|
b.add(Pe);
|
|
2483
2456
|
b.add(we);
|
|
2484
2457
|
b.add(Be);
|
|
2485
|
-
b.add(
|
|
2458
|
+
b.add(lt);
|
|
2486
2459
|
b.add(De);
|
|
2487
|
-
b.add(
|
|
2460
|
+
b.add(ze);
|
|
2488
2461
|
b.add(ke);
|
|
2489
2462
|
b.add(Ke);
|
|
2490
2463
|
b.add(He);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@designcombo/video",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"description": "Video rendering and processing library",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"publishConfig": {
|
|
@@ -27,9 +27,9 @@
|
|
|
27
27
|
"types": "dist/index.d.ts",
|
|
28
28
|
"exports": {
|
|
29
29
|
".": {
|
|
30
|
-
"types": "./dist/index.d.ts",
|
|
31
30
|
"import": "./dist/index.es.js",
|
|
32
|
-
"require": "./dist/index.umd.js"
|
|
31
|
+
"require": "./dist/index.umd.js",
|
|
32
|
+
"types": "./dist/index.d.ts"
|
|
33
33
|
}
|
|
34
34
|
},
|
|
35
35
|
"scripts": {
|