three-nebula API
    Preparing search index...

    Class Spring

    Behaviour that causes particles to spring.

    Hierarchy (View Summary)

    Index
    • Constructs a Spring behaviour instance.

      Parameters

      • x: number

        X axis spring

      • y: number

        Y axis spring

      • z: number

        Z axis spring

      • spring: number

        Spring factor

      • friction: number

        Spring friction

      • Optionallife: number

        The life of the behaviour

      • Optionaleasing: EasingFunction

        The easing equation to use for transforms

      • isEnabled: boolean = true

        Determines if the behaviour will be applied or not

      Returns Spring

    _life: number
    age: number
    dead: boolean
    energy: number
    friction: number
    id: string
    isEnabled: boolean
    spring: number
    type: string
    • get life(): number

      Gets the behaviour's life.

      Returns number

    • set life(life: number): void

      Ensures that life is infinity if an invalid value is supplied.

      Parameters

      • life: number

      Returns void

    • Compares the age of the behaviour vs integration time and determines if the behaviour should be set to dead or not.

      Parameters

      • particle: Particle
      • time: number
      • Optionalindex: number

      Returns void

    • Returns a new instance of the behaviour from the JSON object passed.

      Parameters

      • json: Record<string, unknown>

      Returns void

    • Applies the behaviour to the particle. Mutates the particle's velocity according to this.pos and this.spring.

      Parameters

      • particle: Particle

        the particle to apply the behaviour to

      • time: number

        engine time

      • Optionalindex: number

        the particle index

      Returns void

    • Resets the behaviour properties.

      Parameters

      • x: number

        X axis spring

      • y: number

        Y axis spring

      • z: number

        Z axis spring

      • spring: number

        Spring factor

      • friction: number

        Spring friction

      Returns void

    • Returns a new instance of the behaviour from the JSON object passed.

      Parameters

      • json: SpringJSON

        JSON object containing the required constructor properties

      Returns Spring