diff --git a/examples/with-nextjs/src/excalidrawWrapper.tsx b/examples/with-nextjs/src/excalidrawWrapper.tsx
index fab4df6512..0fbf62af0f 100644
--- a/examples/with-nextjs/src/excalidrawWrapper.tsx
+++ b/examples/with-nextjs/src/excalidrawWrapper.tsx
@@ -1,4 +1,5 @@
"use client";
+
import * as excalidrawLib from "@excalidraw/excalidraw";
import { Excalidraw } from "@excalidraw/excalidraw";
@@ -13,6 +14,7 @@ const ExcalidrawWrapper: React.FC = () => {
appTitle={"Excalidraw with Nextjs Example"}
useCustom={(api: any, args?: any[]) => {}}
excalidrawLib={excalidrawLib}
+ showFadeDemo={true}
>
diff --git a/examples/with-script-in-browser/components/ExampleApp.tsx b/examples/with-script-in-browser/components/ExampleApp.tsx
index 294a11a58d..135dc74499 100644
--- a/examples/with-script-in-browser/components/ExampleApp.tsx
+++ b/examples/with-script-in-browser/components/ExampleApp.tsx
@@ -70,6 +70,7 @@ export interface AppProps {
customArgs?: any[];
children: React.ReactNode;
excalidrawLib: typeof TExcalidraw;
+ showFadeDemo?: boolean;
}
export default function ExampleApp({
@@ -78,6 +79,7 @@ export default function ExampleApp({
customArgs,
children,
excalidrawLib,
+ showFadeDemo = false,
}: AppProps) {
const {
exportToCanvas,
@@ -116,6 +118,8 @@ export default function ExampleApp({
{},
);
const [comment, setComment] = useState(null);
+ const [hideAllForFadeDemo, setHideAllForFadeDemo] = useState(showFadeDemo);
+ const [fadeDemoNextIndex, setFadeDemoNextIndex] = useState(0);
const initialStatePromiseRef = useRef<{
promise: ResolvablePromise;
@@ -178,7 +182,8 @@ export default function ExampleApp({
const newElement = cloneElement(
Excalidraw,
{
- excalidrawAPI: (api: ExcalidrawImperativeAPI) => setExcalidrawAPI(api),
+ onExcalidrawAPI: (api: ExcalidrawImperativeAPI | null) =>
+ setExcalidrawAPI(api),
initialData: initialStatePromiseRef.current.promise,
onChange: (
elements: NonDeletedExcalidrawElement[],
@@ -208,6 +213,7 @@ export default function ExampleApp({
onPointerDown,
onScrollChange: rerenderCommentIcons,
validateEmbeddable: true,
+ resolveRenderOpacity: hideAllForFadeDemo ? () => 0 : undefined,
},
<>
{excalidrawAPI && (
@@ -664,6 +670,58 @@ export default function ExampleApp({
>
Reset Scene
+ {showFadeDemo && (
+ <>
+
+
+ >
+ )}