Class: Player

Player~Player(group, settingsopt)

new Player(group, settingsopt)

3D objects animation.
Parameters:
Name Type Attributes Default Description
group THREE.Group | THREE.Scene THREE.Group or THREE.Scene of the meshes for playing.
settings Object <optional>
{} the following settings are available
Properties
Name Type Attributes Default Description
options Options <optional>
new Options() Options instance. The following options are available. See options parameter of MyThree class.
Properties
Name Type Attributes Description
dat.playerGui boolean <optional>
false - do not adds a Player controllers into dat.gui.
dat.playController boolean <optional>
false - do not adds a PlayController into dat.gui.
playerOptions Object <optional>
Player settings.
Properties
Name Type Attributes Default Description
min number <optional>
0 Start time of the playing.
max number <optional>
1 Stop time of the playing.
marks number <optional>
10 Ticks count of the playing. Number of scenes of 3D objects animation. Have effect for max is not Infinity.
selectSceneIndex number <optional>
0 current time index.
Legal interval from 0 to to marks - 1.
If selectSceneIndex = 0 then time = min.
If selectSceneIndex = marks - 1 then time = max.
dt number <optional>
0.1 Step of the animation. Have effect only if max is infinity.
repeat boolean <optional>
false true - Infinitely repeating 3D objects animation.
interval number <optional>
1 Ticks per seconds.
zoomMultiplier number <optional>
1.1 zoom multiplier of the time.
offset number <optional>
0.1 offset of the time.
name number <optional>
"" name of the time.
player boolean <optional>
false - do not create a Player instance.
onSelectScene onSelectScene <optional>
This function is called at each new step of the playing. See onSelectScene.
onChangeScaleT onChangeScaleT <optional>
event. User has updated the time settings. See onChangeScaleT.
frustumPoints FrustumPoints <optional>
See FrustumPoints. Have effect only if settings.options is not defined.
cameraTarget.camera THREE.PerspectiveCamera PerspectiveCamera.
Source:

Classes

cameraTarget
traceLine

Namespaces

assign
execFunc
getColors
getItemSize
getPoints
selectMeshPlayScene
selectPlayScene
setColorAttribute
onChangeRepeat

Methods

addSlider()

Adds slider menu item into CanvasMenu.
Source:

addSliderEvents()

Adds an events into slider menu item of the CanvasMenu.
Source:
Returns:
slider element

continue()

Continue playing asynchronously.
Usual using if creating new scene to take long time.
Please call it from settings.options.onSelectScene() function after asynchronously creating of the scene.
Return true from settings.options.onSelectScene() function for pause of the playing.
Source:
See:

createCanvasMenuItem(canvasMenu, getLanguageCodeopt)

Adds a Player's menu item into CanvasMenu.
Parameters:
Name Type Attributes Default Description
canvasMenu CanvasMenu CanvasMenu.
getLanguageCode function <optional>
"en" Your custom getLanguageCode() function.
returns the "primary language" subtag of the language version of the browser.
Examples: "en" - English language, "ru" Russian.
See the rfc4646 2.1 Syntax for details.
Default returns the 'en' is English language.
You can import { getLanguageCode } from '../../commonNodeJS/master/lang.js';
Source:

createControllersButtons(options)

Adds player buttons into web page.
Parameters:
Name Type Description
options Object the following options are available
Properties
Name Type Attributes Description
controllers.player Object <optional>
player buttons, available from web page
Properties
Name Type Attributes Default Description
buttonPrev HTMLElement | string <optional>
"prev" Go to previous animation scene.
HTMLElement - input element of the "button" type.
string - id of input element.
buttonPlay HTMLElement | string <optional>
"play" play or pause of the playing.
HTMLElement - input element of the "button" type.
string - id of input element.
buttonNext HTMLElement | string <optional>
"next" Go to next animation scene.
HTMLElement - input element of the "button" type.
string - id of input element.
Source:

getSelectSceneIndex()

Source:
Returns:
selected scene index.

getSettings()

Source:
Returns:
Player settings.

getTime(timeIdopt)

get time
Parameters:
Name Type Attributes Description
timeId number <optional>
Index of the time. The default is the time index of the selected scene.
Source:

getTimeId()

get time id
Source:

gui(folderopt)

Adds a Player's controllers into dat.gui.
Parameters:
Name Type Attributes Description
folder GUI <optional>
Player's folder
Source:

localization(getLanguageCodeopt)

PlayController localization
Parameters:
Name Type Attributes Default Description
getLanguageCode function <optional>
"en" Your custom getLanguageCode() function.
returns the "primary language" subtag of the language version of the browser.
Examples: "en" - English language, "ru" Russian.
See the rfc4646 2.1 Syntax for details.
Default returns the 'en' is English language.
You can import { getLanguageCode } from '../../commonNodeJS/master/lang.js';
Source:
Returns:
Names and titles of the PlayController controls

next()

Go to next animation scene
Source:

onChangeScale(scale)

Changes the "max" value of the slider of the player's menu. Moves Player to the first scene.
Parameters:
Name Type Description
scale Object See options.playerOptions parameter of MyThree class.
Source:

play3DObject()

User has clicked the Play ► / Pause ❚❚ button
Source:

prev()

Go to previous animation scene
Source:

pushController(controller)

Add controller into controllers array
Parameters:
Name Type Description
controller controller
Source:

repeat()

User has clicked the repeat ⥀ button
Source:

selectScene(index)

select scene for playing
Parameters:
Name Type Description
index number Index of the scene. Range from 0 to options.playerOptions.marks - 1
Source:
Returns:
false - invalid index.

setIndex(index, title)

Sets index and title of the slider element of the player's menu.
Parameters:
Name Type Description
index string
title string
Source:

setTime(t)

set time
Parameters:
Name Type Description
t number time
Source:
Returns:
false - invalid t.