Gjsify LogoGjsify Logo

Physical parameters of a spring for [classSpringAnimation].

Any spring can be described by three parameters: mass, stiffness and damping.

An undamped spring will produce an oscillatory motion which will go on forever.

The frequency and amplitude of the oscillations will be determined by the stiffness (how "strong" the spring is) and its mass (how much "inertia" it has).

If damping is larger than 0, the amplitude of that oscillating motion will exponientally decrease over time. If that damping is strong enough that the spring can't complete a full oscillation, it's called an overdamped spring.

If we the spring can oscillate, it's called an underdamped spring.

The value between these two behaviors is called critical damping; a critically damped spring will comes to rest in the minimum possible time without producing oscillations.

The damping can be replaced by damping ratio, which produces the following springs:

  • 0: an undamped spring.
  • Between 0 and 1: an underdamped spring.
  • 1: a critically damped spring.
  • Larger than 1: an overdamped spring.

As such

record

Hierarchy

  • SpringParams

Index

Constructors

  • new SpringParams(damping_ratio: number, mass: number, stiffness: number): SpringParams
  • Creates a new AdwSpringParams from mass, stiffness and damping_ratio.

    The damping value is calculated from damping_ratio and the other two parameters.

    • If damping_ratio is 0, the spring will not be damped and will oscillate endlessly.
    • If damping_ratio is between 0 and 1, the spring is underdamped and will always overshoot.
    • If damping_ratio is 1, the spring is critically damped and will reach its resting position the quickest way possible.
    • If damping_ratio is larger than 1, the spring is overdamped and will reach its resting position faster than it can complete an oscillation.

    [ctorSpringParams.new_full] allows to pass a raw damping value instead.

    Parameters

    • damping_ratio: number

      the damping ratio of the spring

    • mass: number

      the mass of the spring

    • stiffness: number

      the stiffness of the spring

    Returns SpringParams

Properties

name: string

Methods

  • get_damping(): number
  • get_damping_ratio(): number
  • get_mass(): number
  • get_stiffness(): number
  • unref(): void
  • Decreases the reference count of self.

    If the last reference is dropped, the structure is freed.

    Returns void

  • new(damping_ratio: number, mass: number, stiffness: number): SpringParams
  • Creates a new AdwSpringParams from mass, stiffness and damping_ratio.

    The damping value is calculated from damping_ratio and the other two parameters.

    • If damping_ratio is 0, the spring will not be damped and will oscillate endlessly.
    • If damping_ratio is between 0 and 1, the spring is underdamped and will always overshoot.
    • If damping_ratio is 1, the spring is critically damped and will reach its resting position the quickest way possible.
    • If damping_ratio is larger than 1, the spring is overdamped and will reach its resting position faster than it can complete an oscillation.

    [ctorSpringParams.new_full] allows to pass a raw damping value instead.

    Parameters

    • damping_ratio: number

      the damping ratio of the spring

    • mass: number

      the mass of the spring

    • stiffness: number

      the stiffness of the spring

    Returns SpringParams

  • new_full(damping: number, mass: number, stiffness: number): SpringParams
  • Creates a new AdwSpringParams from mass, stiffness and damping.

    See [ctorSpringParams.new] for a simplified constructor using damping ratio instead of damping.

    Parameters

    • damping: number

      the damping of the spring

    • mass: number

      the mass of the spring

    • stiffness: number

      the stiffness of the spring

    Returns SpringParams

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Type alias with type parameter
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method