Tube

components/meshes/ Tube

Constructor

.new Tube(paramsopt)

Tube class makes a tube that extrudes along a 3d curve.

Source:
Parameters:
Name Type Attributes Description
params Object <optional>

The params.

Example

Creating a Tube from a three.js Curve, and adding it to app

const CustomSinCurve = THREE.Curve.create(
  function (scale) { // custom curve constructor
    this.scale = (scale === undefined) ? 1 : scale;
  },

  function (t) { // getPoint: t is between 0-1
    const tx = t * 3 - 1.5,
    ty = Math.sin( 2 * Math.PI * t ),
    tz = 0;

    return new THREE.Vector3(tx, ty, tz).multiplyScalar(this.scale);
  }
);

const path = new CustomSinCurve(10);

new Tube({
  geometry: {
    path: path
  },

  material: new THREE.MeshBasicMaterial({
    color: 0xffffff
  })
}).addTo(app);

Extends module:core.MeshComponent

Members

(private) ._wait :Array

Array of promises that should be resolved before Component is ready.

Inherited From:
Source:

.children :Array

Collection of child Components.

Inherited From:
Source:

.defaults :Object

Default values for parameters

Overrides:
Default Value:
                  
    {
      geometry: {
        path: new THREE.LineCurve3(new Vector3(0, 0, 0), new Vector3(0, 0, 1)),
        segments: 20,
        radius: 2,
        radiusSegments: 8,
        closed: false
      }
    }
    
Source:

.instructions :Object

Instructions

Overrides:
Default Value:
                  
    {
      geometry: [
        'path',
        'segments',
        'radius',
        'radiusSegments',
        'closed'
      ]
    }
    
Source:

.isDeffered :Boolean

Returns whether the object is async (wait promises are more than 0).

Inherited From:
Source:

.manager :ModuleManager

Returns the ModuleManager used for this component.

Inherited From:
Source:

.modules :Array

Collection of modules.

Inherited From:
Source:

.native :Object

Returns the native object used for this component.

Inherited From:
Source:

Methods

(static) .build(params) → {THREE.Mesh}

Build livecycle creates a mesh using input params.

Source:
Parameters:
Name Type Description
params Object

Component parameters.

.add(object) → {Promise}

Add a child Component.

Inherited From:
Source:
Parameters:
Name Type Description
object Component

Component that should be added as a child.

.addTo(object)

Adds this Component to specified App/Component.

Inherited From:
Source:
Parameters:
Name Type Description
object Component

Component that will be a parent of this.

.clone() → {MeshComponent}

Make a clone of this MeshComponent using .copy()

Inherited From:
Source:

.copy() → {this}

Copy source transforms & execute Component.copy()

Inherited From:
Source:

.defer(func)

Execute func (Callback) when Component is ready.

Inherited From:
Source:
Parameters:
Name Type Description
func function

Callback.

.remove(object)

Remove a child Component.

Inherited From:
Source:
Parameters:
Name Type Description
object Component

Component that should be a child of this Component.

.updateParams() → {Object}

Updates parameters of the Component.

Inherited From:
Source:

.wait(promiseopt) → {Promise}

Wait for a promise.

Inherited From:
Source:
Parameters:
Name Type Attributes Description
promise Promise <optional>

The promise that should be added to a queue.

.wrap() → {Promise}

Wraps transforms (position & rotation)

Inherited From:
Source: