ElasticForce (com.robertpenner.physics.forces.ElasticForce)

Force
        |
        +--com.robertpenner.physics.forces.ElasticForce
class ElasticForce
extends Force

The ElasticForce class implements elastic force according to Hooke's Law. Extends the Force class. Designed to collaborate with the PhysicsParticle class.

Availability:

ActionScript 2.0; Flash Player 6

Property summary

Property Description
anchor:Vector

The anchor property of the ElasticForce.

tautness:Number

The tautness property of the ElasticForce.

Method summary

Method Description
getAnchor() : Vector

Gets the anchor of an ElasticForce instance.

setAnchor(x:Number, y:Number) : Void

Sets the anchor of an ElasticForce instance.

ElasticForce(anchorX:Number, anchorY:Number, tautness:Number, life:Number)

Usage


var eForce:ElasticForce = new ElasticForce(0, 0, .002);

Parameters

anchorX:Number - The x position that the particle is pulled towards.

anchorY:Number - The y position that the particle is pulled towards.

tautness:Number - The stiffness of the force of elasticity; a value between 0 and 1.

life:Number - The lifespan of the force in frames; this defaults to infinity if the parameter is omitted.

Description

Creates an instance of the ElasticForce class.


getAnchor() : Vector

Usage


trace (eForce.getAnchor());

Parameters

Returns

Nothing.

Description

Gets the anchor of an ElasticForce instance.


setAnchor(x:Number, y:Number) : Void

Usage


var eForce:ElasticForce = new ElasticForce(0, 0, .002);
eForce.setAnchor(100, 250);

Parameters

x:Number - The anchor's x position of the ElasticForce.

y:Number - The anchor's y position of the ElasticForce.

Returns

Nothing.

Description

Sets the anchor of an ElasticForce instance.


anchor : Vector

Usage


trace (eForce.anchor);

Description

The anchor property of the ElasticForce.


tautness : Number

Usage


trace (eForce.tautness);

Description

The tautness property of the ElasticForce.