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
PARAMETER | TYPE | OPTIONAL | DEFAULT | DESCRIPTION |
---|---|---|---|---|
view3D | View3D | An instance of View3D | ||
options | object | ✔️ | {} | Options |
options.delay | number | ✔️ | 2000 | Reactivation delay after mouse input in milisecond |
options.delayOnMouseLeave | number | ✔️ | 0 | Reactivation delay after mouse leave |
options.speed | number | ✔️ | 1 | Y-axis(yaw) rotation speed |
options.pauseOnHover | boolean | ✔️ | false | Whether to pause rotation on mouse hover |
options.canInterrupt | boolean | ✔️ | true | Whether user can interrupt the rotation with click/wheel input |
options.disableOnInterrupt | boolean | ✔️ | false | Whether to disable autoplay on user interrupt |
Properties
enabled
Whether autoplay is enabled or not
animating
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
PARAMETER | TYPE | OPTIONAL | DEFAULT | DESCRIPTION |
---|---|---|---|---|
camera | number | Camera to update position | ||
deltaTime | Number 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