Application add-on.
Provides generic routines for the engine's initialization, UI and I/O.
- Source:
Summary
Methods
- attr_animate(elem, attr_name, from, to, timeout, opt_callbackopt)
- check_fullscreen() → {boolean}
- css_animate(elem, prop, from, to, timeout, opt_prefixopt, opt_suffixopt, opt_callbackopt)
- disable_camera_controls()
- disable_object_controls(obj)
- enable_camera_controls(disable_default_pivotopt, disable_letter_controlsopt, disable_zoomopt, elementopt, allow_element_exitopt, disable_gamepad_controlsopt)
- enable_debug_controls()
- enable_object_controls(obj, elementopt)
- exit_fullscreen()
- get_camera_smooth_factor() → {number}
- get_url_params(allow_param_arrayopt) → {Object|Null}
- init(optionsopt)
- queue_animate(queue)
- report_app_error(text_message, link_message, link, purge_elements)
- request_fullscreen(elem, enabled_cb, disabled_cb)
- set_camera_smooth_factor(value)
Type Definitions
Detailed Description
Methods
attr_animate(elem, attr_name, from, to, timeout, opt_callbackopt)
Animate html tag attribute.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
elem |
HTMLElement | HTML-element. | |
attr_name |
string | Animated attribute name. | |
from |
number | Value from. | |
to |
number | Value to. | |
timeout |
number | Time for animation. | |
opt_callback |
GenericCallback |
<optional> |
Finish callback function. |
- Source:
check_fullscreen() → {boolean}
Check whether fullscreen mode is available.
Returns:
Result of the check.
- Type
- boolean
- Deprecated
- Use module:screen.check_fullscreen instead
- Source:
css_animate(elem, prop, from, to, timeout, opt_prefixopt, opt_suffixopt, opt_callbackopt)
Animate css-property value.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
elem |
HTMLElement | HTML-element. | |
prop |
string | Animated css-property. | |
from |
number | Value from. | |
to |
number | Value to. | |
timeout |
number | Time for animation. | |
opt_prefix |
string |
<optional> |
Prefix of css-property (" scale(", "%" and etc). |
opt_suffix |
string |
<optional> |
Suffix of css-property (" px", "%" and etc). |
opt_callback |
GenericCallback |
<optional> |
Finish callback function. |
- Source:
disable_camera_controls()
Disable controls for the active camera.
- Source:
Example
var m_app = require("app");
m_app.disable_camera_controls();
disable_object_controls(obj)
Remove controls from the non-camera object.
Parameters:
Name | Type | Description |
---|---|---|
obj |
Object3D | Object. |
- Source:
enable_camera_controls(disable_default_pivotopt, disable_letter_controlsopt, disable_zoomopt, elementopt, allow_element_exitopt, disable_gamepad_controlsopt)
Assign keyboard and mouse controls to the active camera.
(arrow keys, ADSW, wheel and others)
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
disable_default_pivot |
boolean |
<optional> |
false | Do not use the possible camera-defined pivot point |
disable_letter_controls |
boolean |
<optional> |
false | Disable keyboard letter controls (only arrow keys will be used to control the camera). |
disable_zoom |
boolean |
<optional> |
false | Disable zoom |
element |
HTMLElement |
<optional> |
HTML element to add event listeners to. The canvas container will be use by default. | |
allow_element_exit |
boolean |
<optional> |
false | Continue receiving mouse events even when the mouse is leaving the HTML element |
disable_gamepad_controls |
boolean |
<optional> |
false | Disable gamepad controls |
- Source:
Example
var m_app = require("app");
m_app.enable_camera_controls();
enable_debug_controls()
Enable debug controls:
- K - make camera debug shot
- L - make light debug shot
- M - flashback messages
- Source:
enable_object_controls(obj, elementopt)
Assign some controls to the non-camera object.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
obj |
Object3D | Object 3D | ||
element |
HTMLElement |
<optional> |
Canvas container element | HTML element |
- Source:
exit_fullscreen()
Exit fullscreen mode.
- Deprecated
- Use module:screen.exit_fullscreen instead
- Source:
get_camera_smooth_factor() → {number}
Get smooth factor for camera rotation and zoom.
Returns:
Smooth factor
- Type
- number
- Source:
get_url_params(allow_param_arrayopt) → {Object|Null}
Retrieve parameters of the page's URL.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
allow_param_array |
boolean |
<optional> |
false | Create arrays of parameters if they share the same name. |
Returns:
URL parameters in a key-value format.
- Type
- Object | Null
- Source:
init(optionsopt)
Initialize the engine.
The "options" object may be extended by adding properties from the engine's
configuration (see config module).
In that case they will be applied before engine initialization.
Parameters:
Name | Type | Attributes | Default | Description | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
<optional> |
{} | Initialization options.
Properties
|
- Source:
queue_animate(queue)
Animate queue of the html elements.
Parameters:
Name | Type | Description |
---|---|---|
queue |
Array.<module:app~QueueObject> | Array of the queue objects. |
- Source:
report_app_error(text_message, link_message, link, purge_elements)
Report an application error.
Creates standard HTML elements with error info and inserts them into the page body.
Parameters:
Name | Type | Description |
---|---|---|
text_message |
string | Message to place on upper element. |
link_message |
string | Message to place on bottom element. |
link |
string | Link to place on bottom element. |
purge_elements |
Array.<string> | Array of element IDs to destroy just before the error elements are inserted. |
- Source:
request_fullscreen(elem, enabled_cb, disabled_cb)
Request fullscreen mode.
Security issues: execute by user event.
Parameters:
Name | Type | Description |
---|---|---|
elem |
HTMLElement | Element |
enabled_cb |
FullscreenEnabledCallback | Enabled callback |
disabled_cb |
FullscreenDisabledCallback | Disabled callback |
- Deprecated
- Use module:screen.request_fullscreen instead
- Source:
set_camera_smooth_factor(value)
Set smooth factor for camera rotation and zoom.
Parameters:
Name | Type | Description |
---|---|---|
value |
number | New smooth factor |
- Source:
Type Definitions
AnimFinishCallback()
Animation finish callback.
- Source:
AppInitCallback(canvas, success)
Application initialization callback.
Parameters:
Name | Type | Description |
---|---|---|
canvas |
HTMLElement | Initialized canvas element. |
success |
boolean | Success flag. |
- Source:
QueueObject
Queue object params.
Type:
- Object
Properties:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
type |
string | Animation type. | ||
elem |
HTMLElement | Animated html element. | ||
prop |
string | Animated property. | ||
from |
number | Initial property value. | ||
to |
number | Target property value. | ||
duration |
number | Animation duration in ms. | ||
opt_prefix |
string |
<optional> |
'' | Prefix for the css property. |
opt_suffix |
string |
<optional> |
'' | Prefix for the css property. |
cb |
AnimFinishCallback |
<optional> |
function(){} | Animation finish callback. |
- Source: