White paper: Templates in web-to-print.  Free download

Class: AuWidget3DViewer

A widget that is used to render 3D previews based on DAE models.

The following example illustrates how you can use proof images obtained from the DesignEditor to visualize a model in the 3D-Viewer widget.

{
  "widgets": [
   {
     "name": "previewer",
     "type": "3d-viewer",
     "params": {
       "showAnimationButtons": false,
       "showCameraButtons": true,
       "items": [
         {
           "images": "{{ $['editor'].proofImageUrls }}",
           "model": "models/trifold.dae"
         }
       ]
     }
   }
 ]
}

Hierarchy

AuBaseWidget

AuWidget3DViewer

Implements

Index

Properties

Methods

Properties

image

image: string

A base64 URL that links to the rendered model image in the initial position.


params

params: I3DViewerParams

Overrides AuBaseWidget.params

3D viewer parameters.


paramsRaw

paramsRaw: any

Inherited from AuBaseWidget.paramsRaw

Uncompiled widget configuration.


paused

paused: boolean = false

If true, animation is paused.


speed

speed: number = 1

Current animation speed.

Methods

GetAnimationDuration

GetAnimationDuration(): number

Get longest animation time in model

constructor

Returns:number


PauseAnimation

PauseAnimation(): void

Pause animation

Returns:void


PlayAnimation

PlayAnimation(): void

Play animation

Returns:void


SetAnimationAt

SetAnimationAt(value: number): void

Set animation at time.

Parameters:

Name Type Description
value number animation time

Returns:void


SetAnimationSpeed

SetAnimationSpeed(value: number): void

Set animation speed. 1 - default speed. <0 - revert animation. -1 - default speed for revert animation. 0 - pause.

1 - increment speed.

Parameters:

Name Type
value number

Returns:void


addCustomStyles

addCustomStyles(params: any): void

Inherited from AuBaseWidget.addCustomStyles

Applies new styles to a widget.

Parameters:

Name Type
params any

Returns:void


closeBox

closeBox(): void

Closes the dynamic model.

Returns:void


compile

compile(additionalParam: any): Promise‹any›

Inherited from AuBaseWidget.compile

Compiles the widget config.

"steps": [{
  "name": "card-size",
  "title": "Step 1. Card Options",
  "description": "Choose a card size.",
  "toolPanel": {
    "name": "options"
  },
  "onActivate": [
    "{{#function $['logo'].compile() }}"
  ]
},
...

Parameters:

Name Type Default Description
additionalParam any Parameters for widget config compilation.

Returns:Promise‹any›

The compiled widget configuration.


emitChange

emitChange(data: any, forceRecompile: boolean): void

Inherited from AuBaseWidget.emitChange

Sends a message about the widget state changes.

"steps": [{
  "name": "card-size",
  "title": "Step 1. Card Options",
  "description": "Choose a card size.",
  "toolPanel": {
    "name": "options"
  },
  "onActivate": [
    "{{#function $['options'].emitChange()}}"
  ]
},
...

Parameters:

Name Type Default Description
data any Data for updating the widget.
forceRecompile boolean false If true, runs widget recompilation to apply the updated parameters.

Returns:void


openBox

openBox(): void

Opens the dynamic model.

Returns:void


showPreloader

showPreloader(isPreload: boolean, message: string): void

Inherited from AuBaseWidget.showPreloader

Shows a preloader.

"onClick": [
  "{{#function main.showPreloader(true, 'Creating print files...')}}",
  "{{#function $['editor'].getHiResImages(800,800)}}",
  "{{#function main.showPreloader(false)}}"
]

Parameters:

Name Type Default Description
isPreload boolean - If true, enables the preloader.
message string undefined A text message that appears next to the preloader.

Returns:void


showToast

showToast(data?: string, duration?: number): void

Inherited from AuBaseWidget.showToast

Shows a toast.

return editor.loadUserInfo(data)
    .catch(err => {
        this.widget.showToast("Error: Invalid data");
        console.log(err);
    });

Parameters:

Name Type Description
data? string A string message to display in the toast.
duration? number Defines how long to show the toast for.

Returns:void