Skip to main content

Class: SpringConstraint

Defined in: src/mobjects/physics/constraints.ts:148

A spring between two endpoints. It applies a Hooke's-law force toward the rest length, plus optional damping on the closing speed, during the force phase. The endpoints oscillate around the rest length.

Implements​

Constructors​

Constructor​

new SpringConstraint(a, b, restLength, options): SpringConstraint

Defined in: src/mobjects/physics/constraints.ts:155

Parameters​

a​

Anchor

b​

Anchor

restLength​

number

options​

SpringConstraintOptions = {}

Returns​

SpringConstraint

Accessors​

restLength​

Get Signature​

get restLength(): number

Defined in: src/mobjects/physics/constraints.ts:164

The rest length the spring pulls toward.

Returns​

number

Methods​

accumulateForces()​

accumulateForces(): void

Defined in: src/mobjects/physics/constraints.ts:168

Add forces to the linked bodies before integration. Optional.

Returns​

void

Implementation of​

Constraint.accumulateForces


clone()​

clone(map): SpringConstraint

Defined in: src/mobjects/physics/constraints.ts:193

Return a copy of this constraint with bodies remapped through map.

Parameters​

map​

Map<Body, Body>

Returns​

SpringConstraint

Implementation of​

Constraint.clone