Class: GrObject

GrObject.GrObject(name, objectOrObjects, paramInfoopt)

GrObject

GrObjects have:

  • a name - each object should have a unique name (like an id), but this is not enforced
  • parameters (these are things that the user may want to control with sliders)
  • geometry / "Object3D" - they kind of serve like three's groups note: animation should not update the parameters

any new object should provide methods for:

  • construction - the constructor needs to call the base class constructor and provide the parameters and geometry
  • update - which takes an array of paramaters and sets things accordingly
  • advance - which moves the animation ahead a small amount

Note that a GrObject does not add itself to the scene (other things take care) of that. When the object is added to the world,

Constructor

new GrObject(name, objectOrObjects, paramInfoopt)

The parameter list (if provided) should be either a string (with the name of the parameter) or an Array with the first value being a string (the name), and the remaining 3 values being numbers: min, max, and initial value (all optional).

Parameters:
Name Type Attributes Description
name String

unique name for the object

objectOrObjects THREE.Object3D | Array.<THREE.Object3D>
paramInfo Array.<(string|Array)> <optional>

a list of the parameters for the object

Source:

Members

objects :Array.<THREE.Object3D>

Type:
  • Array.<THREE.Object3D>
Source:

params :Array.<Object>

Type:
  • Array.<Object>
Source:

Methods

advance(delta, timeOfDay)

Advance the object by an amount of time. Time only flows forward so use this to figure out how fast things should move. In theory, it is always a "step" (1/60th of a second) In the past, so many things were stochastic and only computed the delta, that this became the norm (if you need to accumulate time you can sum the delta) time of day is provided so you can make objects that change over the course of the day - it is a number between 0-24 (midnight->midnight) it does not necessarily change smoothly.

Parameters:
Name Type Description
delta number
timeOfDay number
Source:

update(paramValues)

set the parameter values to new values this gets called when the sliders are moved

Parameters:
Name Type Description
paramValues Array.<Number>
Source: