UnitCurve

A function defined by a two-dimensional curve that maps an input progress in the range [0,1] to an output progress that is also in the range [0,1]. By changing the shape of the curve, the effective speed of an animation or other interpolation can be changed.

StructureiOS 17.0+macOS 14.0+tvOS 17.0+watchOS 10.0+UnitCurve in SwiftUI

Declaration

React
type UnitCurve =
  | 'circularEaseIn'
  | 'circularEaseInOut'
  | 'circularEaseOut'
  | 'easeIn'
  | 'easeInEaseOut'
  | 'easeInOut'
  | 'easeOut'
  | 'linear'
  | { bezier: { startControlPoint: UnitPoint; endControlPoint: UnitPoint; }; };
Swift
struct UnitCurve

Pass a literal, or build one with SwiftUI.UnitCurve from import { SwiftUI } from 'swiftui-react-native'.

Type properties

  • 'circularEaseIn'SwiftUI.UnitCurve.circularEaseIn

    A curve that starts out slowly, then speeds up as it finishes.

  • 'circularEaseInOut'SwiftUI.UnitCurve.circularEaseInOut

    A circular curve that starts out slowly, speeds up over the middle, then slows down again as it approaches the end.

  • 'circularEaseOut'SwiftUI.UnitCurve.circularEaseOut

    A circular curve that starts out quickly, then slows down as it approaches the end.

  • 'easeIn'SwiftUI.UnitCurve.easeIn

    A bezier curve that starts out slowly, then speeds up as it finishes.

  • 'easeInEaseOut'SwiftUI.UnitCurve.easeInEaseOut

    A bezier curve that starts out slowly, speeds up over the middle, then slows down again as it approaches the end.

  • 'easeInOut'SwiftUI.UnitCurve.easeInOut

    A bezier curve that starts out slowly, speeds up over the middle, then slows down again as it approaches the end.

  • 'easeOut'SwiftUI.UnitCurve.easeOut

    A bezier curve that starts out quickly, then slows down as it approaches the end.

  • 'linear'SwiftUI.UnitCurve.linear

    A linear curve.

Type methods

Overview

The horizontal (x) axis defines the input progress: a single input progress value in the range [0,1] must be provided when evaluating a curve.

The vertical (y) axis maps to the output progress: when a curve is evaluated, the y component of the point that intersects the input progress is returned.

From Apple’s SwiftUI documentation. Code samples there are Swift.

See also

More in Animation.