Skip to main content

AutoPlayer

class AutoPlayer implements OptionGetters<AutoplayOptions>

Autoplayer that animates model without user input

constructor

new AutoPlayer(view3D, options, options.delay, options.delayOnMouseLeave, options.speed, options.pauseOnHover, options.canInterrupt, options.disableOnInterrupt)

Create new AutoPlayer instance

PARAMETERTYPEOPTIONALDEFAULTDESCRIPTION
view3DView3DAn instance of View3D
optionsobject✔️{}Options
options.delaynumber✔️2000Reactivation delay after mouse input in milisecond
options.delayOnMouseLeavenumber✔️0Reactivation delay after mouse leave
options.speednumber✔️1Y-axis(yaw) rotation speed
options.pauseOnHoverboolean✔️falseWhether to pause rotation on mouse hover
options.canInterruptboolean✔️trueWhether user can interrupt the rotation with click/wheel input
options.disableOnInterruptboolean✔️falseWhether to disable autoplay on user interrupt

Properties

enabled

readonly

Whether autoplay is enabled or not

animating

readonly

Whether autoplay is updating the camera at the moment

delay

Reactivation delay after mouse input in milisecond

delayOnMouseLeave

Reactivation delay after mouse leave
This option only works when pauseOnHover is activated

speed

Y-axis(yaw) rotation speed

Default: 1

pauseOnHover

Whether to pause rotation on mouse hover

Default: false

canInterrupt

Whether user can interrupt the rotation with click/wheel input

Default: true

disableOnInterrupt

Whether to disable autoplay on user interrupt

Default: false

Methods

destroy

Destroy the instance and remove all event listeners attached
This also will reset CSS cursor to intial

Returns: void

update

Update camera by given deltaTime

Returns: void

PARAMETERTYPEOPTIONALDEFAULTDESCRIPTION
cameranumberCamera to update position
deltaTimeNumber of milisec to update

enable

Enable autoplay and add event listeners

Returns: void

enableAfterDelay

Enable autoplay after current delay value

Returns: void

disable

Disable this input and remove all event handlers

Returns: void