new AxLinearMechanism(min, max, speed, timed, loop, oscillate)
Creates a new linear mechanism object
Linear mechanism interpolates between two boundaries and can loop continuously
For example a looping linear mechanism can produce a sawtooth function, while a looping and oscillating will produce a triangular function
Parameters:
Name | Type | Description |
---|---|---|
min |
Number | The left boundary for the interpolation |
max |
Number | The right boundary for the interpolation |
speed |
Number | The speed in units per second at which the interpolation is performed or the time in seconds for which the full interpolation is performed. The "timed" parameter determines whether it's a speed or time based. |
timed |
Boolean | Determines whether the speed value is measured in units per second or in total seconds for the interpolation to run from start to end |
loop |
Boolean | Determines whether the mechanism should loop |
oscillate |
Boolean | Determines whether the mechanism should oscillate to and fro and boundaries, producing a triangular function, rather than a sawtooth function |
Methods
DeserializeChunk(reader) → {Boolean}
Reads the data of a chunk. The chunk header is already read by the reader and this method deserializes the contents of the chunk. Called continuously for each of the resource's chunks. Override to read chunks of resource-specific data
Parameters:
Name | Type | Description |
---|---|---|
reader |
AxHierarchyStreamReader | Reader to use for reading the serialized data. |
Returns:
True if a chunk was successfully deserialized
- Type
- Boolean
Process(deltaTime) → {Boolean}
Performs the routines of the mechanism and returns whether the mechanism should continue to be processed the next frame
Parameters:
Name | Type | Description |
---|---|---|
deltaTime |
Number | The time in milliseconds, between the previous and the current call. Used to perform time based routines |
Returns:
True, if the mechanism hasn't finished its job and should continue to be processed in the next frame
- Type
- Boolean
SerializeChunks(writer)
Writes chunks for all the data which is needed to serialize the resource.
Can be overridden by child resources to serialize their implementation-specific data
Parameters:
Name | Type | Description |
---|---|---|
writer |
AxHierarchyStreamWriter | Writer to use for writing the serialization data |