@remotion/transitions 4.0.518 → 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/book-flip.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/cross-zoom.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/crosswarp.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/dissolve.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/dreamy-zoom.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/film-burn.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) {
|