DynamicFunctionType
public protocol DynamicFunctionType
Conforming types implement a dynamic function that models changes to a vector over time.
-
The computed acceleration for a given simulation state.
Declaration
Swift
func acceleration(_ value: Vector, velocity: Vector) -> Vector
Parameters
value
The current value of the simulation.
velocity
The current velocity of the simulation.
Return Value
A vector containing the acceleration (in units per second) based on
value
andvelocity
. -
Returns
true
if the simulation should be allowed to enter its settled state. For example, a decay function may check thatvelocity
is below a minimum threshold.Declaration
Swift
func canSettle(_ value: Vector, velocity: Vector) -> Bool
-
Returns the value for the simulation as it enters the settled state.
Declaration
Swift
func settledValue(_ value: Vector, velocity: Vector) -> Vector
Parameters
value
The current value of the simulation.
velocity
The current velocity of the simulation.
Return Value
The value that the simulation will settle on.