@remotion/transitions 4.0.519 → 4.0.520
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/esm/book-flip.mjs +50 -39
- package/dist/esm/cross-zoom.mjs +50 -39
- package/dist/esm/crosswarp.mjs +50 -39
- package/dist/esm/dissolve.mjs +50 -39
- package/dist/esm/dreamy-zoom.mjs +50 -39
- package/dist/esm/film-burn.mjs +50 -39
- package/dist/esm/index.mjs +50 -39
- package/dist/esm/linear-blur.mjs +50 -39
- package/dist/esm/ripple.mjs +50 -39
- package/dist/esm/swap.mjs +50 -39
- package/dist/esm/zoom-blur.mjs +50 -39
- package/dist/esm/zoom-in-out.mjs +50 -39
- package/dist/html-in-canvas-presentation.js +50 -38
- package/package.json +8 -8
package/dist/esm/index.mjs
CHANGED
|
@@ -158,54 +158,65 @@ var HtmlInCanvasPresentation = ({
|
|
|
158
158
|
};
|
|
159
159
|
}, [instance]);
|
|
160
160
|
const chainState = Internals.useEffectChainState();
|
|
161
|
-
const { delayRender, continueRender } = useDelayRender();
|
|
161
|
+
const { delayRender, continueRender, cancelRender } = useDelayRender();
|
|
162
162
|
const draw = useCallback(async (prevImage, nextImage, progress) => {
|
|
163
163
|
const outputCanvas = outputCanvasRef.current;
|
|
164
164
|
if (!outputCanvas) {
|
|
165
165
|
throw new Error("Canvas not found");
|
|
166
166
|
}
|
|
167
167
|
const handle = delayRender("onPaint");
|
|
168
|
-
|
|
169
|
-
const
|
|
170
|
-
|
|
171
|
-
|
|
168
|
+
try {
|
|
169
|
+
const clearOutput = () => {
|
|
170
|
+
const context = outputCanvas.getContext("2d");
|
|
171
|
+
if (!context) {
|
|
172
|
+
throw new Error("Failed to create output canvas context");
|
|
173
|
+
}
|
|
174
|
+
context.clearRect(0, 0, outputCanvas.width, outputCanvas.height);
|
|
175
|
+
};
|
|
176
|
+
if (!prevImage && !nextImage) {
|
|
177
|
+
instance.clear();
|
|
178
|
+
clearOutput();
|
|
179
|
+
continueRender(handle);
|
|
180
|
+
return;
|
|
172
181
|
}
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
182
|
+
const width = prevImage?.width ?? nextImage?.width ?? 0;
|
|
183
|
+
const height = prevImage?.height ?? nextImage?.height ?? 0;
|
|
184
|
+
if (width === 0 || height === 0) {
|
|
185
|
+
instance.clear();
|
|
186
|
+
clearOutput();
|
|
187
|
+
continueRender(handle);
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
shaderCanvas.width = width;
|
|
191
|
+
shaderCanvas.height = height;
|
|
192
|
+
instance.draw({
|
|
193
|
+
prevImage,
|
|
194
|
+
nextImage,
|
|
195
|
+
width,
|
|
196
|
+
height,
|
|
197
|
+
time: progress,
|
|
198
|
+
passedProps: passedPropsRef.current
|
|
199
|
+
});
|
|
200
|
+
await Internals.runEffectChain({
|
|
201
|
+
state: chainState.get(width, height),
|
|
202
|
+
source: shaderCanvas,
|
|
203
|
+
effects: effectsRef.current ?? [],
|
|
204
|
+
width,
|
|
205
|
+
height,
|
|
206
|
+
output: outputCanvas
|
|
207
|
+
});
|
|
186
208
|
continueRender(handle);
|
|
187
|
-
|
|
209
|
+
} catch (error) {
|
|
210
|
+
cancelRender(error);
|
|
188
211
|
}
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
passedProps: passedPropsRef.current
|
|
198
|
-
});
|
|
199
|
-
await Internals.runEffectChain({
|
|
200
|
-
state: chainState.get(width, height),
|
|
201
|
-
source: shaderCanvas,
|
|
202
|
-
effects: effectsRef.current ?? [],
|
|
203
|
-
width,
|
|
204
|
-
height,
|
|
205
|
-
output: outputCanvas
|
|
206
|
-
});
|
|
207
|
-
continueRender(handle);
|
|
208
|
-
}, [chainState, continueRender, delayRender, instance, shaderCanvas]);
|
|
212
|
+
}, [
|
|
213
|
+
cancelRender,
|
|
214
|
+
chainState,
|
|
215
|
+
continueRender,
|
|
216
|
+
delayRender,
|
|
217
|
+
instance,
|
|
218
|
+
shaderCanvas
|
|
219
|
+
]);
|
|
209
220
|
const passThrough = bothEnteringAndExiting && presentationDirection === "exiting";
|
|
210
221
|
useLayoutEffect(() => {
|
|
211
222
|
if (passThrough) {
|
package/dist/esm/linear-blur.mjs
CHANGED
|
@@ -80,54 +80,65 @@ var HtmlInCanvasPresentation = ({
|
|
|
80
80
|
};
|
|
81
81
|
}, [instance]);
|
|
82
82
|
const chainState = Internals.useEffectChainState();
|
|
83
|
-
const { delayRender, continueRender } = useDelayRender();
|
|
83
|
+
const { delayRender, continueRender, cancelRender } = useDelayRender();
|
|
84
84
|
const draw = useCallback(async (prevImage, nextImage, progress) => {
|
|
85
85
|
const outputCanvas = outputCanvasRef.current;
|
|
86
86
|
if (!outputCanvas) {
|
|
87
87
|
throw new Error("Canvas not found");
|
|
88
88
|
}
|
|
89
89
|
const handle = delayRender("onPaint");
|
|
90
|
-
|
|
91
|
-
const
|
|
92
|
-
|
|
93
|
-
|
|
90
|
+
try {
|
|
91
|
+
const clearOutput = () => {
|
|
92
|
+
const context = outputCanvas.getContext("2d");
|
|
93
|
+
if (!context) {
|
|
94
|
+
throw new Error("Failed to create output canvas context");
|
|
95
|
+
}
|
|
96
|
+
context.clearRect(0, 0, outputCanvas.width, outputCanvas.height);
|
|
97
|
+
};
|
|
98
|
+
if (!prevImage && !nextImage) {
|
|
99
|
+
instance.clear();
|
|
100
|
+
clearOutput();
|
|
101
|
+
continueRender(handle);
|
|
102
|
+
return;
|
|
94
103
|
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
104
|
+
const width = prevImage?.width ?? nextImage?.width ?? 0;
|
|
105
|
+
const height = prevImage?.height ?? nextImage?.height ?? 0;
|
|
106
|
+
if (width === 0 || height === 0) {
|
|
107
|
+
instance.clear();
|
|
108
|
+
clearOutput();
|
|
109
|
+
continueRender(handle);
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
shaderCanvas.width = width;
|
|
113
|
+
shaderCanvas.height = height;
|
|
114
|
+
instance.draw({
|
|
115
|
+
prevImage,
|
|
116
|
+
nextImage,
|
|
117
|
+
width,
|
|
118
|
+
height,
|
|
119
|
+
time: progress,
|
|
120
|
+
passedProps: passedPropsRef.current
|
|
121
|
+
});
|
|
122
|
+
await Internals.runEffectChain({
|
|
123
|
+
state: chainState.get(width, height),
|
|
124
|
+
source: shaderCanvas,
|
|
125
|
+
effects: effectsRef.current ?? [],
|
|
126
|
+
width,
|
|
127
|
+
height,
|
|
128
|
+
output: outputCanvas
|
|
129
|
+
});
|
|
108
130
|
continueRender(handle);
|
|
109
|
-
|
|
131
|
+
} catch (error) {
|
|
132
|
+
cancelRender(error);
|
|
110
133
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
passedProps: passedPropsRef.current
|
|
120
|
-
});
|
|
121
|
-
await Internals.runEffectChain({
|
|
122
|
-
state: chainState.get(width, height),
|
|
123
|
-
source: shaderCanvas,
|
|
124
|
-
effects: effectsRef.current ?? [],
|
|
125
|
-
width,
|
|
126
|
-
height,
|
|
127
|
-
output: outputCanvas
|
|
128
|
-
});
|
|
129
|
-
continueRender(handle);
|
|
130
|
-
}, [chainState, continueRender, delayRender, instance, shaderCanvas]);
|
|
134
|
+
}, [
|
|
135
|
+
cancelRender,
|
|
136
|
+
chainState,
|
|
137
|
+
continueRender,
|
|
138
|
+
delayRender,
|
|
139
|
+
instance,
|
|
140
|
+
shaderCanvas
|
|
141
|
+
]);
|
|
131
142
|
const passThrough = bothEnteringAndExiting && presentationDirection === "exiting";
|
|
132
143
|
useLayoutEffect(() => {
|
|
133
144
|
if (passThrough) {
|
package/dist/esm/ripple.mjs
CHANGED
|
@@ -80,54 +80,65 @@ var HtmlInCanvasPresentation = ({
|
|
|
80
80
|
};
|
|
81
81
|
}, [instance]);
|
|
82
82
|
const chainState = Internals.useEffectChainState();
|
|
83
|
-
const { delayRender, continueRender } = useDelayRender();
|
|
83
|
+
const { delayRender, continueRender, cancelRender } = useDelayRender();
|
|
84
84
|
const draw = useCallback(async (prevImage, nextImage, progress) => {
|
|
85
85
|
const outputCanvas = outputCanvasRef.current;
|
|
86
86
|
if (!outputCanvas) {
|
|
87
87
|
throw new Error("Canvas not found");
|
|
88
88
|
}
|
|
89
89
|
const handle = delayRender("onPaint");
|
|
90
|
-
|
|
91
|
-
const
|
|
92
|
-
|
|
93
|
-
|
|
90
|
+
try {
|
|
91
|
+
const clearOutput = () => {
|
|
92
|
+
const context = outputCanvas.getContext("2d");
|
|
93
|
+
if (!context) {
|
|
94
|
+
throw new Error("Failed to create output canvas context");
|
|
95
|
+
}
|
|
96
|
+
context.clearRect(0, 0, outputCanvas.width, outputCanvas.height);
|
|
97
|
+
};
|
|
98
|
+
if (!prevImage && !nextImage) {
|
|
99
|
+
instance.clear();
|
|
100
|
+
clearOutput();
|
|
101
|
+
continueRender(handle);
|
|
102
|
+
return;
|
|
94
103
|
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
104
|
+
const width = prevImage?.width ?? nextImage?.width ?? 0;
|
|
105
|
+
const height = prevImage?.height ?? nextImage?.height ?? 0;
|
|
106
|
+
if (width === 0 || height === 0) {
|
|
107
|
+
instance.clear();
|
|
108
|
+
clearOutput();
|
|
109
|
+
continueRender(handle);
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
shaderCanvas.width = width;
|
|
113
|
+
shaderCanvas.height = height;
|
|
114
|
+
instance.draw({
|
|
115
|
+
prevImage,
|
|
116
|
+
nextImage,
|
|
117
|
+
width,
|
|
118
|
+
height,
|
|
119
|
+
time: progress,
|
|
120
|
+
passedProps: passedPropsRef.current
|
|
121
|
+
});
|
|
122
|
+
await Internals.runEffectChain({
|
|
123
|
+
state: chainState.get(width, height),
|
|
124
|
+
source: shaderCanvas,
|
|
125
|
+
effects: effectsRef.current ?? [],
|
|
126
|
+
width,
|
|
127
|
+
height,
|
|
128
|
+
output: outputCanvas
|
|
129
|
+
});
|
|
108
130
|
continueRender(handle);
|
|
109
|
-
|
|
131
|
+
} catch (error) {
|
|
132
|
+
cancelRender(error);
|
|
110
133
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
passedProps: passedPropsRef.current
|
|
120
|
-
});
|
|
121
|
-
await Internals.runEffectChain({
|
|
122
|
-
state: chainState.get(width, height),
|
|
123
|
-
source: shaderCanvas,
|
|
124
|
-
effects: effectsRef.current ?? [],
|
|
125
|
-
width,
|
|
126
|
-
height,
|
|
127
|
-
output: outputCanvas
|
|
128
|
-
});
|
|
129
|
-
continueRender(handle);
|
|
130
|
-
}, [chainState, continueRender, delayRender, instance, shaderCanvas]);
|
|
134
|
+
}, [
|
|
135
|
+
cancelRender,
|
|
136
|
+
chainState,
|
|
137
|
+
continueRender,
|
|
138
|
+
delayRender,
|
|
139
|
+
instance,
|
|
140
|
+
shaderCanvas
|
|
141
|
+
]);
|
|
131
142
|
const passThrough = bothEnteringAndExiting && presentationDirection === "exiting";
|
|
132
143
|
useLayoutEffect(() => {
|
|
133
144
|
if (passThrough) {
|
package/dist/esm/swap.mjs
CHANGED
|
@@ -80,54 +80,65 @@ var HtmlInCanvasPresentation = ({
|
|
|
80
80
|
};
|
|
81
81
|
}, [instance]);
|
|
82
82
|
const chainState = Internals.useEffectChainState();
|
|
83
|
-
const { delayRender, continueRender } = useDelayRender();
|
|
83
|
+
const { delayRender, continueRender, cancelRender } = useDelayRender();
|
|
84
84
|
const draw = useCallback(async (prevImage, nextImage, progress) => {
|
|
85
85
|
const outputCanvas = outputCanvasRef.current;
|
|
86
86
|
if (!outputCanvas) {
|
|
87
87
|
throw new Error("Canvas not found");
|
|
88
88
|
}
|
|
89
89
|
const handle = delayRender("onPaint");
|
|
90
|
-
|
|
91
|
-
const
|
|
92
|
-
|
|
93
|
-
|
|
90
|
+
try {
|
|
91
|
+
const clearOutput = () => {
|
|
92
|
+
const context = outputCanvas.getContext("2d");
|
|
93
|
+
if (!context) {
|
|
94
|
+
throw new Error("Failed to create output canvas context");
|
|
95
|
+
}
|
|
96
|
+
context.clearRect(0, 0, outputCanvas.width, outputCanvas.height);
|
|
97
|
+
};
|
|
98
|
+
if (!prevImage && !nextImage) {
|
|
99
|
+
instance.clear();
|
|
100
|
+
clearOutput();
|
|
101
|
+
continueRender(handle);
|
|
102
|
+
return;
|
|
94
103
|
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
104
|
+
const width = prevImage?.width ?? nextImage?.width ?? 0;
|
|
105
|
+
const height = prevImage?.height ?? nextImage?.height ?? 0;
|
|
106
|
+
if (width === 0 || height === 0) {
|
|
107
|
+
instance.clear();
|
|
108
|
+
clearOutput();
|
|
109
|
+
continueRender(handle);
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
shaderCanvas.width = width;
|
|
113
|
+
shaderCanvas.height = height;
|
|
114
|
+
instance.draw({
|
|
115
|
+
prevImage,
|
|
116
|
+
nextImage,
|
|
117
|
+
width,
|
|
118
|
+
height,
|
|
119
|
+
time: progress,
|
|
120
|
+
passedProps: passedPropsRef.current
|
|
121
|
+
});
|
|
122
|
+
await Internals.runEffectChain({
|
|
123
|
+
state: chainState.get(width, height),
|
|
124
|
+
source: shaderCanvas,
|
|
125
|
+
effects: effectsRef.current ?? [],
|
|
126
|
+
width,
|
|
127
|
+
height,
|
|
128
|
+
output: outputCanvas
|
|
129
|
+
});
|
|
108
130
|
continueRender(handle);
|
|
109
|
-
|
|
131
|
+
} catch (error) {
|
|
132
|
+
cancelRender(error);
|
|
110
133
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
passedProps: passedPropsRef.current
|
|
120
|
-
});
|
|
121
|
-
await Internals.runEffectChain({
|
|
122
|
-
state: chainState.get(width, height),
|
|
123
|
-
source: shaderCanvas,
|
|
124
|
-
effects: effectsRef.current ?? [],
|
|
125
|
-
width,
|
|
126
|
-
height,
|
|
127
|
-
output: outputCanvas
|
|
128
|
-
});
|
|
129
|
-
continueRender(handle);
|
|
130
|
-
}, [chainState, continueRender, delayRender, instance, shaderCanvas]);
|
|
134
|
+
}, [
|
|
135
|
+
cancelRender,
|
|
136
|
+
chainState,
|
|
137
|
+
continueRender,
|
|
138
|
+
delayRender,
|
|
139
|
+
instance,
|
|
140
|
+
shaderCanvas
|
|
141
|
+
]);
|
|
131
142
|
const passThrough = bothEnteringAndExiting && presentationDirection === "exiting";
|
|
132
143
|
useLayoutEffect(() => {
|
|
133
144
|
if (passThrough) {
|
package/dist/esm/zoom-blur.mjs
CHANGED
|
@@ -80,54 +80,65 @@ var HtmlInCanvasPresentation = ({
|
|
|
80
80
|
};
|
|
81
81
|
}, [instance]);
|
|
82
82
|
const chainState = Internals.useEffectChainState();
|
|
83
|
-
const { delayRender, continueRender } = useDelayRender();
|
|
83
|
+
const { delayRender, continueRender, cancelRender } = useDelayRender();
|
|
84
84
|
const draw = useCallback(async (prevImage, nextImage, progress) => {
|
|
85
85
|
const outputCanvas = outputCanvasRef.current;
|
|
86
86
|
if (!outputCanvas) {
|
|
87
87
|
throw new Error("Canvas not found");
|
|
88
88
|
}
|
|
89
89
|
const handle = delayRender("onPaint");
|
|
90
|
-
|
|
91
|
-
const
|
|
92
|
-
|
|
93
|
-
|
|
90
|
+
try {
|
|
91
|
+
const clearOutput = () => {
|
|
92
|
+
const context = outputCanvas.getContext("2d");
|
|
93
|
+
if (!context) {
|
|
94
|
+
throw new Error("Failed to create output canvas context");
|
|
95
|
+
}
|
|
96
|
+
context.clearRect(0, 0, outputCanvas.width, outputCanvas.height);
|
|
97
|
+
};
|
|
98
|
+
if (!prevImage && !nextImage) {
|
|
99
|
+
instance.clear();
|
|
100
|
+
clearOutput();
|
|
101
|
+
continueRender(handle);
|
|
102
|
+
return;
|
|
94
103
|
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
104
|
+
const width = prevImage?.width ?? nextImage?.width ?? 0;
|
|
105
|
+
const height = prevImage?.height ?? nextImage?.height ?? 0;
|
|
106
|
+
if (width === 0 || height === 0) {
|
|
107
|
+
instance.clear();
|
|
108
|
+
clearOutput();
|
|
109
|
+
continueRender(handle);
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
shaderCanvas.width = width;
|
|
113
|
+
shaderCanvas.height = height;
|
|
114
|
+
instance.draw({
|
|
115
|
+
prevImage,
|
|
116
|
+
nextImage,
|
|
117
|
+
width,
|
|
118
|
+
height,
|
|
119
|
+
time: progress,
|
|
120
|
+
passedProps: passedPropsRef.current
|
|
121
|
+
});
|
|
122
|
+
await Internals.runEffectChain({
|
|
123
|
+
state: chainState.get(width, height),
|
|
124
|
+
source: shaderCanvas,
|
|
125
|
+
effects: effectsRef.current ?? [],
|
|
126
|
+
width,
|
|
127
|
+
height,
|
|
128
|
+
output: outputCanvas
|
|
129
|
+
});
|
|
108
130
|
continueRender(handle);
|
|
109
|
-
|
|
131
|
+
} catch (error) {
|
|
132
|
+
cancelRender(error);
|
|
110
133
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
passedProps: passedPropsRef.current
|
|
120
|
-
});
|
|
121
|
-
await Internals.runEffectChain({
|
|
122
|
-
state: chainState.get(width, height),
|
|
123
|
-
source: shaderCanvas,
|
|
124
|
-
effects: effectsRef.current ?? [],
|
|
125
|
-
width,
|
|
126
|
-
height,
|
|
127
|
-
output: outputCanvas
|
|
128
|
-
});
|
|
129
|
-
continueRender(handle);
|
|
130
|
-
}, [chainState, continueRender, delayRender, instance, shaderCanvas]);
|
|
134
|
+
}, [
|
|
135
|
+
cancelRender,
|
|
136
|
+
chainState,
|
|
137
|
+
continueRender,
|
|
138
|
+
delayRender,
|
|
139
|
+
instance,
|
|
140
|
+
shaderCanvas
|
|
141
|
+
]);
|
|
131
142
|
const passThrough = bothEnteringAndExiting && presentationDirection === "exiting";
|
|
132
143
|
useLayoutEffect(() => {
|
|
133
144
|
if (passThrough) {
|
package/dist/esm/zoom-in-out.mjs
CHANGED
|
@@ -80,54 +80,65 @@ var HtmlInCanvasPresentation = ({
|
|
|
80
80
|
};
|
|
81
81
|
}, [instance]);
|
|
82
82
|
const chainState = Internals.useEffectChainState();
|
|
83
|
-
const { delayRender, continueRender } = useDelayRender();
|
|
83
|
+
const { delayRender, continueRender, cancelRender } = useDelayRender();
|
|
84
84
|
const draw = useCallback(async (prevImage, nextImage, progress) => {
|
|
85
85
|
const outputCanvas = outputCanvasRef.current;
|
|
86
86
|
if (!outputCanvas) {
|
|
87
87
|
throw new Error("Canvas not found");
|
|
88
88
|
}
|
|
89
89
|
const handle = delayRender("onPaint");
|
|
90
|
-
|
|
91
|
-
const
|
|
92
|
-
|
|
93
|
-
|
|
90
|
+
try {
|
|
91
|
+
const clearOutput = () => {
|
|
92
|
+
const context = outputCanvas.getContext("2d");
|
|
93
|
+
if (!context) {
|
|
94
|
+
throw new Error("Failed to create output canvas context");
|
|
95
|
+
}
|
|
96
|
+
context.clearRect(0, 0, outputCanvas.width, outputCanvas.height);
|
|
97
|
+
};
|
|
98
|
+
if (!prevImage && !nextImage) {
|
|
99
|
+
instance.clear();
|
|
100
|
+
clearOutput();
|
|
101
|
+
continueRender(handle);
|
|
102
|
+
return;
|
|
94
103
|
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
104
|
+
const width = prevImage?.width ?? nextImage?.width ?? 0;
|
|
105
|
+
const height = prevImage?.height ?? nextImage?.height ?? 0;
|
|
106
|
+
if (width === 0 || height === 0) {
|
|
107
|
+
instance.clear();
|
|
108
|
+
clearOutput();
|
|
109
|
+
continueRender(handle);
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
shaderCanvas.width = width;
|
|
113
|
+
shaderCanvas.height = height;
|
|
114
|
+
instance.draw({
|
|
115
|
+
prevImage,
|
|
116
|
+
nextImage,
|
|
117
|
+
width,
|
|
118
|
+
height,
|
|
119
|
+
time: progress,
|
|
120
|
+
passedProps: passedPropsRef.current
|
|
121
|
+
});
|
|
122
|
+
await Internals.runEffectChain({
|
|
123
|
+
state: chainState.get(width, height),
|
|
124
|
+
source: shaderCanvas,
|
|
125
|
+
effects: effectsRef.current ?? [],
|
|
126
|
+
width,
|
|
127
|
+
height,
|
|
128
|
+
output: outputCanvas
|
|
129
|
+
});
|
|
108
130
|
continueRender(handle);
|
|
109
|
-
|
|
131
|
+
} catch (error) {
|
|
132
|
+
cancelRender(error);
|
|
110
133
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
passedProps: passedPropsRef.current
|
|
120
|
-
});
|
|
121
|
-
await Internals.runEffectChain({
|
|
122
|
-
state: chainState.get(width, height),
|
|
123
|
-
source: shaderCanvas,
|
|
124
|
-
effects: effectsRef.current ?? [],
|
|
125
|
-
width,
|
|
126
|
-
height,
|
|
127
|
-
output: outputCanvas
|
|
128
|
-
});
|
|
129
|
-
continueRender(handle);
|
|
130
|
-
}, [chainState, continueRender, delayRender, instance, shaderCanvas]);
|
|
134
|
+
}, [
|
|
135
|
+
cancelRender,
|
|
136
|
+
chainState,
|
|
137
|
+
continueRender,
|
|
138
|
+
delayRender,
|
|
139
|
+
instance,
|
|
140
|
+
shaderCanvas
|
|
141
|
+
]);
|
|
131
142
|
const passThrough = bothEnteringAndExiting && presentationDirection === "exiting";
|
|
132
143
|
useLayoutEffect(() => {
|
|
133
144
|
if (passThrough) {
|