Dynamics
-
Gradually reduces velocity until it equals
See moreVector.zero
.Declaration
Swift
public struct DecayFunction<Vector: VectorType>: DynamicFunctionType
-
DynamicSolver
simulates changes to a value over time, based on a function that calculates acceleration after each time step.The RK4 method is used to integrate the acceleration function.
Constant time steps are not guarenteed elsewhere in the framework. Due to the nature of dynamic functions, however, it is desirable to maintain a constant update interval for a dynamic simulation.
See moreDynamicSolver
instances maintain their own internal time state. When `advance(elapsed:) is called on an instance, it may run an arbitrary number of time steps internally (and call the underlying function as needed) in order tocatch up
to the outside time. It then uses linear interpolation to match the internal state to the required external time in order to return the most precise calculations.Declaration
Swift
public struct DynamicSolver<F: DynamicFunctionType> : Advanceable
-
Conforming types implement a dynamic function that models changes to a vector over time.
See moreDeclaration
Swift
public protocol DynamicFunctionType
-
Animates changes to a value using spring physics.
Instances of
Spring
should be used in situations where spring physics are the only animation type required, or when convenient access to the properties of a running spring simulation is needed.The focused API of this class makes it more convenient in such cases than using an
Animatable
instance, where a new spring animation would have to be added each time the spring needed to be modified.
See morelet s = Spring(value: CGPoint.zero) s.changed.observe { (value) in // do something with the value when it changes } s.target = CGPoint(x: 100.0, y: 200.0) // Off it goes!
Declaration
Swift
public final class Spring<T: VectorConvertible>
-
Implements a simple spring acceleration function.
See moreDeclaration
Swift
public struct SpringFunction<T: VectorType>: DynamicFunctionType
-
The configuration options for a spring function.
See moreDeclaration
Swift
public struct SpringConfiguration