pixi-effects 0.43.0 → 0.44.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.
- package/CHANGELOG.md +10 -0
- package/README.md +5 -5
- package/ai/chat-template.html +3 -3
- package/ai/tools/check.mjs +131 -2
- package/dist/Controller.d.cts +2 -2
- package/dist/Controller.d.ts +2 -2
- package/dist/{Movie-BdUm2Mc9.d.cts → Movie-B3VOAgwc.d.cts} +3 -3
- package/dist/{Movie-B_qQIYV6.d.ts → Movie-CQCVUqRs.d.ts} +3 -3
- package/dist/{chunk-6N5ZBUOU.js → chunk-4MBTYREC.js} +81 -31
- package/dist/chunk-4MBTYREC.js.map +1 -0
- package/dist/{chunk-BEGOKE7Q.cjs → chunk-MAAM45ZX.cjs} +80 -30
- package/dist/chunk-MAAM45ZX.cjs.map +1 -0
- package/dist/index.cjs +25 -25
- package/dist/index.d.cts +3 -4
- package/dist/index.d.ts +3 -4
- package/dist/index.js +1 -1
- package/dist/loader.css +1 -1
- package/dist/present.cjs +1 -1
- package/dist/present.d.cts +2 -2
- package/dist/present.d.ts +2 -2
- package/dist/present.js +1 -1
- package/dist/three.cjs +86 -16
- package/dist/three.cjs.map +1 -1
- package/dist/three.d.cts +22 -2
- package/dist/three.d.ts +22 -2
- package/dist/three.js +86 -16
- package/dist/three.js.map +1 -1
- package/dist/{types-DiNHtdrS.d.cts → types-C5xo0fzb.d.cts} +74 -2
- package/dist/{types-DiNHtdrS.d.ts → types-C5xo0fzb.d.ts} +74 -2
- package/docs/api.md +4 -2
- package/docs/dsl.md +1 -0
- package/llms-full.txt +9 -6
- package/package.json +1 -1
- package/skills/pixi-effects/SKILL.md +2 -2
- package/skills/pixi-effects/reference/recipes.md +2 -2
- package/skills/pixi-effects/template.html +6 -6
- package/dist/Base-DKFQtqzW.d.ts +0 -60
- package/dist/Base-lb5Uhaqu.d.cts +0 -60
- package/dist/chunk-6N5ZBUOU.js.map +0 -1
- package/dist/chunk-BEGOKE7Q.cjs.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkMAAM45ZX_cjs = require('./chunk-MAAM45ZX.cjs');
|
|
4
4
|
require('./chunk-3HZV3UHU.cjs');
|
|
5
5
|
var chunkX62H3RBG_cjs = require('./chunk-X62H3RBG.cjs');
|
|
6
6
|
var chunkLQDDDIC4_cjs = require('./chunk-LQDDDIC4.cjs');
|
|
@@ -12,99 +12,99 @@ var chunkTWZNOUM7_cjs = require('./chunk-TWZNOUM7.cjs');
|
|
|
12
12
|
|
|
13
13
|
Object.defineProperty(exports, "Movie", {
|
|
14
14
|
enumerable: true,
|
|
15
|
-
get: function () { return
|
|
15
|
+
get: function () { return chunkMAAM45ZX_cjs.Movie; }
|
|
16
16
|
});
|
|
17
17
|
Object.defineProperty(exports, "animateText", {
|
|
18
18
|
enumerable: true,
|
|
19
|
-
get: function () { return
|
|
19
|
+
get: function () { return chunkMAAM45ZX_cjs.animateText; }
|
|
20
20
|
});
|
|
21
21
|
Object.defineProperty(exports, "audioEnvelope", {
|
|
22
22
|
enumerable: true,
|
|
23
|
-
get: function () { return
|
|
23
|
+
get: function () { return chunkMAAM45ZX_cjs.audioEnvelope; }
|
|
24
24
|
});
|
|
25
25
|
Object.defineProperty(exports, "bpmEnvelope", {
|
|
26
26
|
enumerable: true,
|
|
27
|
-
get: function () { return
|
|
27
|
+
get: function () { return chunkMAAM45ZX_cjs.bpmEnvelope; }
|
|
28
28
|
});
|
|
29
29
|
Object.defineProperty(exports, "cameraPath", {
|
|
30
30
|
enumerable: true,
|
|
31
|
-
get: function () { return
|
|
31
|
+
get: function () { return chunkMAAM45ZX_cjs.cameraPath; }
|
|
32
32
|
});
|
|
33
33
|
Object.defineProperty(exports, "computeEnvelope", {
|
|
34
34
|
enumerable: true,
|
|
35
|
-
get: function () { return
|
|
35
|
+
get: function () { return chunkMAAM45ZX_cjs.computeEnvelope; }
|
|
36
36
|
});
|
|
37
37
|
Object.defineProperty(exports, "dismissLoader", {
|
|
38
38
|
enumerable: true,
|
|
39
|
-
get: function () { return
|
|
39
|
+
get: function () { return chunkMAAM45ZX_cjs.dismissLoader; }
|
|
40
40
|
});
|
|
41
41
|
Object.defineProperty(exports, "ease", {
|
|
42
42
|
enumerable: true,
|
|
43
|
-
get: function () { return
|
|
43
|
+
get: function () { return chunkMAAM45ZX_cjs.parseEase; }
|
|
44
44
|
});
|
|
45
45
|
Object.defineProperty(exports, "failLoader", {
|
|
46
46
|
enumerable: true,
|
|
47
|
-
get: function () { return
|
|
47
|
+
get: function () { return chunkMAAM45ZX_cjs.failLoader; }
|
|
48
48
|
});
|
|
49
49
|
Object.defineProperty(exports, "followPath", {
|
|
50
50
|
enumerable: true,
|
|
51
|
-
get: function () { return
|
|
51
|
+
get: function () { return chunkMAAM45ZX_cjs.followPath; }
|
|
52
52
|
});
|
|
53
53
|
Object.defineProperty(exports, "kenBurns", {
|
|
54
54
|
enumerable: true,
|
|
55
|
-
get: function () { return
|
|
55
|
+
get: function () { return chunkMAAM45ZX_cjs.kenBurns; }
|
|
56
56
|
});
|
|
57
57
|
Object.defineProperty(exports, "measureText", {
|
|
58
58
|
enumerable: true,
|
|
59
|
-
get: function () { return
|
|
59
|
+
get: function () { return chunkMAAM45ZX_cjs.measureText; }
|
|
60
60
|
});
|
|
61
61
|
Object.defineProperty(exports, "musicBuffer", {
|
|
62
62
|
enumerable: true,
|
|
63
|
-
get: function () { return
|
|
63
|
+
get: function () { return chunkMAAM45ZX_cjs.musicBuffer; }
|
|
64
64
|
});
|
|
65
65
|
Object.defineProperty(exports, "musicEnvelope", {
|
|
66
66
|
enumerable: true,
|
|
67
|
-
get: function () { return
|
|
67
|
+
get: function () { return chunkMAAM45ZX_cjs.musicEnvelope; }
|
|
68
68
|
});
|
|
69
69
|
Object.defineProperty(exports, "musicEvents", {
|
|
70
70
|
enumerable: true,
|
|
71
|
-
get: function () { return
|
|
71
|
+
get: function () { return chunkMAAM45ZX_cjs.musicEvents; }
|
|
72
72
|
});
|
|
73
73
|
Object.defineProperty(exports, "orbit", {
|
|
74
74
|
enumerable: true,
|
|
75
|
-
get: function () { return
|
|
75
|
+
get: function () { return chunkMAAM45ZX_cjs.orbit; }
|
|
76
76
|
});
|
|
77
77
|
Object.defineProperty(exports, "particles", {
|
|
78
78
|
enumerable: true,
|
|
79
|
-
get: function () { return
|
|
79
|
+
get: function () { return chunkMAAM45ZX_cjs.particles; }
|
|
80
80
|
});
|
|
81
81
|
Object.defineProperty(exports, "react", {
|
|
82
82
|
enumerable: true,
|
|
83
|
-
get: function () { return
|
|
83
|
+
get: function () { return chunkMAAM45ZX_cjs.react; }
|
|
84
84
|
});
|
|
85
85
|
Object.defineProperty(exports, "resolveLoader", {
|
|
86
86
|
enumerable: true,
|
|
87
|
-
get: function () { return
|
|
87
|
+
get: function () { return chunkMAAM45ZX_cjs.resolveLoader; }
|
|
88
88
|
});
|
|
89
89
|
Object.defineProperty(exports, "samplePath", {
|
|
90
90
|
enumerable: true,
|
|
91
|
-
get: function () { return
|
|
91
|
+
get: function () { return chunkMAAM45ZX_cjs.samplePath; }
|
|
92
92
|
});
|
|
93
93
|
Object.defineProperty(exports, "splitText", {
|
|
94
94
|
enumerable: true,
|
|
95
|
-
get: function () { return
|
|
95
|
+
get: function () { return chunkMAAM45ZX_cjs.splitText; }
|
|
96
96
|
});
|
|
97
97
|
Object.defineProperty(exports, "stagger", {
|
|
98
98
|
enumerable: true,
|
|
99
|
-
get: function () { return
|
|
99
|
+
get: function () { return chunkMAAM45ZX_cjs.stagger; }
|
|
100
100
|
});
|
|
101
101
|
Object.defineProperty(exports, "wiggle", {
|
|
102
102
|
enumerable: true,
|
|
103
|
-
get: function () { return
|
|
103
|
+
get: function () { return chunkMAAM45ZX_cjs.wiggle; }
|
|
104
104
|
});
|
|
105
105
|
Object.defineProperty(exports, "withFade", {
|
|
106
106
|
enumerable: true,
|
|
107
|
-
get: function () { return
|
|
107
|
+
get: function () { return chunkMAAM45ZX_cjs.withFade; }
|
|
108
108
|
});
|
|
109
109
|
Object.defineProperty(exports, "Sequence", {
|
|
110
110
|
enumerable: true,
|
package/dist/index.d.cts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
export { C as ContactSheetOptions, F as FontReport, b as FrameEvent, H as HoverOptions, I as InspectOptions, c as InspectReport, d as IssueGroup, L as LayerInfo, e as LoadProgressState, f as LoadStage, g as LoaderOption, h as LoopEvent, i as MotionBlurOptions, a as MotionBlurSpec, M as Movie, j as MovieErrorEvent, k as MovieOptions, O as OnionSkinOptions, P as PickHit, l as PickOptions, m as ProgressEvent, R as RebuildOptions, n as RebuildReason, o as RebuildReport, p as RenderOptions, q as ReviewOptions, r as ReviewReport, S as SnapshotOptions, T as ThumbnailOptions, s as TimelineData, t as TimelineHtmlOptions, u as TimelineRow, v as TimelineSvgOptions, w as TimelineTransition, V as VolumeEvent, x as dismissLoader, y as failLoader, z as resolveLoader } from './Movie-
|
|
2
|
-
import { S as SequenceSpec,
|
|
3
|
-
export {
|
|
1
|
+
export { C as ContactSheetOptions, F as FontReport, b as FrameEvent, H as HoverOptions, I as InspectOptions, c as InspectReport, d as IssueGroup, L as LayerInfo, e as LoadProgressState, f as LoadStage, g as LoaderOption, h as LoopEvent, i as MotionBlurOptions, a as MotionBlurSpec, M as Movie, j as MovieErrorEvent, k as MovieOptions, O as OnionSkinOptions, P as PickHit, l as PickOptions, m as ProgressEvent, R as RebuildOptions, n as RebuildReason, o as RebuildReport, p as RenderOptions, q as ReviewOptions, r as ReviewReport, S as SnapshotOptions, T as ThumbnailOptions, s as TimelineData, t as TimelineHtmlOptions, u as TimelineRow, v as TimelineSvgOptions, w as TimelineTransition, V as VolumeEvent, x as dismissLoader, y as failLoader, z as resolveLoader } from './Movie-B3VOAgwc.cjs';
|
|
2
|
+
import { S as SequenceSpec, g as CompositionShape, e as Sequence, I as ImageSequenceSpec, h as CameraSequenceSpec, K as Keyframe, i as TextSequenceSpec, M as MusicOptions, c as SequenceCommon } from './types-C5xo0fzb.cjs';
|
|
3
|
+
export { j as ArcShapeSpec, A as AssetSpec, k as AudioAssetSpec, l as AudioMusicSpec, m as AudioSequenceSpec, n as AudioSfxSpec, B as BlendModeName, o as CanvasInfo, p as CanvasSequenceSpec, q as ChromaKeyFilterSpec, r as CircleShapeSpec, s as CompositionSequenceSpec, C as CompositionSpec, t as CrossfadeTransition, u as CustomFilterSpec, D as DipTransition, v as DissolveTransition, E as EllipseShapeSpec, w as Expr, F as FilterSpec, G as GradientSpec, x as IrisTransition, L as LightSequenceSpec, y as LineShapeSpec, z as LumaTransition, H as MaskRefSpec, J as MatteRefSpec, N as MusicDrum, O as MusicDrums, Q as MusicInstrument, R as MusicLevel, U as MusicTrack, V as NullSequenceSpec, W as PathShapeSpec, X as PolygonShapeSpec, d as PropValue, P as Props, Y as RectShapeSpec, Z as SfxKnobs, _ as SfxOptions, $ as SfxPreset, a0 as SfxVoice, a1 as ShaderSequenceSpec, a2 as ShapeSequenceSpec, a3 as SlideTransition, b as SpaceNow, a as Stop, a4 as StopSpec, a5 as TextSpan, a6 as TransitionCommon, T as TransitionSpec, a7 as VideoSequenceSpec, a8 as WipeTransition, a9 as ZoomTransition } from './types-C5xo0fzb.cjs';
|
|
4
4
|
import { M as MusicEvents } from './soundEntry-DT13DNt8.cjs';
|
|
5
5
|
export { a as AudioInspectOptions, A as AudioReport, b as AudioSourceReport, c as MusicDrumEvents, d as MusicDrumHit, e as MusicNote, f as MusicSummary, g as MusicTrackEvents, S as SoundMeasure, h as SoundReport, i as inspectSound } from './soundEntry-DT13DNt8.cjs';
|
|
6
|
-
import { S as Sequence } from './Base-lb5Uhaqu.cjs';
|
|
7
6
|
import 'pixi.js';
|
|
8
7
|
|
|
9
8
|
/** A text style as written in a `text` layer's `style` (numbers, not expressions, for the fields that size the text). */
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
export { C as ContactSheetOptions, F as FontReport, b as FrameEvent, H as HoverOptions, I as InspectOptions, c as InspectReport, d as IssueGroup, L as LayerInfo, e as LoadProgressState, f as LoadStage, g as LoaderOption, h as LoopEvent, i as MotionBlurOptions, a as MotionBlurSpec, M as Movie, j as MovieErrorEvent, k as MovieOptions, O as OnionSkinOptions, P as PickHit, l as PickOptions, m as ProgressEvent, R as RebuildOptions, n as RebuildReason, o as RebuildReport, p as RenderOptions, q as ReviewOptions, r as ReviewReport, S as SnapshotOptions, T as ThumbnailOptions, s as TimelineData, t as TimelineHtmlOptions, u as TimelineRow, v as TimelineSvgOptions, w as TimelineTransition, V as VolumeEvent, x as dismissLoader, y as failLoader, z as resolveLoader } from './Movie-
|
|
2
|
-
import { S as SequenceSpec,
|
|
3
|
-
export {
|
|
1
|
+
export { C as ContactSheetOptions, F as FontReport, b as FrameEvent, H as HoverOptions, I as InspectOptions, c as InspectReport, d as IssueGroup, L as LayerInfo, e as LoadProgressState, f as LoadStage, g as LoaderOption, h as LoopEvent, i as MotionBlurOptions, a as MotionBlurSpec, M as Movie, j as MovieErrorEvent, k as MovieOptions, O as OnionSkinOptions, P as PickHit, l as PickOptions, m as ProgressEvent, R as RebuildOptions, n as RebuildReason, o as RebuildReport, p as RenderOptions, q as ReviewOptions, r as ReviewReport, S as SnapshotOptions, T as ThumbnailOptions, s as TimelineData, t as TimelineHtmlOptions, u as TimelineRow, v as TimelineSvgOptions, w as TimelineTransition, V as VolumeEvent, x as dismissLoader, y as failLoader, z as resolveLoader } from './Movie-CQCVUqRs.js';
|
|
2
|
+
import { S as SequenceSpec, g as CompositionShape, e as Sequence, I as ImageSequenceSpec, h as CameraSequenceSpec, K as Keyframe, i as TextSequenceSpec, M as MusicOptions, c as SequenceCommon } from './types-C5xo0fzb.js';
|
|
3
|
+
export { j as ArcShapeSpec, A as AssetSpec, k as AudioAssetSpec, l as AudioMusicSpec, m as AudioSequenceSpec, n as AudioSfxSpec, B as BlendModeName, o as CanvasInfo, p as CanvasSequenceSpec, q as ChromaKeyFilterSpec, r as CircleShapeSpec, s as CompositionSequenceSpec, C as CompositionSpec, t as CrossfadeTransition, u as CustomFilterSpec, D as DipTransition, v as DissolveTransition, E as EllipseShapeSpec, w as Expr, F as FilterSpec, G as GradientSpec, x as IrisTransition, L as LightSequenceSpec, y as LineShapeSpec, z as LumaTransition, H as MaskRefSpec, J as MatteRefSpec, N as MusicDrum, O as MusicDrums, Q as MusicInstrument, R as MusicLevel, U as MusicTrack, V as NullSequenceSpec, W as PathShapeSpec, X as PolygonShapeSpec, d as PropValue, P as Props, Y as RectShapeSpec, Z as SfxKnobs, _ as SfxOptions, $ as SfxPreset, a0 as SfxVoice, a1 as ShaderSequenceSpec, a2 as ShapeSequenceSpec, a3 as SlideTransition, b as SpaceNow, a as Stop, a4 as StopSpec, a5 as TextSpan, a6 as TransitionCommon, T as TransitionSpec, a7 as VideoSequenceSpec, a8 as WipeTransition, a9 as ZoomTransition } from './types-C5xo0fzb.js';
|
|
4
4
|
import { M as MusicEvents } from './soundEntry-DT13DNt8.js';
|
|
5
5
|
export { a as AudioInspectOptions, A as AudioReport, b as AudioSourceReport, c as MusicDrumEvents, d as MusicDrumHit, e as MusicNote, f as MusicSummary, g as MusicTrackEvents, S as SoundMeasure, h as SoundReport, i as inspectSound } from './soundEntry-DT13DNt8.js';
|
|
6
|
-
import { S as Sequence } from './Base-DKFQtqzW.js';
|
|
7
6
|
import 'pixi.js';
|
|
8
7
|
|
|
9
8
|
/** A text style as written in a `text` layer's `style` (numbers, not expressions, for the fields that size the text). */
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { Movie, animateText, audioEnvelope, bpmEnvelope, cameraPath, computeEnvelope, dismissLoader, parseEase as ease, failLoader, followPath, kenBurns, measureText, musicBuffer, musicEnvelope, musicEvents, orbit, particles, react, resolveLoader, samplePath, splitText, stagger, wiggle, withFade } from './chunk-
|
|
1
|
+
export { Movie, animateText, audioEnvelope, bpmEnvelope, cameraPath, computeEnvelope, dismissLoader, parseEase as ease, failLoader, followPath, kenBurns, measureText, musicBuffer, musicEnvelope, musicEvents, orbit, particles, react, resolveLoader, samplePath, splitText, stagger, wiggle, withFade } from './chunk-4MBTYREC.js';
|
|
2
2
|
import './chunk-ICI6ACHY.js';
|
|
3
3
|
export { Sequence, noise, noise2, rand, random, registerSequenceType } from './chunk-4QVQ5UJJ.js';
|
|
4
4
|
export { inspectSound } from './chunk-UHNSL2KJ.js';
|
package/dist/loader.css
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* pixi-effects loader: one line of HTML on the page, a few lines of CSS, no JavaScript of your own.
|
|
3
3
|
*
|
|
4
|
-
* <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/pixi-effects@0.
|
|
4
|
+
* <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/pixi-effects@0.44.0/dist/loader.css">
|
|
5
5
|
* <div class="stage" style="position: relative"> <!-- any box the canvas sits in, with position: relative -->
|
|
6
6
|
* <canvas id="stage" width="1280" height="720"></canvas>
|
|
7
7
|
* <div class="pe-loader" data-label="LOADING"></div> <!-- or class="pe-loader pe-loader--bar" -->
|
package/dist/present.cjs
CHANGED
package/dist/present.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { M as Movie, a as MotionBlurSpec } from './Movie-
|
|
2
|
-
import { S as SequenceSpec, P as Props, K as Keyframe, T as TransitionSpec,
|
|
1
|
+
import { M as Movie, a as MotionBlurSpec } from './Movie-B3VOAgwc.cjs';
|
|
2
|
+
import { S as SequenceSpec, P as Props, K as Keyframe, T as TransitionSpec, C as CompositionSpec, a as Stop } from './types-C5xo0fzb.cjs';
|
|
3
3
|
import 'pixi.js';
|
|
4
4
|
import './soundEntry-DT13DNt8.cjs';
|
|
5
5
|
|
package/dist/present.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { M as Movie, a as MotionBlurSpec } from './Movie-
|
|
2
|
-
import { S as SequenceSpec, P as Props, K as Keyframe, T as TransitionSpec,
|
|
1
|
+
import { M as Movie, a as MotionBlurSpec } from './Movie-CQCVUqRs.js';
|
|
2
|
+
import { S as SequenceSpec, P as Props, K as Keyframe, T as TransitionSpec, C as CompositionSpec, a as Stop } from './types-C5xo0fzb.js';
|
|
3
3
|
import 'pixi.js';
|
|
4
4
|
import './soundEntry-DT13DNt8.js';
|
|
5
5
|
|
package/dist/present.js
CHANGED
package/dist/three.cjs
CHANGED
|
@@ -183,6 +183,14 @@ var ThreeSequence = class extends chunkX62H3RBG_cjs.Sequence {
|
|
|
183
183
|
_rt = null;
|
|
184
184
|
// the texture a shared layer draws into
|
|
185
185
|
_sharedTexture = null;
|
|
186
|
+
_texture = null;
|
|
187
|
+
// what the layer's sprite shows (the canvas's, or the shared render target's)
|
|
188
|
+
/** What a rebuilt layer is compared with to take this one's place (core/reuse.ts); null: this layer is never kept (`reuse: false`, no `name`). */
|
|
189
|
+
_key = null;
|
|
190
|
+
/** The layer of the tree being replaced whose state this one is using until the new tree is on stage (`commitReuse`): not this layer's to let go. */
|
|
191
|
+
_borrowed = null;
|
|
192
|
+
/** True once another layer owns this layer's state: destroying this one must not let it go. */
|
|
193
|
+
_donated = false;
|
|
186
194
|
_scene = null;
|
|
187
195
|
_camera = null;
|
|
188
196
|
_ctx = null;
|
|
@@ -214,12 +222,18 @@ var ThreeSequence = class extends chunkX62H3RBG_cjs.Sequence {
|
|
|
214
222
|
const width = resolveDim(spec.width, scope) ?? this.parent?.width ?? this.root.width;
|
|
215
223
|
const height = resolveDim(spec.height, scope) ?? this.parent?.height ?? this.root.height;
|
|
216
224
|
const resolution = spec.resolution ?? 1;
|
|
217
|
-
const canvas = document.createElement("canvas");
|
|
218
225
|
const antialias = spec.antialias ?? true;
|
|
219
226
|
const kind = spec.renderer ?? getPageRenderer();
|
|
220
227
|
checkRendererKind(kind, "a three layer's renderer");
|
|
221
228
|
this._gpu = kind === "webgpu";
|
|
222
229
|
this.renderer = kind;
|
|
230
|
+
this._key = spec.reuse === false || !spec.name ? null : JSON.stringify([spec.name, idOf(spec.setup), width, height, resolution, antialias, kind, spec.shareGpu !== false && !!this.root.gpu, !!spec.followCamera, !!spec.followLights, !!spec.followFog]);
|
|
231
|
+
const donor = this._key !== null ? this.root.reuse?.claim(this._key) : null;
|
|
232
|
+
if (donor && donor._lendable()) {
|
|
233
|
+
this._borrow(donor, width, height, spec.name);
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
236
|
+
const canvas = document.createElement("canvas");
|
|
223
237
|
let renderer;
|
|
224
238
|
if (this._gpu) {
|
|
225
239
|
let mod;
|
|
@@ -291,20 +305,59 @@ var ThreeSequence = class extends chunkX62H3RBG_cjs.Sequence {
|
|
|
291
305
|
if (!("camera" in this._objects)) this._objects.camera = this._camera;
|
|
292
306
|
if (this._gpu) this._checkWebGpuMaterials(scene, spec.name);
|
|
293
307
|
this._draw(0);
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
sprite.cullable = true;
|
|
297
|
-
sprite.width = width;
|
|
298
|
-
sprite.height = height;
|
|
299
|
-
this.target = sprite;
|
|
300
|
-
this.intrinsicWidth = width;
|
|
301
|
-
this.intrinsicHeight = height;
|
|
302
|
-
this.buildFilters();
|
|
308
|
+
this._texture = this._sharedTexture ?? pixi_js.Texture.from(canvas);
|
|
309
|
+
this._makeSprite(this._texture, width, height, spec.name);
|
|
303
310
|
} catch (err) {
|
|
304
311
|
this._disposeRenderer();
|
|
305
312
|
throw err;
|
|
306
313
|
}
|
|
307
314
|
}
|
|
315
|
+
_makeSprite(texture, width, height, name) {
|
|
316
|
+
const sprite = new pixi_js.Sprite({ texture, label: name });
|
|
317
|
+
sprite.cullable = true;
|
|
318
|
+
sprite.width = width;
|
|
319
|
+
sprite.height = height;
|
|
320
|
+
this.target = sprite;
|
|
321
|
+
this.intrinsicWidth = width;
|
|
322
|
+
this.intrinsicHeight = height;
|
|
323
|
+
this.buildFilters();
|
|
324
|
+
}
|
|
325
|
+
/** Reuse (core/reuse.ts): the key this layer is matched by, while it can still lend its state. */
|
|
326
|
+
reuseKey() {
|
|
327
|
+
return this._renderer && !this._donated && !this._closing ? this._key : null;
|
|
328
|
+
}
|
|
329
|
+
_lendable() {
|
|
330
|
+
return this.reuseKey() !== null && !!this._scene && !!this._ctx && !!this._texture;
|
|
331
|
+
}
|
|
332
|
+
/** Take over a layer of the tree being replaced: its scene, renderer, texture and mirrors. Nothing is drawn until the new tree is on stage; the old layer goes on drawing meanwhile. */
|
|
333
|
+
_borrow(d, width, height, name) {
|
|
334
|
+
this.renderer = d.renderer;
|
|
335
|
+
this.backend = d.backend;
|
|
336
|
+
this._gpu = d._gpu;
|
|
337
|
+
this.sharedGpu = d.sharedGpu;
|
|
338
|
+
this._renderer = d._renderer;
|
|
339
|
+
this._scene = d._scene;
|
|
340
|
+
this._camera = d._camera;
|
|
341
|
+
this._ctx = d._ctx;
|
|
342
|
+
this._objects = d._objects;
|
|
343
|
+
this._rt = d._rt;
|
|
344
|
+
this._sharedTexture = d._sharedTexture;
|
|
345
|
+
this._texture = d._texture;
|
|
346
|
+
this._lightMirror = d._lightMirror;
|
|
347
|
+
this._fogMirror = d._fogMirror;
|
|
348
|
+
this._tracked = d._tracked;
|
|
349
|
+
this._borrowed = d;
|
|
350
|
+
if (this.spec && this._threeSpec.followCamera) this._checkFollowShape(width, height, name);
|
|
351
|
+
this._makeSprite(this._texture, width, height, name);
|
|
352
|
+
}
|
|
353
|
+
/** The new tree is on stage: the layer this one borrowed from has given its state away for good. */
|
|
354
|
+
commitReuse() {
|
|
355
|
+
const d = this._borrowed;
|
|
356
|
+
if (!d) return;
|
|
357
|
+
d._donated = true;
|
|
358
|
+
d._tracked = false;
|
|
359
|
+
this._borrowed = null;
|
|
360
|
+
}
|
|
308
361
|
/**
|
|
309
362
|
* Per-frame sync hook. Movie._awaitVideoFrames duck-types on this method
|
|
310
363
|
* (same contract as VideoSequence) and awaits it inside gotoFrame — the
|
|
@@ -661,25 +714,31 @@ var ThreeSequence = class extends chunkX62H3RBG_cjs.Sequence {
|
|
|
661
714
|
}
|
|
662
715
|
destroy() {
|
|
663
716
|
const spec = this._threeSpec;
|
|
664
|
-
|
|
717
|
+
const kept = this._donated || this._borrowed !== null;
|
|
718
|
+
if (!kept && this._ctx && spec.dispose) {
|
|
665
719
|
try {
|
|
666
720
|
spec.dispose(this._ctx);
|
|
667
721
|
} catch (err) {
|
|
668
722
|
console.warn("pixi-effects: three dispose() threw \u2014", err);
|
|
669
723
|
}
|
|
670
724
|
}
|
|
671
|
-
const texture = this.
|
|
672
|
-
|
|
725
|
+
const texture = this._texture;
|
|
726
|
+
if (!kept) {
|
|
727
|
+
this._lightMirror?.dispose();
|
|
728
|
+
this._fogMirror?.dispose();
|
|
729
|
+
this._disposeRenderer();
|
|
730
|
+
}
|
|
673
731
|
this._lightMirror = null;
|
|
674
|
-
this._fogMirror?.dispose();
|
|
675
732
|
this._fogMirror = null;
|
|
676
|
-
this.
|
|
733
|
+
this._renderer = null;
|
|
734
|
+
this._rt = null;
|
|
677
735
|
this._scene = null;
|
|
678
736
|
this._camera = null;
|
|
679
737
|
this._ctx = null;
|
|
680
738
|
this._objects = {};
|
|
681
739
|
super.destroy();
|
|
682
|
-
texture?.destroy(true);
|
|
740
|
+
if (!kept) texture?.destroy(true);
|
|
741
|
+
this._texture = null;
|
|
683
742
|
this._sharedTexture = null;
|
|
684
743
|
}
|
|
685
744
|
};
|
|
@@ -688,6 +747,17 @@ function resolveDim(v, scope) {
|
|
|
688
747
|
if (typeof v === "number") return v;
|
|
689
748
|
return chunkX62H3RBG_cjs.evaluateExpr(v, scope);
|
|
690
749
|
}
|
|
750
|
+
var ids = /* @__PURE__ */ new WeakMap();
|
|
751
|
+
var lastId = 0;
|
|
752
|
+
function idOf(fn) {
|
|
753
|
+
if (typeof fn !== "function") return 0;
|
|
754
|
+
let id = ids.get(fn);
|
|
755
|
+
if (id === void 0) {
|
|
756
|
+
id = ++lastId;
|
|
757
|
+
ids.set(fn, id);
|
|
758
|
+
}
|
|
759
|
+
return id;
|
|
760
|
+
}
|
|
691
761
|
async function threeGltf(url, options = {}) {
|
|
692
762
|
const label = "pixi-effects: threeGltf";
|
|
693
763
|
if (typeof url !== "string" || !url) throw new Error(`${label}: the first argument is the URL of a .glb or .gltf file`);
|