Skip to main content
Skip table of contents

Web SDK Reference | Render preview

The renderPreview() method can be called to render a preview image of the current 3D view.

JS
renderPreview(options, callback): void

Parameters

Name

Type

Description

options

IRenderPreviewOptions

Rendering options.

JS
RenderImageOptions: {
    backgroundColor?: string;
    resolution?: { height: number, width: number };
    cameraState?: { pitch: number, yaw: number, roll, number, zoomDistance: number };
    download?: { fileName: string } | boolean;
}

-

function

Callback function that is called when preview image is rendered.

Example

JS
window.twikit.renderPreview(
    {
        backgroundColor: '#123422',
        resolution: { height: 70, width: 100},
        cameraState: { pitch: 30 /* deg */, yaw: 60 /* deg */, roll: 90 /* deg */, zoomDistance: 300 /* mm */ },
        download?: { fileName: string } | boolean;
    },
    function(base64EncodedImageUrl) {
       // Store image.
    }
);
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.