Class mutator
Extends
component.
mutator
Defined in: mutator.js.
Constructor Attributes | Constructor Name and Description |
---|---|
mutator()
A piecewise function manager that changes inputs
over time.
|
Field Attributes | Field Name and Description |
---|---|
Returns the current time elapsed since starting the mutation life cycle.
|
|
Returns the duration of the mutator based on current mutations.
|
|
Returns whether the mutator's life cycle has expired.
|
|
Whether the mutator should loop automatically once the lifetime has elapsed.
|
- Fields borrowed from class component:
- host, info, isDrawing, isStepping, onAttach, onDraw, onStep, tag
Method Attributes | Method Name and Description |
---|---|
add(when, value, mutationType)
Adds a new mutation.
|
|
clear(startValue)
Removes all mutations.
|
|
getAt(time)
Returns the value of the mutator at the given time in seconds based on all added mutations.
|
|
start()
Starts the mutation lifetime.
|
|
stop()
Stops the mutation lifetime.
|
|
value()
Returns the current value of the mutation state.
|
- Methods borrowed from class component:
- canHandleEvent, draw, emitEvent, getKnownEvents, installEvent, installHandler, installHook, step, uninstallEvent, uninstallHandler, uninstallHook
Class Detail
mutator()
A piecewise function manager that changes inputs
over time.
There are some instances where it is useful to model
the transformation of a value in a complex manner. The mutator component
provides functionality for simple and complex easing. You can string easing functions
together to achieve more complex behavior in one instance of a Mutator through
the mutation interface. For more simple easing, see sandboxe.ease.
All times are delt with in seconds and
the Mutator always begins at time 0.
Field Detail
currentTime
Returns the current time elapsed since starting the mutation life cycle. Writing to this value has no effect
duration
Returns the duration of the mutator based on current mutations. Writing to this value has no effect.
expired
Returns whether the mutator's life cycle has expired. Writing to this value has no effect.
loop
Whether the mutator should loop automatically once the lifetime has elapsed. The default is false.
Method Detail
add(when, value, mutationType)
Adds a new mutation.
- Parameters:
- {Number} when
- The time that the mutation will be over, in seconds.
- {Number} value
- The value that should be reached when the mutation is over.
- {Number} mutationType
- See sandboxe.mutator.mutation
clear(startValue)
Removes all mutations.
- Parameters:
- {Number} startValue
- The value to start the mutator at before mutations take place.
{Number}
getAt(time)
Returns the value of the mutator at the given time in seconds based on all added mutations.
- Parameters:
- {Number} time
- The time to request in seconds.
- Returns:
- {Number} The value at that time.
start()
Starts the mutation lifetime. If it was already started, this function starts the
mutation lifetime from the beginning.
stop()
Stops the mutation lifetime. Once stopped, the mutation's value is set as if all mutations finished normally.
value()
Returns the current value of the mutation state. See mutator.start.