Type Alias: TakeScreenshot()
TakeScreenshot: (
extension
?,size
?,backgroundColor
?,customDimensions
?,withAutozoom
?,withCameraReset
?,customCameraPosition
?) =>Promise
<Nullable
<string
>>
You can use this method to generate an image from the current canvas state. Method is called screenshot, but you are able to control the size of the image and the type, png or jpg.
Under the hood it calls takeScreenshot()
function which clones existing scene and calls captureImage()
function.
Parameters
• extension?: string
[png] Extension of file. Based on that image has set proper MimeType. Accepts only png, jpg and jpeg.
• size?: number
[3072] Width of image. Height will be set automatically based on canvas aspect ratio. On iOS powered mobiles it may cause reloads if size is bigger than 2k. We recommend 1k for ecommerce.
• backgroundColor?: string
[#fff] If provided, will be used for background on jpeg file. Accepts only hex and hexa format.
• customDimensions?: Dimensions
If provided, it will overwrite size and/or automatically calculated height.
• withAutozoom?: boolean
If true
, it will do zoom out on canvas to make sure product if fully visible.
• withCameraReset?: boolean
If true
, it will reset camera to initial position (position from 1st camera at scene settings).
• customCameraPosition?: string
JSON string with custom camera position eg. {"position":{"x":-1.4827425522188151,"y":1.7029008083897266,"z":-5.265221131049244},"alpha":4.4378873110317825,"beta":1.3718508759876076,"target":{"x":0,"y":0.600077748298645,"z":0},"radius":5.580080441792618}
Returns
Base64 image string