iframe
Introduce

Introduction

In addition to integrating via frontend components, we can also integrate scenes edited in iCraft Editor through iframe using URL parameters.

Usage

Here's an example demonstrating how to integrate an iCraft Editor scene using an iframe.

const style = {
  width: "100%",
  height: "500px",
  position: "relative" as const,
  overflow: "hidden" as const,
};
 
const EDITOR_BASE_URL = "https://icraft.gantcloud.com/editor";
 
export default () => {
  const params = new URLSearchParams({
    url: "https://icraft.gantcloud.com/api/static/templates/ArgoCD.icraft",
    preview: "true",
    defaultAnimationPlan: "0",
    autoPlay: "true",
    loop: "true",
  });
 
  const src = `${EDITOR_BASE_URL}?${params.toString()}`;
 
  return (
    <div style={style}>
      <iframe
        src={src}
        title='iCraft Editor'
        width='100%'
        height='100%'
        style={{ border: "none" }}
        allowFullScreen
      />
    </div>
  );
};

URL Parameters

NameDescriptionTypeDefaultRequired
url.icraft file addressstringfalse
previewPreview modebooleanfalsefalse
defaultCustomCameraDefault custom camera indexnumberfalse
defaultAnimationPlanDefault animation plan indexnumberfalse
defaultLoopDefault loop playbackbooleanfalsefalse
autoPlayAuto playbackbooleanfalsefalse
templateTemplate identifierstringfalse