1.5.0 • Published 2 months ago
@spiffcommerce/preview-ar-plugin v1.5.0
Preview AR Plugin
This is a plugin for Preview for enabling ARKit and ARCore support, using the Google Model Viewer.
Usage
- Install preview and this plugin:
yarn add @spiffcommerce/preview @spiffcommerce/preview-ar-plugin
- Import the plugin and register it with preview:
import { ARPlugin } from '@spiffcommerce/preview-ar-plugin';
// Create the preview service
const previewService = new SpiffCommerce3DPreviewService({
// ... preview options
});
const arPlugin = new ARPlugin({
// This function should parse the elementString and return a promise that resolves to an HTMLElement
createModelViewer: (elementString: string): Promise<HTMLElement> => {},
// Optional array of mesh names to ignore when exporting the model
ignoredMeshNames: ['mesh1', 'mesh2'],
// Optional map of metadata fields to ignore when exporting the model. The key is the field name, and the value is an array of values to ignore.
ignoredMetadataFields: new Map([['field1', ['value1']], ['field2', ['value2']]]),
// This function should insert the given scripts into the DOM
insertScripts: (sources: string[]): void => {},
// This function should upload the given file to your server and return a promise that resolves to the url of the uploaded file
storeFile: (file: File): Promise<string> => {},
});
// Initialize the preview service
await previewService.initialize({
// ... preview initialization options
});
// Plugin can be registered before or after the preview service is initialized
previewService.registerPlugin(arPlugin);
if (arPlugin.arSupported()) {
await arPlugin.generateModel(true);
arPlugin.launchAR();
}
1.5.0
2 months ago
1.4.0
9 months ago
1.3.2
9 months ago
1.3.1
9 months ago
1.3.0
9 months ago
1.2.20
10 months ago
1.2.19
10 months ago
1.2.18
10 months ago
1.2.17
10 months ago
1.2.16
10 months ago
1.2.15
10 months ago
1.2.14
10 months ago
1.2.13
10 months ago
1.2.12
10 months ago
1.2.11
10 months ago
1.2.10
10 months ago
1.2.9
10 months ago
1.2.8
10 months ago
1.2.7
10 months ago
1.2.6
10 months ago
1.2.5
10 months ago
1.2.4
10 months ago
1.2.3
10 months ago
1.2.2
10 months ago
1.2.1
10 months ago
1.2.0
10 months ago
1.1.0
10 months ago
1.0.7
10 months ago
1.0.6
10 months ago
1.0.5
10 months ago
1.0.4
10 months ago
1.0.3
10 months ago
1.0.2
10 months ago
1.0.1
10 months ago
1.0.0
10 months ago