Class HTML3DElement
Hierarchy (View Summary)
- ViewerElement
- HTML3DElement
Index
Constructors
Accessors
Methods
Constructors
constructor
-
Creates a new HTML3DElement.
Parameters
Optionaloptions: anyThe options to use for the viewer. This is optional, and is only used when programmatically creating a viewer element.
Returns HTML3DElement
Accessors
animation Auto Play
True if the default animation should play automatically when a model is loaded.
animation Progress
The current point on the selected animation timeline, normalized between 0 and 1.
animations
-
get animations(): readonly string[]
The list of animation names for the currently loaded model.
Returns readonly string[]
animation Speed
The speed scale at which animations are played.
camera Auto Orbit
Enables or disables camera auto-orbit.
camera Auto Orbit Delay
The delay in milliseconds before the camera starts auto-orbiting.
camera Auto Orbit Speed
The speed at which the camera auto-orbits around the target.
cameras As Hot Spots
True if scene cameras should be used as hotspots.
clear Color
The clear color (e.g. background color) for the viewer.
contrast
The contrast applied to the scene.
engine
The engine to use for rendering.
environment
-
get environment(): { lighting: Nullable<string>; skybox: Nullable<string> }
The texture URLs used for lighting and skybox. Setting this property will set both environmentLighting and environmentSkybox.
Returns { lighting: Nullable<string>; skybox: Nullable<string> }
-
set environment(url: string): void
Parameters
- url: string
Returns void
environment Intensity
A value between 0 and 2 that specifies the intensity of the environment lighting.
environment Lighting
The texture URL for lighting.
environment Rotation
A value in radians that specifies the rotation of the environment.
environment Skybox
The texture URL for the skybox.
exposure
The exposure applied to the scene.
extension
Forces the model to be loaded with the specified extension.
hot Spots
The set of defined hot spots.
is Animation Playing
-
get isAnimationPlaying(): boolean
True if an animation is currently playing.
Returns boolean
loading Progress
-
get loadingProgress(): number | boolean
material Variants
-
get materialVariants(): readonly string[]
The list of material variants for the currently loaded model.
Returns readonly string[]
render When Idle
When true, the scene will be rendered even if no scene state has changed.
reset Mode
Determines the behavior of the reset function, and the associated default reset button.
Remarks
- "auto" - Resets the camera to the initial pose if it makes sense given other viewer state, such as the selected animation.
- "reframe" - Reframes the camera based on the current viewer state (ignores the initial pose).
- [ResetFlag] - A space separated list of reset flags that reset various aspects of the viewer state.
selected Animation
The currently selected animation index.
selected Material Variant
The currently selected material variant.
shadow Quality
The type of shadows to use.
skybox Blur
A value between 0 and 1 that specifies how much to blur the skybox.
source
The model URL.
ssao
Enables or disables screen space ambient occlusion (SSAO).
tone Mapping
The tone mapping to use for rendering the scene.
Experimentaluse Open PBR
If true, load glTF files using the OpenPBR material instead of the default PBR material.
viewer Details
-
Gets the underlying viewer details (when the underlying viewer is in a loaded state). This is useful for advanced scenarios where direct access to the viewer or Babylon scene is needed.
Returns Readonly<ViewerDetails & { viewer: ViewerClass }> | undefined
Methods
add Event Listener
-
addEventListener<K extends keyof ViewerElementEventMap>(
type: K,
listener: (this: HTMLElement, ev: ViewerElementEventMap[K]) => any,
options?: boolean | AddEventListenerOptions,
): voidType Parameters
- K extends keyof ViewerElementEventMap
Parameters
- type: K
- listener: (this: HTMLElement, ev: ViewerElementEventMap[K]) => any
Optionaloptions: boolean | AddEventListenerOptions
Returns void
-
addEventListener(
type: string,
listener: EventListenerOrEventListenerObject,
options?: boolean | AddEventListenerOptions,
): voidParameters
- type: string
- listener: EventListenerOrEventListenerObject
Optionaloptions: boolean | AddEventListenerOptions
Returns void
focus Hot Spot
-
Updates the camera to focus on a named hotspot.
Parameters
- name: string
The name of the hotspot to focus on.
Returns boolean
true if the hotspot was found and the camera was updated, false otherwise.
- name: string
query Hot Spot
-
Get hotspot world and screen values from a named hotspot
Parameters
- name: string
slot of the hot spot
- result: ViewerHotSpotResult
resulting world and screen positions
Returns boolean
world position, world normal and screen space coordinates
- name: string
reload
-
Reloads the viewer. This is typically only needed when the viewer is in a faulted state (e.g. due to the context being lost).
Returns void
remove Event Listener
-
removeEventListener<K extends keyof ViewerElementEventMap>(
type: K,
listener: (this: HTMLElement, ev: ViewerElementEventMap[K]) => any,
options?: boolean | EventListenerOptions,
): voidType Parameters
- K extends keyof ViewerElementEventMap
Parameters
- type: K
- listener: (this: HTMLElement, ev: ViewerElementEventMap[K]) => any
Optionaloptions: boolean | EventListenerOptions
Returns void
-
removeEventListener(
type: string,
listener: EventListenerOrEventListenerObject,
options?: boolean | EventListenerOptions,
): voidParameters
- type: string
- listener: EventListenerOrEventListenerObject
Optionaloptions: boolean | EventListenerOptions
Returns void
reset
reset Camera
-
Resets the camera to its initial pose.
Returns void
toggle Animation
-
Toggles the play/pause animation state if there is a selected animation.
Returns void
Displays a 3D model using the Babylon.js Viewer.