pixi-effects 0.45.0 → 0.47.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 +17 -0
- package/README.md +5 -5
- package/ai/chat-template.html +3 -3
- package/ai/tools/check.mjs +2 -2
- package/ai/tools/lookup.mjs +6 -1
- package/ai/tools/pixi-effects.mjs +1 -0
- package/ai/tools/render.mjs +17 -1
- package/dist/Composition-NSY7A32Y.js +7 -0
- package/dist/{Composition-YGBQX3HZ.js.map → Composition-NSY7A32Y.js.map} +1 -1
- package/dist/Composition-PME3P5LP.cjs +16 -0
- package/dist/{Composition-N6BOROJ2.cjs.map → Composition-PME3P5LP.cjs.map} +1 -1
- package/dist/Controller.d.cts +2 -2
- package/dist/Controller.d.ts +2 -2
- package/dist/{Movie-C-d4zN-N.d.cts → Movie-BqrAWN0g.d.cts} +6 -1
- package/dist/{Movie-lMSS9JwX.d.ts → Movie-sV8nJr_f.d.ts} +6 -1
- package/dist/{Spans-XTIWYSNO.cjs → Spans-2TZCNREQ.cjs} +9 -9
- package/dist/{Spans-XTIWYSNO.cjs.map → Spans-2TZCNREQ.cjs.map} +1 -1
- package/dist/{Spans-6L2ZVECX.js → Spans-TESJPQKX.js} +4 -4
- package/dist/{Spans-6L2ZVECX.js.map → Spans-TESJPQKX.js.map} +1 -1
- package/dist/{chunk-O66JGPVV.cjs → chunk-23SXKSUI.cjs} +18 -4
- package/dist/chunk-23SXKSUI.cjs.map +1 -0
- package/dist/{chunk-K24FF4BT.js → chunk-4SEL6W7H.js} +18 -4
- package/dist/chunk-4SEL6W7H.js.map +1 -0
- package/dist/{chunk-3HZV3UHU.cjs → chunk-DKCMJILW.cjs} +67 -65
- package/dist/chunk-DKCMJILW.cjs.map +1 -0
- package/dist/{chunk-4QVQ5UJJ.js → chunk-DM2OLQOJ.js} +5 -6
- package/dist/chunk-DM2OLQOJ.js.map +1 -0
- package/dist/{chunk-ICI6ACHY.js → chunk-FPV3NPYC.js} +8 -6
- package/dist/chunk-FPV3NPYC.js.map +1 -0
- package/dist/{chunk-3IO5RWE4.cjs → chunk-I6VUQ2CR.cjs} +188 -74
- package/dist/chunk-I6VUQ2CR.cjs.map +1 -0
- package/dist/{chunk-X62H3RBG.cjs → chunk-LALEBV63.cjs} +5 -6
- package/dist/chunk-LALEBV63.cjs.map +1 -0
- package/dist/{chunk-Z6JQO7GX.js → chunk-W46VWAZC.js} +146 -32
- package/dist/chunk-W46VWAZC.js.map +1 -0
- package/dist/index.cjs +35 -35
- package/dist/index.d.cts +5 -3
- package/dist/index.d.ts +5 -3
- package/dist/index.js +4 -4
- package/dist/loader.css +1 -1
- package/dist/present.cjs +4 -4
- package/dist/present.d.cts +2 -2
- package/dist/present.d.ts +2 -2
- package/dist/present.js +4 -4
- package/dist/sound.cjs +2 -2
- package/dist/sound.js +1 -1
- package/dist/three.cjs +194 -15
- package/dist/three.cjs.map +1 -1
- package/dist/three.d.cts +75 -4
- package/dist/three.d.ts +75 -4
- package/dist/three.js +191 -13
- package/dist/three.js.map +1 -1
- package/dist/{types-C5xo0fzb.d.cts → types-CTSrPvY3.d.cts} +64 -58
- package/dist/{types-C5xo0fzb.d.ts → types-CTSrPvY3.d.ts} +64 -58
- package/docs/api.md +2 -1
- package/docs/dsl.md +25 -1
- package/llms-full.txt +65 -6
- package/package.json +1 -1
- package/skills/pixi-effects/SKILL.md +1 -1
- package/skills/pixi-effects/reference/cheatsheet.md +3 -3
- package/skills/pixi-effects/reference/recipes.md +34 -0
- package/skills/pixi-effects/template.html +6 -6
- package/dist/Composition-N6BOROJ2.cjs +0 -16
- package/dist/Composition-YGBQX3HZ.js +0 -7
- package/dist/chunk-3HZV3UHU.cjs.map +0 -1
- package/dist/chunk-3IO5RWE4.cjs.map +0 -1
- package/dist/chunk-4QVQ5UJJ.js.map +0 -1
- package/dist/chunk-ICI6ACHY.js.map +0 -1
- package/dist/chunk-K24FF4BT.js.map +0 -1
- package/dist/chunk-O66JGPVV.cjs.map +0 -1
- package/dist/chunk-X62H3RBG.cjs.map +0 -1
- package/dist/chunk-Z6JQO7GX.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('./chunk-
|
|
5
|
-
var
|
|
6
|
-
var
|
|
3
|
+
var chunkI6VUQ2CR_cjs = require('./chunk-I6VUQ2CR.cjs');
|
|
4
|
+
require('./chunk-DKCMJILW.cjs');
|
|
5
|
+
var chunkLALEBV63_cjs = require('./chunk-LALEBV63.cjs');
|
|
6
|
+
var chunk23SXKSUI_cjs = require('./chunk-23SXKSUI.cjs');
|
|
7
7
|
require('./chunk-JN7JHNZR.cjs');
|
|
8
8
|
require('./chunk-3SAS3ZE5.cjs');
|
|
9
9
|
var chunkTWZNOUM7_cjs = require('./chunk-TWZNOUM7.cjs');
|
|
@@ -12,127 +12,127 @@ 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 chunkI6VUQ2CR_cjs.Movie; }
|
|
16
16
|
});
|
|
17
17
|
Object.defineProperty(exports, "animateText", {
|
|
18
18
|
enumerable: true,
|
|
19
|
-
get: function () { return
|
|
19
|
+
get: function () { return chunkI6VUQ2CR_cjs.animateText; }
|
|
20
20
|
});
|
|
21
21
|
Object.defineProperty(exports, "audioEnvelope", {
|
|
22
22
|
enumerable: true,
|
|
23
|
-
get: function () { return
|
|
23
|
+
get: function () { return chunkI6VUQ2CR_cjs.audioEnvelope; }
|
|
24
24
|
});
|
|
25
25
|
Object.defineProperty(exports, "bpmEnvelope", {
|
|
26
26
|
enumerable: true,
|
|
27
|
-
get: function () { return
|
|
27
|
+
get: function () { return chunkI6VUQ2CR_cjs.bpmEnvelope; }
|
|
28
28
|
});
|
|
29
29
|
Object.defineProperty(exports, "cameraPath", {
|
|
30
30
|
enumerable: true,
|
|
31
|
-
get: function () { return
|
|
31
|
+
get: function () { return chunkI6VUQ2CR_cjs.cameraPath; }
|
|
32
32
|
});
|
|
33
33
|
Object.defineProperty(exports, "computeEnvelope", {
|
|
34
34
|
enumerable: true,
|
|
35
|
-
get: function () { return
|
|
35
|
+
get: function () { return chunkI6VUQ2CR_cjs.computeEnvelope; }
|
|
36
36
|
});
|
|
37
37
|
Object.defineProperty(exports, "dismissLoader", {
|
|
38
38
|
enumerable: true,
|
|
39
|
-
get: function () { return
|
|
39
|
+
get: function () { return chunkI6VUQ2CR_cjs.dismissLoader; }
|
|
40
40
|
});
|
|
41
41
|
Object.defineProperty(exports, "ease", {
|
|
42
42
|
enumerable: true,
|
|
43
|
-
get: function () { return
|
|
43
|
+
get: function () { return chunkI6VUQ2CR_cjs.parseEase; }
|
|
44
44
|
});
|
|
45
45
|
Object.defineProperty(exports, "failLoader", {
|
|
46
46
|
enumerable: true,
|
|
47
|
-
get: function () { return
|
|
47
|
+
get: function () { return chunkI6VUQ2CR_cjs.failLoader; }
|
|
48
48
|
});
|
|
49
49
|
Object.defineProperty(exports, "followPath", {
|
|
50
50
|
enumerable: true,
|
|
51
|
-
get: function () { return
|
|
51
|
+
get: function () { return chunkI6VUQ2CR_cjs.followPath; }
|
|
52
52
|
});
|
|
53
53
|
Object.defineProperty(exports, "kenBurns", {
|
|
54
54
|
enumerable: true,
|
|
55
|
-
get: function () { return
|
|
55
|
+
get: function () { return chunkI6VUQ2CR_cjs.kenBurns; }
|
|
56
56
|
});
|
|
57
57
|
Object.defineProperty(exports, "measureText", {
|
|
58
58
|
enumerable: true,
|
|
59
|
-
get: function () { return
|
|
59
|
+
get: function () { return chunkI6VUQ2CR_cjs.measureText; }
|
|
60
60
|
});
|
|
61
61
|
Object.defineProperty(exports, "musicBuffer", {
|
|
62
62
|
enumerable: true,
|
|
63
|
-
get: function () { return
|
|
63
|
+
get: function () { return chunkI6VUQ2CR_cjs.musicBuffer; }
|
|
64
64
|
});
|
|
65
65
|
Object.defineProperty(exports, "musicEnvelope", {
|
|
66
66
|
enumerable: true,
|
|
67
|
-
get: function () { return
|
|
67
|
+
get: function () { return chunkI6VUQ2CR_cjs.musicEnvelope; }
|
|
68
68
|
});
|
|
69
69
|
Object.defineProperty(exports, "musicEvents", {
|
|
70
70
|
enumerable: true,
|
|
71
|
-
get: function () { return
|
|
71
|
+
get: function () { return chunkI6VUQ2CR_cjs.musicEvents; }
|
|
72
72
|
});
|
|
73
73
|
Object.defineProperty(exports, "orbit", {
|
|
74
74
|
enumerable: true,
|
|
75
|
-
get: function () { return
|
|
75
|
+
get: function () { return chunkI6VUQ2CR_cjs.orbit; }
|
|
76
76
|
});
|
|
77
77
|
Object.defineProperty(exports, "particles", {
|
|
78
78
|
enumerable: true,
|
|
79
|
-
get: function () { return
|
|
79
|
+
get: function () { return chunkI6VUQ2CR_cjs.particles; }
|
|
80
80
|
});
|
|
81
81
|
Object.defineProperty(exports, "react", {
|
|
82
82
|
enumerable: true,
|
|
83
|
-
get: function () { return
|
|
83
|
+
get: function () { return chunkI6VUQ2CR_cjs.react; }
|
|
84
84
|
});
|
|
85
85
|
Object.defineProperty(exports, "resolveLoader", {
|
|
86
86
|
enumerable: true,
|
|
87
|
-
get: function () { return
|
|
87
|
+
get: function () { return chunkI6VUQ2CR_cjs.resolveLoader; }
|
|
88
88
|
});
|
|
89
89
|
Object.defineProperty(exports, "samplePath", {
|
|
90
90
|
enumerable: true,
|
|
91
|
-
get: function () { return
|
|
91
|
+
get: function () { return chunkI6VUQ2CR_cjs.samplePath; }
|
|
92
92
|
});
|
|
93
93
|
Object.defineProperty(exports, "splitText", {
|
|
94
94
|
enumerable: true,
|
|
95
|
-
get: function () { return
|
|
95
|
+
get: function () { return chunkI6VUQ2CR_cjs.splitText; }
|
|
96
96
|
});
|
|
97
97
|
Object.defineProperty(exports, "stagger", {
|
|
98
98
|
enumerable: true,
|
|
99
|
-
get: function () { return
|
|
99
|
+
get: function () { return chunkI6VUQ2CR_cjs.stagger; }
|
|
100
100
|
});
|
|
101
101
|
Object.defineProperty(exports, "wiggle", {
|
|
102
102
|
enumerable: true,
|
|
103
|
-
get: function () { return
|
|
103
|
+
get: function () { return chunkI6VUQ2CR_cjs.wiggle; }
|
|
104
104
|
});
|
|
105
105
|
Object.defineProperty(exports, "withFade", {
|
|
106
106
|
enumerable: true,
|
|
107
|
-
get: function () { return
|
|
107
|
+
get: function () { return chunkI6VUQ2CR_cjs.withFade; }
|
|
108
108
|
});
|
|
109
109
|
Object.defineProperty(exports, "Sequence", {
|
|
110
110
|
enumerable: true,
|
|
111
|
-
get: function () { return
|
|
111
|
+
get: function () { return chunkLALEBV63_cjs.Sequence; }
|
|
112
112
|
});
|
|
113
113
|
Object.defineProperty(exports, "noise", {
|
|
114
114
|
enumerable: true,
|
|
115
|
-
get: function () { return
|
|
115
|
+
get: function () { return chunkLALEBV63_cjs.noise; }
|
|
116
116
|
});
|
|
117
117
|
Object.defineProperty(exports, "noise2", {
|
|
118
118
|
enumerable: true,
|
|
119
|
-
get: function () { return
|
|
119
|
+
get: function () { return chunkLALEBV63_cjs.noise2; }
|
|
120
120
|
});
|
|
121
121
|
Object.defineProperty(exports, "rand", {
|
|
122
122
|
enumerable: true,
|
|
123
|
-
get: function () { return
|
|
123
|
+
get: function () { return chunkLALEBV63_cjs.rand; }
|
|
124
124
|
});
|
|
125
125
|
Object.defineProperty(exports, "random", {
|
|
126
126
|
enumerable: true,
|
|
127
|
-
get: function () { return
|
|
127
|
+
get: function () { return chunkLALEBV63_cjs.random; }
|
|
128
128
|
});
|
|
129
129
|
Object.defineProperty(exports, "registerSequenceType", {
|
|
130
130
|
enumerable: true,
|
|
131
|
-
get: function () { return
|
|
131
|
+
get: function () { return chunkLALEBV63_cjs.registerSequenceType; }
|
|
132
132
|
});
|
|
133
133
|
Object.defineProperty(exports, "inspectSound", {
|
|
134
134
|
enumerable: true,
|
|
135
|
-
get: function () { return
|
|
135
|
+
get: function () { return chunk23SXKSUI_cjs.inspectSound; }
|
|
136
136
|
});
|
|
137
137
|
Object.defineProperty(exports, "warnUnknownOptions", {
|
|
138
138
|
enumerable: true,
|
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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, g as CompositionShape,
|
|
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,
|
|
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-BqrAWN0g.cjs';
|
|
2
|
+
import { S as SequenceSpec, g as CompositionShape, b as Sequence, I as ImageSequenceSpec, h as CameraSequenceSpec, K as Keyframe, i as TextSequenceSpec, M as MusicOptions, d as SequenceCommon } from './types-CTSrPvY3.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, e 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, c 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-CTSrPvY3.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
6
|
import 'pixi.js';
|
|
@@ -449,6 +449,8 @@ interface AnimateTextTween {
|
|
|
449
449
|
ease?: string;
|
|
450
450
|
/** `out` only: the composition second the exit starts at (every piece leaves in the same wave from then on, and holds its exit state until the layer ends). Without it the exit is the end of the layer run backwards. Not for `in` (an entrance starts with its piece: the options' `at`). */
|
|
451
451
|
at?: number;
|
|
452
|
+
/** `out` only: the wave of the exit, when it should not be the entrance's: `0` (all pieces leave at once), or `{ each: 0.1 }` and the other {@link stagger} options. Default: the same wave as the entrance (the options' `stagger`). */
|
|
453
|
+
stagger?: StaggerOptions | 0;
|
|
452
454
|
}
|
|
453
455
|
interface AnimateTextOptions {
|
|
454
456
|
/** What a piece is: a character (default), a word or a line. */
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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, g as CompositionShape,
|
|
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,
|
|
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-sV8nJr_f.js';
|
|
2
|
+
import { S as SequenceSpec, g as CompositionShape, b as Sequence, I as ImageSequenceSpec, h as CameraSequenceSpec, K as Keyframe, i as TextSequenceSpec, M as MusicOptions, d as SequenceCommon } from './types-CTSrPvY3.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, e 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, c 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-CTSrPvY3.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
6
|
import 'pixi.js';
|
|
@@ -449,6 +449,8 @@ interface AnimateTextTween {
|
|
|
449
449
|
ease?: string;
|
|
450
450
|
/** `out` only: the composition second the exit starts at (every piece leaves in the same wave from then on, and holds its exit state until the layer ends). Without it the exit is the end of the layer run backwards. Not for `in` (an entrance starts with its piece: the options' `at`). */
|
|
451
451
|
at?: number;
|
|
452
|
+
/** `out` only: the wave of the exit, when it should not be the entrance's: `0` (all pieces leave at once), or `{ each: 0.1 }` and the other {@link stagger} options. Default: the same wave as the entrance (the options' `stagger`). */
|
|
453
|
+
stagger?: StaggerOptions | 0;
|
|
452
454
|
}
|
|
453
455
|
interface AnimateTextOptions {
|
|
454
456
|
/** What a piece is: a character (default), a word or a line. */
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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-
|
|
2
|
-
import './chunk-
|
|
3
|
-
export { Sequence, noise, noise2, rand, random, registerSequenceType } from './chunk-
|
|
4
|
-
export { inspectSound } 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-W46VWAZC.js';
|
|
2
|
+
import './chunk-FPV3NPYC.js';
|
|
3
|
+
export { Sequence, noise, noise2, rand, random, registerSequenceType } from './chunk-DM2OLQOJ.js';
|
|
4
|
+
export { inspectSound } from './chunk-4SEL6W7H.js';
|
|
5
5
|
import './chunk-VNP7QCJE.js';
|
|
6
6
|
import './chunk-32MMNDDN.js';
|
|
7
7
|
export { warnUnknownOptions } from './chunk-BXOCEZ4U.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.47.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
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
require('./chunk-
|
|
4
|
-
require('./chunk-
|
|
5
|
-
require('./chunk-
|
|
6
|
-
require('./chunk-
|
|
3
|
+
require('./chunk-I6VUQ2CR.cjs');
|
|
4
|
+
require('./chunk-DKCMJILW.cjs');
|
|
5
|
+
require('./chunk-LALEBV63.cjs');
|
|
6
|
+
require('./chunk-23SXKSUI.cjs');
|
|
7
7
|
require('./chunk-JN7JHNZR.cjs');
|
|
8
8
|
require('./chunk-3SAS3ZE5.cjs');
|
|
9
9
|
var chunkTWZNOUM7_cjs = require('./chunk-TWZNOUM7.cjs');
|
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, C as CompositionSpec, a as Stop } from './types-
|
|
1
|
+
import { M as Movie, a as MotionBlurSpec } from './Movie-BqrAWN0g.cjs';
|
|
2
|
+
import { S as SequenceSpec, P as Props, K as Keyframe, T as TransitionSpec, C as CompositionSpec, a as Stop } from './types-CTSrPvY3.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, C as CompositionSpec, a as Stop } from './types-
|
|
1
|
+
import { M as Movie, a as MotionBlurSpec } from './Movie-sV8nJr_f.js';
|
|
2
|
+
import { S as SequenceSpec, P as Props, K as Keyframe, T as TransitionSpec, C as CompositionSpec, a as Stop } from './types-CTSrPvY3.js';
|
|
3
3
|
import 'pixi.js';
|
|
4
4
|
import './soundEntry-DT13DNt8.js';
|
|
5
5
|
|
package/dist/present.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import './chunk-
|
|
2
|
-
import './chunk-
|
|
3
|
-
import './chunk-
|
|
4
|
-
import './chunk-
|
|
1
|
+
import './chunk-W46VWAZC.js';
|
|
2
|
+
import './chunk-FPV3NPYC.js';
|
|
3
|
+
import './chunk-DM2OLQOJ.js';
|
|
4
|
+
import './chunk-4SEL6W7H.js';
|
|
5
5
|
import './chunk-VNP7QCJE.js';
|
|
6
6
|
import './chunk-32MMNDDN.js';
|
|
7
7
|
import { warnUnknownOptions } from './chunk-BXOCEZ4U.js';
|
package/dist/sound.cjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk23SXKSUI_cjs = require('./chunk-23SXKSUI.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
Object.defineProperty(exports, "inspectSound", {
|
|
8
8
|
enumerable: true,
|
|
9
|
-
get: function () { return
|
|
9
|
+
get: function () { return chunk23SXKSUI_cjs.inspectSound; }
|
|
10
10
|
});
|
|
11
11
|
//# sourceMappingURL=sound.cjs.map
|
|
12
12
|
//# sourceMappingURL=sound.cjs.map
|
package/dist/sound.js
CHANGED
package/dist/three.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkLALEBV63_cjs = require('./chunk-LALEBV63.cjs');
|
|
4
4
|
require('./chunk-3SAS3ZE5.cjs');
|
|
5
5
|
require('./chunk-TWZNOUM7.cjs');
|
|
6
6
|
var pixi_js = require('pixi.js');
|
|
@@ -170,7 +170,7 @@ function releaseThree(kind) {
|
|
|
170
170
|
|
|
171
171
|
// src/three/ThreeSequence.ts
|
|
172
172
|
var NOT_PURE = /\bMath\s*\.\s*random\s*\(|\bDate\s*\.\s*now\s*\(|\bperformance\s*\.\s*now\s*\(|\bnew\s+Date\s*\(/;
|
|
173
|
-
var ThreeSequence = class extends
|
|
173
|
+
var ThreeSequence = class extends chunkLALEBV63_cjs.Sequence {
|
|
174
174
|
_renderer = null;
|
|
175
175
|
/** The renderer this layer draws with (`'webgl'` or `'webgpu'`), once it is built. */
|
|
176
176
|
renderer = null;
|
|
@@ -191,6 +191,9 @@ var ThreeSequence = class extends chunkX62H3RBG_cjs.Sequence {
|
|
|
191
191
|
_borrowed = null;
|
|
192
192
|
/** True once another layer owns this layer's state: destroying this one must not let it go. */
|
|
193
193
|
_donated = false;
|
|
194
|
+
/** Things to do just before every draw (the 2D layers shown on meshes: `threeLayerTexture`), and those layers' handles. Both go with the state to a layer that takes it over. */
|
|
195
|
+
_drawHooks = /* @__PURE__ */ new Set();
|
|
196
|
+
_layerTextures = [];
|
|
194
197
|
_scene = null;
|
|
195
198
|
_camera = null;
|
|
196
199
|
_ctx = null;
|
|
@@ -218,7 +221,7 @@ var ThreeSequence = class extends chunkX62H3RBG_cjs.Sequence {
|
|
|
218
221
|
if (typeof spec.update === "function" && NOT_PURE.test(spec.update.toString())) {
|
|
219
222
|
console.warn(`pixi-effects: three layer${spec.name ? ` "${spec.name}"` : ""}: update calls Math.random, Date.now, performance.now or new Date, so it is not deterministic: the same frame would draw differently in playback, in a seek and in an export. Derive the value from t`);
|
|
220
223
|
}
|
|
221
|
-
const scope =
|
|
224
|
+
const scope = chunkLALEBV63_cjs.buildScope(this, this.parent, this.root);
|
|
222
225
|
const width = resolveDim(spec.width, scope) ?? this.parent?.width ?? this.root.width;
|
|
223
226
|
const height = resolveDim(spec.height, scope) ?? this.parent?.height ?? this.root.height;
|
|
224
227
|
const resolution = spec.resolution ?? 1;
|
|
@@ -289,7 +292,7 @@ var ThreeSequence = class extends chunkX62H3RBG_cjs.Sequence {
|
|
|
289
292
|
renderer.setClearColor(0, 0);
|
|
290
293
|
const scene = new three$1.Scene();
|
|
291
294
|
const camera = new three$1.PerspectiveCamera(50, width / height, 0.1, 2e3);
|
|
292
|
-
const ctx = { scene, camera, renderer, width, height };
|
|
295
|
+
const ctx = { scene, camera, renderer, width, height, _host: this._makeHost() };
|
|
293
296
|
if (spec.followCamera) this._checkFollowShape(width, height, spec.name);
|
|
294
297
|
let result;
|
|
295
298
|
try {
|
|
@@ -322,6 +325,29 @@ var ThreeSequence = class extends chunkX62H3RBG_cjs.Sequence {
|
|
|
322
325
|
this.intrinsicHeight = height;
|
|
323
326
|
this.buildFilters();
|
|
324
327
|
}
|
|
328
|
+
/** The 2D layer that a material shows (`threeLayerTexture`), for a click on the mesh to reach it (movie.pick); null for any other material. */
|
|
329
|
+
screenOf(material) {
|
|
330
|
+
const handle = this._layerTextures.find((h) => h.material === material);
|
|
331
|
+
return handle ? { source: handle.source() } : null;
|
|
332
|
+
}
|
|
333
|
+
/** What `threeLayerTexture` asks of this layer: the layers listed before it, PixiJS's renderer, whether the GPU device is shared, and a place to hook in before every draw. */
|
|
334
|
+
_makeHost() {
|
|
335
|
+
return {
|
|
336
|
+
findLayer: (name) => this.parent?.findLayer?.(name) ?? null,
|
|
337
|
+
layerNames: () => this.parent?.layerNames?.() ?? [],
|
|
338
|
+
pixiRenderer: this.root.pixiRenderer ?? null,
|
|
339
|
+
shared: this.sharedGpu,
|
|
340
|
+
beforeDraw: (fn) => {
|
|
341
|
+
this._drawHooks.add(fn);
|
|
342
|
+
return () => {
|
|
343
|
+
this._drawHooks.delete(fn);
|
|
344
|
+
};
|
|
345
|
+
},
|
|
346
|
+
track: (handle) => {
|
|
347
|
+
this._layerTextures.push(handle);
|
|
348
|
+
}
|
|
349
|
+
};
|
|
350
|
+
}
|
|
325
351
|
/** Reuse (core/reuse.ts): the key this layer is matched by, while it can still lend its state. */
|
|
326
352
|
reuseKey() {
|
|
327
353
|
return this._renderer && !this._donated && !this._closing ? this._key : null;
|
|
@@ -347,6 +373,10 @@ var ThreeSequence = class extends chunkX62H3RBG_cjs.Sequence {
|
|
|
347
373
|
this._fogMirror = d._fogMirror;
|
|
348
374
|
this._tracked = d._tracked;
|
|
349
375
|
this._borrowed = d;
|
|
376
|
+
this._drawHooks = d._drawHooks;
|
|
377
|
+
this._layerTextures = d._layerTextures;
|
|
378
|
+
const host = this._makeHost();
|
|
379
|
+
for (const h of this._layerTextures) h.rebind(host);
|
|
350
380
|
if (this.spec && this._threeSpec.followCamera) this._checkFollowShape(width, height, name);
|
|
351
381
|
this._makeSprite(this._texture, width, height, name);
|
|
352
382
|
}
|
|
@@ -404,7 +434,9 @@ var ThreeSequence = class extends chunkX62H3RBG_cjs.Sequence {
|
|
|
404
434
|
name = n.name;
|
|
405
435
|
break;
|
|
406
436
|
}
|
|
407
|
-
|
|
437
|
+
const m = hit.object.material;
|
|
438
|
+
const material = Array.isArray(m) ? m[hit.face?.materialIndex ?? 0] : m;
|
|
439
|
+
return { object: name, point: hit.point.toArray(), distance: hit.distance, object3d: hit.object, ...hit.uv ? { uv: { u: hit.uv.x, v: hit.uv.y } } : {}, material };
|
|
408
440
|
}
|
|
409
441
|
return null;
|
|
410
442
|
}
|
|
@@ -575,6 +607,7 @@ var ThreeSequence = class extends chunkX62H3RBG_cjs.Sequence {
|
|
|
575
607
|
*/
|
|
576
608
|
_draw(t, toCanvas = false) {
|
|
577
609
|
if (!this._renderer || !this._scene || !this._camera) return;
|
|
610
|
+
for (const hook of this._drawHooks) hook();
|
|
578
611
|
if (this._gpu) this._advanceNodeFrame(t);
|
|
579
612
|
if (!this._rt || toCanvas) {
|
|
580
613
|
this._renderer.render(this._scene, this._camera);
|
|
@@ -625,9 +658,9 @@ var ThreeSequence = class extends chunkX62H3RBG_cjs.Sequence {
|
|
|
625
658
|
if (!m || typeof m !== "object" || seen.has(m)) return;
|
|
626
659
|
seen.add(m);
|
|
627
660
|
const mat = m;
|
|
628
|
-
const
|
|
629
|
-
if (mat.isShaderMaterial || mat.isRawShaderMaterial) bad.push(`${
|
|
630
|
-
else if (Object.prototype.hasOwnProperty.call(mat, "onBeforeCompile")) bad.push(`${
|
|
661
|
+
const label2 = `${mat.name ? `"${mat.name}" ` : ""}${mat.type ?? "material"}`;
|
|
662
|
+
if (mat.isShaderMaterial || mat.isRawShaderMaterial) bad.push(`${label2} is a ShaderMaterial (it cannot run on the WebGPU renderer)`);
|
|
663
|
+
else if (Object.prototype.hasOwnProperty.call(mat, "onBeforeCompile")) bad.push(`${label2} sets onBeforeCompile (the WebGPU renderer ignores it)`);
|
|
631
664
|
};
|
|
632
665
|
scene.traverse?.((o) => {
|
|
633
666
|
const mats = o.material;
|
|
@@ -724,6 +757,12 @@ var ThreeSequence = class extends chunkX62H3RBG_cjs.Sequence {
|
|
|
724
757
|
}
|
|
725
758
|
const texture = this._texture;
|
|
726
759
|
if (!kept) {
|
|
760
|
+
for (const h of this._layerTextures) {
|
|
761
|
+
try {
|
|
762
|
+
h.dispose();
|
|
763
|
+
} catch {
|
|
764
|
+
}
|
|
765
|
+
}
|
|
727
766
|
this._lightMirror?.dispose();
|
|
728
767
|
this._fogMirror?.dispose();
|
|
729
768
|
this._disposeRenderer();
|
|
@@ -745,7 +784,7 @@ var ThreeSequence = class extends chunkX62H3RBG_cjs.Sequence {
|
|
|
745
784
|
function resolveDim(v, scope) {
|
|
746
785
|
if (v === void 0) return void 0;
|
|
747
786
|
if (typeof v === "number") return v;
|
|
748
|
-
return
|
|
787
|
+
return chunkLALEBV63_cjs.evaluateExpr(v, scope);
|
|
749
788
|
}
|
|
750
789
|
var ids = /* @__PURE__ */ new WeakMap();
|
|
751
790
|
var lastId = 0;
|
|
@@ -759,19 +798,19 @@ function idOf(fn) {
|
|
|
759
798
|
return id;
|
|
760
799
|
}
|
|
761
800
|
async function threeGltf(url, options = {}) {
|
|
762
|
-
const
|
|
763
|
-
if (typeof url !== "string" || !url) throw new Error(`${
|
|
801
|
+
const label2 = "pixi-effects: threeGltf";
|
|
802
|
+
if (typeof url !== "string" || !url) throw new Error(`${label2}: the first argument is the URL of a .glb or .gltf file`);
|
|
764
803
|
let GLTFLoader;
|
|
765
804
|
try {
|
|
766
805
|
({ GLTFLoader } = await import('three/addons/loaders/GLTFLoader.js'));
|
|
767
806
|
} catch (err) {
|
|
768
|
-
throw new Error(`${
|
|
807
|
+
throw new Error(`${label2}: needs "three/addons/" in the import map next to "three" (${err instanceof Error ? err.message : err})`);
|
|
769
808
|
}
|
|
770
809
|
let gltf;
|
|
771
810
|
try {
|
|
772
811
|
gltf = await new GLTFLoader().loadAsync(url);
|
|
773
812
|
} catch (err) {
|
|
774
|
-
throw new Error(`${
|
|
813
|
+
throw new Error(`${label2}: could not load "${url}" (${err instanceof Error ? err.message : err})`, { cause: err });
|
|
775
814
|
}
|
|
776
815
|
const clips = gltf.animations ?? [];
|
|
777
816
|
let clip;
|
|
@@ -780,7 +819,7 @@ async function threeGltf(url, options = {}) {
|
|
|
780
819
|
else if (wanted === void 0) clip = clips[0];
|
|
781
820
|
else {
|
|
782
821
|
clip = typeof wanted === "number" ? clips[wanted] : clips.find((c) => c.name === wanted);
|
|
783
|
-
if (!clip) throw new Error(`${
|
|
822
|
+
if (!clip) throw new Error(`${label2}: "${url}" has no animation ${JSON.stringify(wanted)}; its clips: ${clips.length ? clips.map((c, i) => `${i}: "${c.name}"`).join(", ") : "(none)"}`);
|
|
784
823
|
}
|
|
785
824
|
const root = gltf.scene;
|
|
786
825
|
root.traverse((o) => {
|
|
@@ -842,13 +881,152 @@ function threeFrameCamera(camera, object, options = {}) {
|
|
|
842
881
|
cam.lookAt(centre);
|
|
843
882
|
cam.updateProjectionMatrix();
|
|
844
883
|
}
|
|
884
|
+
var label = "pixi-effects: threeLayerTexture";
|
|
885
|
+
async function threeLayerTexture(ctx, name, options = {}) {
|
|
886
|
+
const host = ctx._host;
|
|
887
|
+
if (!host) throw new Error(`${label}: call it from the setup of a three layer: const screen = await threeLayerTexture(ctx, 'screen')`);
|
|
888
|
+
if (typeof name !== "string" || !name) throw new Error(`${label}: the second argument is the name of a 2D layer: threeLayerTexture(ctx, 'screen')`);
|
|
889
|
+
const resolution = options.resolution ?? 1;
|
|
890
|
+
const transparent = options.transparent === true;
|
|
891
|
+
if (!(Number.isFinite(resolution) && resolution > 0 && resolution <= 4)) throw new Error(`${label}: resolution is a number from above 0 to 4 (2 = twice the pixels), got ${JSON.stringify(options.resolution)}`);
|
|
892
|
+
const pixi = host.pixiRenderer;
|
|
893
|
+
if (!pixi) throw new Error(`${label}: PixiJS's renderer is not available here (the movie is not ready)`);
|
|
894
|
+
const source = host.findLayer(name);
|
|
895
|
+
if (!source) {
|
|
896
|
+
const names = host.layerNames();
|
|
897
|
+
throw new Error(`${label}: no layer named "${name}" before this three layer${names.length ? ` (the layers built before it: ${names.map((n) => `"${n}"`).join(", ")})` : ""}. A layer shown on a mesh must be listed BEFORE the three layer, in the same composition, and have that name.`);
|
|
898
|
+
}
|
|
899
|
+
if (source.spec.type !== "composition") {
|
|
900
|
+
throw new Error(`${label}: "${name}" is a ${source.spec.type} layer: a layer shown on a mesh must be a composition (wrap it: { type: 'composition', name: '${name}', width: 480, height: 270, sequences: [ \u2026 ] })`);
|
|
901
|
+
}
|
|
902
|
+
const width = Math.max(1, Math.round(source.intrinsicWidth * resolution)), height = Math.max(1, Math.round(source.intrinsicHeight * resolution));
|
|
903
|
+
const sharedRoute = host.shared && pixi.name === "webgpu";
|
|
904
|
+
const rt = pixi_js.RenderTexture.create({ width, height, resolution: 1, ...sharedRoute ? { autoGenerateMipmaps: true } : {} });
|
|
905
|
+
const gpuTexture = sharedRoute ? pixi.texture.getGpuSource?.(rt.source) : void 0;
|
|
906
|
+
let texture, material, readCanvas = null;
|
|
907
|
+
if (gpuTexture) {
|
|
908
|
+
let webgpu, tsl;
|
|
909
|
+
try {
|
|
910
|
+
[webgpu, tsl] = await Promise.all([import('three/webgpu'), import('three/tsl')]);
|
|
911
|
+
} catch (err) {
|
|
912
|
+
throw new Error(`${label}: needs "three/webgpu" and "three/tsl" in the import map (${err instanceof Error ? err.message : err})`);
|
|
913
|
+
}
|
|
914
|
+
const ext = new webgpu.ExternalTexture(gpuTexture);
|
|
915
|
+
ext.colorSpace = webgpu.NoColorSpace;
|
|
916
|
+
ext.minFilter = webgpu.LinearMipmapLinearFilter;
|
|
917
|
+
ext.magFilter = webgpu.LinearFilter;
|
|
918
|
+
ext.generateMipmaps = false;
|
|
919
|
+
ext.anisotropy = 4;
|
|
920
|
+
ext.repeat.set(1, -1);
|
|
921
|
+
ext.offset.set(0, 1);
|
|
922
|
+
const m = new webgpu.MeshBasicNodeMaterial();
|
|
923
|
+
const t = tsl.texture(ext);
|
|
924
|
+
const tex = t, vec4 = tsl.vec4, eotf = tsl.sRGBTransferEOTF, max = tsl.max;
|
|
925
|
+
const straight = eotf(vec4(tex.rgb.div(max(tex.a, 1e-4)), 1));
|
|
926
|
+
m.colorNode = transparent ? vec4(straight.rgb, tex.a) : vec4(eotf(vec4(tex.rgb, 1)).rgb, 1);
|
|
927
|
+
m.toneMapped = false;
|
|
928
|
+
if (transparent) {
|
|
929
|
+
m.transparent = true;
|
|
930
|
+
m.depthWrite = false;
|
|
931
|
+
}
|
|
932
|
+
texture = ext;
|
|
933
|
+
material = m;
|
|
934
|
+
} else {
|
|
935
|
+
const three2 = await import('three');
|
|
936
|
+
readCanvas = document.createElement("canvas");
|
|
937
|
+
readCanvas.width = width;
|
|
938
|
+
readCanvas.height = height;
|
|
939
|
+
const ct = new three2.CanvasTexture(readCanvas);
|
|
940
|
+
ct.colorSpace = three2.SRGBColorSpace;
|
|
941
|
+
texture = ct;
|
|
942
|
+
material = new three2.MeshBasicMaterial({ map: ct, toneMapped: false, ...transparent ? { transparent: true, depthWrite: false } : {} });
|
|
943
|
+
}
|
|
944
|
+
let current = source;
|
|
945
|
+
let display = source.target;
|
|
946
|
+
let sx = width / source.intrinsicWidth, sy = height / source.intrinsicHeight;
|
|
947
|
+
let hidden = false;
|
|
948
|
+
const hide = () => {
|
|
949
|
+
display.visible = false;
|
|
950
|
+
hidden = true;
|
|
951
|
+
};
|
|
952
|
+
hide();
|
|
953
|
+
const uncull = (c) => {
|
|
954
|
+
if (c.culled) c.culled = false;
|
|
955
|
+
for (const k of c.children) uncull(k);
|
|
956
|
+
};
|
|
957
|
+
const refresh = () => {
|
|
958
|
+
const m = new pixi_js.Matrix().scale(sx, sy);
|
|
959
|
+
display.visible = true;
|
|
960
|
+
uncull(display);
|
|
961
|
+
try {
|
|
962
|
+
pixi.render({ container: display, target: rt, transform: m, clear: true, clearColor: [0, 0, 0, 0] });
|
|
963
|
+
} finally {
|
|
964
|
+
display.visible = false;
|
|
965
|
+
}
|
|
966
|
+
if (gpuTexture) rt.source.updateMipmaps();
|
|
967
|
+
if (readCanvas) {
|
|
968
|
+
const g = readCanvas.getContext("2d");
|
|
969
|
+
if (transparent) {
|
|
970
|
+
const { pixels, width: w, height: h } = pixi.extract.pixels(rt);
|
|
971
|
+
for (let i = 0; i < pixels.length; i += 4) {
|
|
972
|
+
const a = pixels[i + 3];
|
|
973
|
+
if (a > 0 && a < 255) {
|
|
974
|
+
const k = 255 / a;
|
|
975
|
+
pixels[i] = pixels[i] * k;
|
|
976
|
+
pixels[i + 1] = pixels[i + 1] * k;
|
|
977
|
+
pixels[i + 2] = pixels[i + 2] * k;
|
|
978
|
+
}
|
|
979
|
+
}
|
|
980
|
+
g.putImageData(new ImageData(pixels, w, h), 0, 0);
|
|
981
|
+
} else {
|
|
982
|
+
g.clearRect(0, 0, width, height);
|
|
983
|
+
g.drawImage(pixi.extract.canvas(rt), 0, 0);
|
|
984
|
+
}
|
|
985
|
+
texture.needsUpdate = true;
|
|
986
|
+
}
|
|
987
|
+
};
|
|
988
|
+
const stop = host.beforeDraw(refresh);
|
|
989
|
+
refresh();
|
|
990
|
+
const handle = {
|
|
991
|
+
material,
|
|
992
|
+
texture,
|
|
993
|
+
width,
|
|
994
|
+
height,
|
|
995
|
+
source: () => current,
|
|
996
|
+
rebind(next) {
|
|
997
|
+
const again = next.findLayer(name);
|
|
998
|
+
if (!again) throw new Error(`${label}: after a rebuild there is no layer "${name}" before the three layer any more`);
|
|
999
|
+
current = again;
|
|
1000
|
+
display = again.target;
|
|
1001
|
+
sx = width / again.intrinsicWidth;
|
|
1002
|
+
sy = height / again.intrinsicHeight;
|
|
1003
|
+
hide();
|
|
1004
|
+
refresh();
|
|
1005
|
+
},
|
|
1006
|
+
dispose() {
|
|
1007
|
+
stop();
|
|
1008
|
+
if (hidden) {
|
|
1009
|
+
display.visible = true;
|
|
1010
|
+
hidden = false;
|
|
1011
|
+
}
|
|
1012
|
+
try {
|
|
1013
|
+
rt.destroy(true);
|
|
1014
|
+
} catch {
|
|
1015
|
+
}
|
|
1016
|
+
texture.dispose?.();
|
|
1017
|
+
material.dispose?.();
|
|
1018
|
+
}
|
|
1019
|
+
};
|
|
1020
|
+
host.track(handle);
|
|
1021
|
+
return handle;
|
|
1022
|
+
}
|
|
845
1023
|
|
|
846
1024
|
// src/three/index.ts
|
|
847
1025
|
function registerThree(options = {}) {
|
|
848
1026
|
const kind = options.renderer ?? "webgl";
|
|
849
1027
|
checkRendererKind(kind, "registerThree's renderer");
|
|
850
1028
|
setPageRenderer(kind);
|
|
851
|
-
|
|
1029
|
+
chunkLALEBV63_cjs.registerSequenceType("three", ThreeSequence);
|
|
852
1030
|
}
|
|
853
1031
|
function three(spec) {
|
|
854
1032
|
return spec;
|
|
@@ -859,5 +1037,6 @@ exports.registerThree = registerThree;
|
|
|
859
1037
|
exports.three = three;
|
|
860
1038
|
exports.threeFrameCamera = threeFrameCamera;
|
|
861
1039
|
exports.threeGltf = threeGltf;
|
|
1040
|
+
exports.threeLayerTexture = threeLayerTexture;
|
|
862
1041
|
//# sourceMappingURL=three.cjs.map
|
|
863
1042
|
//# sourceMappingURL=three.cjs.map
|