Constructor
.new Parametric(paramsopt)
Parametric generates a geometry representing a Parametric surface
It is usually used to develop different kinds of highfields or visualize a math function.
- Source:
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
params |
Object
|
<optional> |
The params. |
Example
Example creating an heightfield-like geometry. `u` and `v` are like `x` and `y` in shape, but their values are always from `0` to `1`. We use them in `THREE.Vector3` like `x` and `z` and `Math.random() * 5` for `y`.
const createParametric = (u, v) => {
return new THREE.Vector3(u * 30, Math.random() * 5, v * 30);
}
new Parametric({
geometry: {
func: createParametric
},
material: new THREE.MeshLambertMaterial({
color: 0xffffff,
side: THREE.DoubleSide
}),
position: [0, 100, -100]
}).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: { func: (u, v) => new Vector3(u, v, 0), slices: 10, tacks: 10 } }- Source:
.instructions :Object
Static instructions
- Inherited From:
- Default Value:
{ position: ['x', 'y', 'z'], rotation: ['x', 'y', 'z'], scale: ['x', 'y', 'z'] }- 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 |
.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 |
.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: