o3d.Curve Class Reference
Inherits
o3d.Function
List of all members.
Detailed Description
A Curve stores a bunch of CurveKeys and given a value
representing an input point on a curve returns the output of the curve for
that input. Curve is data only. It is used by 1 or more
FunctionEval objects or by direct use from javascript.
Public Types
Public Member Functions
Public Properties
Public Types Documentation
enum Infinity {
CONSTANT, Uses the output value of the first or last animation key.
LINEAR, Takes the distance between the closest animation key
input value and the evaluation time. Multiplies this
distance against the instant slope at the closest
animation key and offsets the result with the closest
animation key output value.
CYCLE, Cycles over the first and last keys using
input = (input - first) % (last - first) + first;
Note that in CYCLE mode you can never get the end output
because a cycle goes from start to end exclusive of end.
CYCLE_RELATIVE, Same as cycle except the offset of the entire
cycle is added to each consecutive cycle.
OSCILLATE, Ping Pongs between the first and last keys.
};
Member Function Documentation
| Curve.addBezierKeys |
( |
!Array.<number> |
keys |
) |
|
Adds 1 or more BezierKeys to this Curve.
Example:
// Creates 2 keys.
// 1 key at 0 with an output of 10, in tangent of 1,9, out tangent 9,0.5
// 1 key at 20 with an output of 30, in tangent of 30, 3, out tangent 4, 28
curve.addBezierKeys([0,10,1,9,9,0.5,2,30,3,4,28]);
.
- Parameters:
-
| keys |
Array of input, output pairs. |
| Curve.addLinearKeys |
( |
!Array.<number> |
keys |
) |
|
Adds 1 or more LinearKeys to this Curve.
Example:
// Creates 2 keys.
// 1 key at 0 with an output of 10
// 1 key at 20 with an output of 30
curve.addLinearKeys([0,10,20,30]);
.
- Parameters:
-
| keys |
Array of input, output pairs. |
| Curve.addStepKeys |
( |
!Array.<number> |
keys |
) |
|
Adds 1 or more StepKeys to this Curve.
Example:
// Creates 2 keys.
// 1 key at 0 with an output of 10
// 1 key at 20 with an output of 30
curve.addStepKeys([0,10,20,30]);
.
- Parameters:
-
| keys |
Array of input, output pairs. |
Creates a new key for this curve.
- Parameters:
-
| keyType |
name of key class to create. Valid type names are:
- 'o3d.StepCurveKey',
- 'o3d.LinearCurveKey',
- 'o3d.BezierCurveKey',
|
- Returns:
-
!o3d.CurveKey.The created key.
| number Curve.evaluate |
( |
number |
input |
) |
[inherited from o3d.Function] |
Gets an output for this function for the given input.
- Parameters:
-
| input |
Input to get output at. |
- Returns:
-
number.The output for the given input.
| boolean Curve.isAClassName |
( |
string |
className |
) |
[inherited from o3d.ObjectBase] |
Takes the name of a class as an argument, and returns true if this object is
either an instance of that class or derives from that class.
var t = pack.createObject('o3d.Transform');
t.isAClassName('o3d.Transform'); // true
t.isAClassName('o3d.ParamObject'); // true
t.isAClassName('o3d.Shape'); // false
- Parameters:
-
| className |
Name of class to check for. |
- Returns:
-
boolean.true if this object is a or is derived from the given class name.
| Curve.isDiscontinuous |
( |
|
|
) |
|
Returns whether or not the curve is discontinuous. A discontinuous curve
takes more time to evaluate.
- Returns:
-
boolean.True if the curve is discontinuous.
| boolean Curve.set |
( |
!o3d.RawData |
param1 |
|
|
|
|
number |
opt_param2 |
|
|
|
|
number |
opt_param3 |
) |
|
Deserializes from the curve data given a RawData object.
- Parameters:
-
| param1 |
contains curve data |
| opt_param2 |
is a byte offset from the start of raw_data |
| opt_param3 |
is the byte length of the data to set |
- Returns:
-
boolean.True if operation was successful.
Member Property Documentation
The concrete class name for an object derived from ObjectBase.
If you want to know if an object is of a certain type you should use
objectBase.isAClassName
var t = pack.createObject('o3d.Transform');
t.className == 'o3d.Transform'; // true
This property is read-only.
Unique id of the object.
This id will be unique, even across multiple O3D clients in the same
page.
This property is read-only.
The keys for this curve.
This property is read-only.
The object's name.
Setting this has no meaning to O3D, but is useful for debugging and for
the functions Client.getObjects, Pack.getObject,
RenderNode.getRenderNodesByNameInTree and
RenderNode.getTransformsByNameInTree
which search for objects by name.
The behavior of the curve after the last key.
Default = CONSTANT.
The behavior of the curve before the first key.
Default = CONSTANT.
Gets the sample rate for the cache. By default Animation data is
cached so that using the animation is fast. To do this the keys that
represent the animation are sampled. The higher the frequency of the
samples the closer the cache will match the actual keys.
The default is 1/30 (30hz). You can set it anywhere from 1/240th (240hz) to
any larger value. Note: Setting the sample rate has the side effect of
invalidating the cache thereby causing it to get rebuilt.
Must be 1/240 or greater. Default = 1/30.
Whether or not a cache is used to speed up evaluation of this Curve
Default = true.
| See Also:
|