Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Shaping

Shaping provides various shaping/easing functions to interpolate a value non-linearly.

Hierarchy

  • Shaping

Index

Methods

Static bounceIn

  • bounceIn(t: number, c?: number): number
  • Bounce in, adapted from Robert Penner's easing functions

    parma

    t a value between 0 to 1

    parma

    c the value to shape, default is 1

    Parameters

    • t: number
    • Default value c: number = 1

    Returns number

Static bounceInOut

  • bounceInOut(t: number, c?: number): number
  • Bounce in-out, adapted from Robert Penner's easing functions

    parma

    t a value between 0 to 1

    parma

    c the value to shape, default is 1

    Parameters

    • t: number
    • Default value c: number = 1

    Returns number

Static bounceOut

  • bounceOut(t: number, c?: number): number
  • Bounce out, adapted from Robert Penner's easing functions

    parma

    t a value between 0 to 1

    parma

    c the value to shape, default is 1

    Parameters

    • t: number
    • Default value c: number = 1

    Returns number

Static circularIn

  • circularIn(t: number, c?: number): number
  • Circular in, adapted from Robert Penner's easing functions

    parma

    t a value between 0 to 1

    parma

    c the value to shape, default is 1

    Parameters

    • t: number
    • Default value c: number = 1

    Returns number

Static circularInOut

  • circularInOut(t: number, c?: number): number
  • Circular in-out, adapted from Robert Penner's easing functions

    parma

    t a value between 0 to 1

    parma

    c the value to shape, default is 1

    Parameters

    • t: number
    • Default value c: number = 1

    Returns number

Static circularOut

  • circularOut(t: number, c?: number): number
  • Circular out, adapted from Robert Penner's easing functions

    parma

    t a value between 0 to 1

    parma

    c the value to shape, default is 1

    Parameters

    • t: number
    • Default value c: number = 1

    Returns number

Static cliff

  • cliff(t: number, c?: number, p?: number): number
  • Step function is a simple jump from 0 to 1 at a specific Pt in time

    parma

    t a value between 0 to 1

    parma

    c the value to shape, default is 1

    parma

    p usually a value between 0 to 1, which specify the Pt to "jump". Default is 0.5 which is in the middle.

    Parameters

    • t: number
    • Default value c: number = 1
    • Default value p: number = 0.5

    Returns number

Static cosineApprox

  • cosineApprox(t: number, c?: number): number
  • A faster way to approximate cosine ease in-out using Blinn-Wyvill Approximation. Adapated from Golan Levin's polynomial shaping

    parma

    t a value between 0 to 1

    parma

    c the value to shape, default is 1

    Parameters

    • t: number
    • Default value c: number = 1

    Returns number

Static cubicBezier

  • cubicBezier(t: number, c?: number, p1?: PtLike, p2?: PtLike): number
  • Cubic bezier curve. This reuses the bezier functions in Curve class.

    parma

    t a value between 0 to 1

    parma

    c the value to shape, default is 1

    parma

    p1a Pt object specifying the first control Pt. Default isPt(0.1, 0.7).

    parma

    p2a Pt object specifying the second control Pt. Default isPt(0.9, 0.2).

    Parameters

    • t: number
    • Default value c: number = 1
    • Default value p1: PtLike = [0.1, 0.7]
    • Default value p2: PtLike = [0.9, 0.2]

    Returns number

Static cubicIn

  • cubicIn(t: number, c?: number): number
  • Cubic in, adapted from Robert Penner's easing functions

    parma

    t a value between 0 to 1

    parma

    c the value to shape, default is 1

    Parameters

    • t: number
    • Default value c: number = 1

    Returns number

Static cubicInOut

  • cubicInOut(t: number, c?: number): number
  • Cubic in-out, adapted from Robert Penner's easing functions

    parma

    t a value between 0 to 1

    parma

    c the value to shape, default is 1

    Parameters

    • t: number
    • Default value c: number = 1

    Returns number

Static cubicOut

  • cubicOut(t: number, c?: number): number
  • Cubic out, adapted from Robert Penner's easing functions

    parma

    t a value between 0 to 1

    parma

    c the value to shape, default is 1

    Parameters

    • t: number
    • Default value c: number = 1

    Returns number

Static elasticIn

  • elasticIn(t: number, c?: number, p?: number): number
  • Elastic in, adapted from Robert Penner's easing functions

    parma

    t a value between 0 to 1

    parma

    c the value to shape, default is 1

    parma

    p elastic parmeter between 0 to 1. The lower the number, the more elastic it will be. Default is 0.7.

    Parameters

    • t: number
    • Default value c: number = 1
    • Default value p: number = 0.7

    Returns number

Static elasticInOut

  • elasticInOut(t: number, c?: number, p?: number): number
  • Elastic in-out, adapted from Robert Penner's easing functions

    parma

    t a value between 0 to 1

    parma

    c the value to shape, default is 1

    parma

    p elastic parmeter between 0 to 1. The lower the number, the more elastic it will be. Default is 0.6.

    Parameters

    • t: number
    • Default value c: number = 1
    • Default value p: number = 0.6

    Returns number

Static elasticOut

  • elasticOut(t: number, c?: number, p?: number): number
  • Elastic out, adapted from Robert Penner's easing functions

    parma

    t a value between 0 to 1

    parma

    c the value to shape, default is 1

    parma

    p elastic parmeter between 0 to 1. The lower the number, the more elastic it will be. Default is 0.7.

    Parameters

    • t: number
    • Default value c: number = 1
    • Default value p: number = 0.7

    Returns number

