openvideo 0.0.4 → 0.1.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.
@@ -45,6 +45,11 @@ interface BaseClipJSON {
45
45
  iterCount?: number;
46
46
  };
47
47
  };
48
+ animations?: Array<{
49
+ type: string;
50
+ opts: any;
51
+ params?: any;
52
+ }>;
48
53
  main?: boolean;
49
54
  }
50
55
  export interface VideoJSON extends BaseClipJSON {
@@ -1,4 +1,5 @@
1
1
  import { default as EventEmitter } from '../event-emitter';
2
+ import { IAnimation, AnimationTransform } from '../animation';
2
3
  type IRectBaseProps = any;
3
4
  interface IAnimationOpts {
4
5
  duration: number;
@@ -9,7 +10,7 @@ type TAnimateProps = IRectBaseProps & {
9
10
  opacity: number;
10
11
  };
11
12
  export type TAnimationKeyFrame = Array<[number, Partial<TAnimateProps>]>;
12
- type TKeyFrameOpts = Partial<Record<`${number}%` | 'from' | 'to', Partial<TAnimateProps>>>;
13
+ type TKeyFrameOpts = Partial<Record<`${number}%` | "from" | "to", Partial<TAnimateProps>>>;
13
14
  export interface BaseSpriteEvents {
14
15
  propsChange: Partial<{
15
16
  left: number;
@@ -127,7 +128,7 @@ export declare abstract class BaseSprite<T extends BaseSpriteEvents = BaseSprite
127
128
  /**
128
129
  * Flip clip horizontally or vertically
129
130
  */
130
- flip: 'horizontal' | 'vertical' | null;
131
+ flip: "horizontal" | "vertical" | null;
131
132
  effects: Array<{
132
133
  id: string;
133
134
  key: string;
@@ -144,11 +145,19 @@ export declare abstract class BaseSprite<T extends BaseSpriteEvents = BaseSprite
144
145
  set style(v: any);
145
146
  private animatKeyFrame;
146
147
  private animatOpts;
148
+ /**
149
+ * List of active animations
150
+ */
151
+ animations: IAnimation[];
152
+ /**
153
+ * Current transform offsets/multipliers from animations
154
+ * Resets every frame in animate()
155
+ */
156
+ renderTransform: AnimationTransform;
147
157
  /**
148
158
  * @see {@link IClip.ready}
149
159
  * For clips, this should be Promise<IClipMeta>, but for BaseSprite it's just Promise<void>
150
160
  */
151
- ready: Promise<any>;
152
161
  protected _render(ctx: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D): void;
153
162
  /**
154
163
  * Add animation to clip, usage reference CSS animation
@@ -170,7 +179,30 @@ export declare abstract class BaseSprite<T extends BaseSpriteEvents = BaseSprite
170
179
  /**
171
180
  * If current sprite has animation set, set sprite's animation properties to state at specified time
172
181
  */
173
- animate(time: number): void;
182
+ animate(time: number, target?: any): void;
183
+ /**
184
+ * Add a modular animation to the clip
185
+ * @param name Preset name or 'keyframes'
186
+ * @param opts Animation options (duration, delay, etc.)
187
+ * @param params Preset-specific parameters or KeyframeData
188
+ */
189
+ addAnimation(name: string, opts: any, params?: any): string;
190
+ /**
191
+ * Remove an animation by ID
192
+ */
193
+ removeAnimation(id: string): void;
194
+ /**
195
+ * Clear all modular animations
196
+ */
197
+ clearAnimations(): void;
198
+ /**
199
+ * Update an existing animation by ID
200
+ * @param id Animation ID to update
201
+ * @param type Animation type (preset name or 'keyframes')
202
+ * @param opts Animation options
203
+ * @param params Preset-specific parameters or KeyframeData
204
+ */
205
+ updateAnimation(id: string, type: string, opts: any, params?: any): void;
174
206
  /**
175
207
  * Copy current sprite's properties to target
176
208
  *
@@ -23,6 +23,7 @@ export declare class PixiSpriteRenderer {
23
23
  private maskGraphics;
24
24
  private shadowGraphics;
25
25
  private shadowContainer;
26
+ private animationContainer;
26
27
  private resolution;
27
28
  private destroyed;
28
29
  constructor(_pixiApp: Application | null, sprite: IClip, targetContainer?: Container | null);
@@ -42,6 +43,8 @@ export declare class PixiSpriteRenderer {
42
43
  private applyStyle;
43
44
  private applyStroke;
44
45
  private applyShadow;
46
+ private applyBlur;
47
+ private applyBrightness;
45
48
  updateTransforms(): void;
46
49
  getSprite(): Sprite | null;
47
50
  getRoot(): Container | null;
package/dist/studio.d.ts CHANGED
@@ -33,45 +33,45 @@ interface GlobalEffectInfo {
33
33
  duration: number;
34
34
  }
35
35
  export interface StudioEvents {
36
- 'selection:created': {
36
+ "selection:created": {
37
37
  selected: IClip[];
38
38
  };
39
- 'selection:updated': {
39
+ "selection:updated": {
40
40
  selected: IClip[];
41
41
  };
42
- 'selection:cleared': {
42
+ "selection:cleared": {
43
43
  deselected: IClip[];
44
44
  };
45
- 'track:added': {
45
+ "track:added": {
46
46
  track: StudioTrack;
47
47
  index?: number;
48
48
  };
49
- 'track:order-changed': {
49
+ "track:order-changed": {
50
50
  tracks: StudioTrack[];
51
51
  };
52
- 'track:removed': {
52
+ "track:removed": {
53
53
  trackId: string;
54
54
  };
55
- 'clip:added': {
55
+ "clip:added": {
56
56
  clip: IClip;
57
57
  trackId: string;
58
58
  };
59
- 'clips:added': {
59
+ "clips:added": {
60
60
  clips: IClip[];
61
61
  trackId?: string;
62
62
  };
63
- 'clip:removed': {
63
+ "clip:removed": {
64
64
  clipId: string;
65
65
  };
66
- 'clip:updated': {
66
+ "clip:updated": {
67
67
  clip: IClip;
68
68
  };
69
- 'clip:replaced': {
69
+ "clip:replaced": {
70
70
  oldClip: IClip;
71
71
  newClip: IClip;
72
72
  trackId: string;
73
73
  };
74
- 'studio:restored': {
74
+ "studio:restored": {
75
75
  clips: IClip[];
76
76
  tracks: StudioTrack[];
77
77
  settings: IStudioOpts;
@@ -85,7 +85,7 @@ export interface StudioEvents {
85
85
  pause: {
86
86
  isPlaying: boolean;
87
87
  };
88
- 'history:changed': {
88
+ "history:changed": {
89
89
  canUndo: boolean;
90
90
  canRedo: boolean;
91
91
  };
@@ -127,7 +127,7 @@ export declare class Studio extends EventEmitter<StudioEvents> {
127
127
  set currentTime(val: number);
128
128
  get maxDuration(): number;
129
129
  set maxDuration(val: number);
130
- opts: Required<Omit<IStudioOpts, 'canvas'>> & {
130
+ opts: Required<Omit<IStudioOpts, "canvas">> & {
131
131
  canvas?: HTMLCanvasElement;
132
132
  };
133
133
  destroyed: boolean;
@@ -138,7 +138,7 @@ export declare class Studio extends EventEmitter<StudioEvents> {
138
138
  private clipCache;
139
139
  private _isUpdatingLayout;
140
140
  globalEffects: Map<string, GlobalEffectInfo>;
141
- activeGlobalEffect: ActiveGlobalEffect | null;
141
+ activeGlobalEffects: ActiveGlobalEffect[];
142
142
  currentGlobalEffectSprite: Sprite | null;
143
143
  effectFilters: Map<string, {
144
144
  filter: import('pixi.js').Filter;
@@ -348,7 +348,7 @@ export declare class Studio extends EventEmitter<StudioEvents> {
348
348
  removeGlobalEffect(id: string): void;
349
349
  clearGlobalEffects(): void;
350
350
  private updateActiveGlobalEffect;
351
- private applyGlobalEffectIfNeeded;
351
+ private applyGlobalEffects;
352
352
  /**
353
353
  * Destroy the studio and clean up resources
354
354
  */