Members
(constant) Colors :Object.<String, Number>
Type:
- Object.<String, Number>
axesHelper :THREE.AxesHelper
Type:
axis :String
Type:
- String
camera :THREE.PerspectiveCamera
A perspective camera.
Type:
cameraHelper :THREE.CameraHelper
Type:
(constant) euler :Object.<{x: Number, y: Number, z: Number}>
Type:
- Object.<{x: Number, y: Number, z: Number}>
exporter :ExportToGLTF
Type:
hemisphereLight :THREE.HemisphereLight
Type:
holder :THREE.Object3D
A container for everything: plane, pilot and local axes.
Set the rotation order for Euler angles for this object container to intrinsic "YZX": head (yaw), pitch, roll.Type:
localAxes :THREE.Object3D
Type:
(constant) objects
Properties:
Name | Type | Description | |||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
objects |
Object |
Properties
|
pointLightHelper :THREE.PointLightHelper
Type:
renderer :THREE.WebGLRenderer
A renderer.
Type:
scene :THREE.Scene
A scene.
Type:
(constant) selector :Object.<{axes:Boolean, auto_rotate: Boolean, light: Boolean}>
Type:
- Object.<{axes:Boolean, auto_rotate: Boolean, light: Boolean}>
shadowPlane :THREE.Mesh
A plane for shadow.
Type:
spotLightHelper :THREE.SpotLightHelper
Type:
textGeometry :TextGeometry.TextGeometry
Type:
Methods
changeBox(geometry, val)
Parameters:
Name | Type | Default | Description |
---|---|---|---|
geometry |
THREE.BoxGeometry | a box. | |
val |
Number | 1 | coordinate value. |
- Source:
- See:
clipOptions() → {Object.<{animations:Array.<AnimationClip>}>}
Returns:
- Type
- Object.<{animations:Array.<AnimationClip>}>
createAirPlane(parent) → {AirPlane}
Parameters:
Name | Type | Description |
---|---|---|
parent |
THREE.Object3D | airplane container. |
Returns:
- Type
- AirPlane
createLights(scene)
Lighting is certainly one of the trickiest parts when it comes to setting up a scene.
The lights will set the mood of the whole scene and must be determined carefully.Just make the lightning good enough to make the objects visible.
Parameters:
Name | Type | Description |
---|---|---|
scene |
THREE.Object3D | where you place objects, lights and cameras. |
- Source:
- See:
createLights2(scene, target)
A simpler lighting scheme.
Note that, without a global source of light, all surfaces will render black, unless their emissive properties are also set.This can be avoided, by using an ambient or hemisphere light source.
Parameters:
Name | Type | Description |
---|---|---|
scene |
THREE.Object3D | where you place objects, lights and cameras. |
target |
THREE.Object3D | scene object target. |
- Source:
- See:
deg2rad(deg) → {Number}
Parameters:
Name | Type | Description |
---|---|---|
deg |
Number | angle in degrees. |
- Source:
- See:
Returns:
- Type
- Number
displayAngles()
drawGlobalAxes(parent)
Parameters:
Name | Type | Description |
---|---|---|
parent |
THREE.Object3D | axis container. |
drawLocalAxes(parent, font)
Parameters:
Name | Type | Description |
---|---|---|
parent |
THREE.Object3D | axis container. |
font |
FontLoader.FontLoader | text font. |
drawTwoOctagons(parent)
Parameters:
Name | Type | Description |
---|---|---|
parent |
THREE.Object3D | octagon container. |
drawTwoTriangles(parent)
Parameters:
Name | Type | Description |
---|---|---|
parent |
THREE.Object3D | triangle container. |
getChar(event) → {String}
Parameters:
Name | Type | Description |
---|---|---|
event |
KeyboardEvent | keyboard event. |
Returns:
- Type
- String
handleKeyPress(event)
Parameters:
Name | Type | Description |
---|---|---|
event |
KeyboardEvent | keyboard event. |
handleWindowResize()
Callback invoked when the document view (window) has been resized.
Also resizes the canvas and viewport.mainEntrance()
rad2deg(rad) → {Number}
Parameters:
Name | Type | Description |
---|---|---|
rad |
Number | angle in radians. |
- Source:
- See:
Returns:
- Type
- Number
render() → {animate}
Returns:
- Type
- animate
setAnimationLoop(loop)
A built in function that can be used instead of requestAnimationFrame.
The renderer.setAnimationLoop parameter is a callback, which will be called every available frame.If null is passed it will stop any already ongoing animation.
Parameters:
Name | Type | Description |
---|---|---|
loop |
function | callback. |
start(font)
Parameters:
Name | Type | Description |
---|---|---|
font |
FontLoader.FontLoader | text font. |
- Source:
- See:
zoomIn()
zoomOut()
Type Definitions
animate()
Events
KeyboardEvent
Creates a keyboard keydown event.
Parameters:
Name | Type | Description |
---|---|---|
key |
String | char code. |
Returns:
- Type
- KeyboardEvent
changeAxes
Executed when the axes checkbox is checked or unchecked.
Appends an event listener for events whose type attribute value is change. The callback argument sets the callback that will be invoked when the event is dispatched.
changeLight
Executed when the light checkbox is checked or unchecked.
Appends an event listener for events whose type attribute value is change. The callback argument sets the callback that will be invoked when the event is dispatched.
changeOctagons
Executed when the octagons checkbox is checked or unchecked.
Appends an event listener for events whose type attribute value is change. The callback argument sets the callback that will be invoked when the event is dispatched.
changeRot
Executed when any rot <input radio>'s checkbox is checked (but not unchecked).
Appends an event listener for events whose type attribute value is change. The callback argument sets the callback that will be invoked when the event is dispatched.
keydown
Key handler.
Calls handleKeyPress whenever any of these keys is pressed:- Space
- ArrowUp
- ArrowDown
- ArrowLeft
- ArrowRight
load
Loads the theejs module and the application.
Unfortunately, importmap is only supported by Safari version 16.4 and later.Since I still use macOS Catalina, my Safari version is 15.6.1, which obliges me to conditionally and dynamically load the threejs module.
Parameters:
Name | Type | Description |
---|---|---|
event |
Event | an object has loaded. |
function |
callback | function to run when the event occurs. |
- Source:
- See:
resize
Executed when the window is resized.
Appends an event listener for events whose type attribute value is resize.
The callback argument sets the callback that will be invoked when the event is dispatched.
Parameters:
Name | Type | Description |
---|---|---|
event |
Event | the document view is resized. |
function |
callback | function to run when the event occurs. |
useCapture |
Boolean | handler is executed in the bubbling or capturing phase. |