UnitBezier

public struct UnitBezier

A bezier curve, often used to calculate timing functions.

  • p1x

    The horizontal component of the first control point.

    Declaration

    Swift

    public var p1x: Scalar
  • p1y

    The vertical component of the first control point.

    Declaration

    Swift

    public var p1y: Scalar
  • p2x

    The horizontal component of the second control point.

    Declaration

    Swift

    public var p2x: Scalar
  • p2y

    The vertical component of the second control point.

    Declaration

    Swift

    public var p2y: Scalar
  • Creates a new UnitBezier instance.

    Declaration

    Swift

    public init(p1x: Scalar, p1y: Scalar, p2x: Scalar, p2y: Scalar)
  • Calculates the resulting y for given x.

    Declaration

    Swift

    public func solve(x: Scalar, epsilon: Scalar) -> Scalar

    Parameters

    x

    The value to solve for.

    epsilon

    The required precision of the result (where x * epsilon is the maximum time segment to be evaluated).

    Return Value

    The solved y value.

  • Solves for time x.

    Declaration

    Swift

    public func solveForTime(x: Scalar, epsilon: Scalar) -> Scalar
  • A set of preset bezier curves.

    See more

    Declaration

    Swift

    public enum Preset
  • Initializes a UnitBezier with a preset.

    Declaration

    Swift

    public init(preset: Preset)