SpringFunction

public struct SpringFunction<T: VectorType>: DynamicFunctionType

Implements a simple spring acceleration function.

  • The target of the spring.

    Declaration

    Swift

    public var target: T
  • Configuration options.

    Declaration

    Swift

    public var configuration: SpringConfiguration
  • Creates a new SpringFunction instance.

    Declaration

    Swift

    public init(target: T)

    Parameters

    target

    The target of the new instance.

  • Calculates acceleration for a given state of the simulation.

    Declaration

    Swift

    public func acceleration(value: T, velocity: T) -> T
  • Returns true if the simulation can become settled.

    Declaration

    Swift

    public func canSettle(value: T, velocity: T) -> Bool
  • Returns the value to settle on.

    Declaration

    Swift

    public func settledValue(value: T, velocity: T) -> T