Static exponentialIn

  • exponentialIn(t: number, c?: number, p?: number): number
  • Exponential ease In, adapted from Golan Levin's polynomial shapers

    parma

    t a value between 0 to 1

    parma

    c the value to shape, default is 1

    parma

    p a value between 0 to 1 to control the curve. Default is 0.25.

    Parameters

    • t: number
    • Default value c: number = 1
    • Default value p: number = 0.25

    Returns number

Static exponentialOut

  • exponentialOut(t: number, c?: number, p?: number): number
  • Exponential ease out, adapted from Golan Levin's polynomial shapers

    parma

    t a value between 0 to 1

    parma

    c the value to shape, default is 1

    parma

    p a value between 0 to 1 to control the curve. Default is 0.25.

    Parameters

    • t: number
    • Default value c: number = 1
    • Default value p: number = 0.25

    Returns number

Static linear

  • linear(t: number, c?: number): number
  • Linear mapping

    parma

    t a value between 0 to 1

    parma

    c the value to shape, default is 1

    Parameters

    • t: number
    • Default value c: number = 1

    Returns number

Static logSigmoid

  • logSigmoid(t: number, c?: number, p?: number): number
  • The Logistic Sigmoid is a useful curve. Adapted from Golan Levin's shaping function

    parma

    t a value between 0 to 1

    parma

    c the value to shape, default is 1

    parma

    p a parameter between 0 to 1 to control the steepness of the curve. Higher is steeper. Default is 0.7.

    Parameters

    • t: number
    • Default value c: number = 1
    • Default value p: number = 0.7

    Returns number

Static quadraticBezier

  • quadraticBezier(t: number, c?: number, p?: number | PtLike): number
  • Quadratic bezier curve. Adapted from Golan Levin's shaping functions

    parma

    t a value between 0 to 1

    parma

    c the value to shape, default is 1

    parma

    p1 a Pt object specifying the first control Pt, or a value specifying the control Pt's x position (its y position will default to 0.5). Default is `Pt(0.95, 0.95)

    Parameters

    • t: number
    • Default value c: number = 1
    • Default value p: number | PtLike = [0.05, 0.95]

    Returns number

Static quadraticIn

  • quadraticIn(t: number, c?: number): number
  • Quadratic in, adapted from Robert Penner's easing functions

    parma

    t a value between 0 to 1

    parma

    c the value to shape, default is 1

    Parameters

    • t: number
    • Default value c: number = 1

    Returns number

Static quadraticInOut

  • quadraticInOut(t: number, c?: number): number
  • Quadratic in-out, adapted from Robert Penner's easing functions

    parma

    t a value between 0 to 1

    parma

    c the value to shape, default is 1

    Parameters

    • t: number
    • Default value c: number = 1

    Returns number

Static quadraticOut

  • quadraticOut(t: number, c?: number): number
  • Quadratic out, adapted from Robert Penner's easing functions

    parma

    t a value between 0 to 1

    parma

    c the value to shape, default is 1

    Parameters

    • t: number
    • Default value c: number = 1

    Returns number

Static quadraticTarget

  • quadraticTarget(t: number, c?: number, p1?: PtLike): number
  • Give a Pt, draw a quadratic curve that will pass through that Pt as closely as possible. Adapted from Golan Levin's shaping functions

    parma

    t a value between 0 to 1

    parma

    c the value to shape, default is 1

    parma

    p1a Pt object specifying the Pt to pass through. Default isPt(0.2, 0.35)

    Parameters

    • t: number
    • Default value c: number = 1
    • Default value p1: PtLike = [0.2, 0.35]

    Returns number

Static seat

  • seat(t: number, c?: number, p?: number): number
  • An exponential seat curve. Adapted from Golan Levin's shaping functions

    parma

    t a value between 0 to 1

    parma

    c the value to shape, default is 1

    parma

    p a parameter between 0 to 1 to control the steepness of the curve. Higher is steeper. Default is 0.5.

    Parameters

    • t: number
    • Default value c: number = 1
    • Default value p: number = 0.5

    Returns number

Static sigmoid

  • sigmoid(t: number, c?: number, p?: number): number
  • Sigmoid curve changes its shape adapted from the input value, but always returns a value between 0 to 1.

    parma

    t a value between 0 to 1

    parma

    c the value to shape, default is 1

    parma

    p the larger the value, the "steeper" the curve will be. Default is 10.

    Parameters

    • t: number
    • Default value c: number = 1
    • Default value p: number = 10

    Returns number

Static sineIn

  • sineIn(t: number, c?: number): number
  • Sinuous in, adapted from Robert Penner's easing functions

    parma

    t a value between 0 to 1

    parma

    c the value to shape, default is 1

    Parameters

    • t: number
    • Default value c: number = 1

    Returns number

Static sineInOut

  • sineInOut(t: number, c?: number): number
  • Sinuous in-out, adapted from Robert Penner's easing functions

    parma

    t a value between 0 to 1

    parma

    c the value to shape, default is 1

    Parameters

    • t: number
    • Default value c: number = 1

    Returns number

Static sineOut

  • sineOut(t: number, c?: number): number
  • Sinuous out, adapted from Robert Penner's easing functions

    parma

    t a value between 0 to 1

    parma

    c the value to shape, default is 1

    Parameters

    • t: number
    • Default value c: number = 1

    Returns number

Static step

  • step(fn: Function, steps: number, t: number, c: number, ...args: any[]): any
  • Convert any shaping functions into a series of steps

    parma

    fn the original shaping function

    parma

    steps the number of steps

    parma

    t a value between 0 to 1

    parma

    c the value to shape, default is 1

    parma

    args optional paramters to pass to original function

    Parameters

    • fn: Function
    • steps: number
    • t: number
    • c: number
    • Rest ...args: any[]

    Returns any

Generated using TypeDoc