Package | com.desuade.motion.physics |
Class | public class BasicPhysics |
Inheritance | BasicPhysics ![]() ![]() |
Language Version : | ActionScript 3 |
Since : | 27.04.2009 |
Runtime Versions : | AIR 1.0, Flash Player 9.0.0 |
Property | Defined By | ||
---|---|---|---|
acceleration : Number
Sets/gets the acceleration of the config and PrimitivePhysics object
| BasicPhysics | ||
![]() | active : Boolean [read-only]
If the primitive is currently active and running. | BaseBasic | |
![]() | config : Object [read-only]
Gets the config object that was passed in the constructor. | BaseBasic | |
friction : Number
Sets/gets the friction of the config and PrimitivePhysics object
| BasicPhysics | ||
![]() | pid : int [read-only]
The primitive's id
| BaseBasic | |
![]() | target : Object
The target object
| BaseBasic | |
velocity : Number
Sets/gets the velocity of the config and PrimitivePhysics object
| BasicPhysics |
Method | Defined By | ||
---|---|---|---|
BasicPhysics(target:Object, configObject:Object = null)
This creates a BasicPhysics object.
Each BasicPhysics object controls a single property on a given target object, and applies basic physics equations to calculate a change in value.
Unlike tweens, there is no end value, and the BasicPhysics' update will continue to run until it is stopped, or it reaches the specified duration.
Paramaters for the configObject:
property:String – The property to apply the physics to.
velocity:Number – The velocity of the property. | BasicPhysics | ||
![]() | fromXML(xml:XML):*
Configures the object based on the values provided by the XML.
Most properties can assigned in the attributes using the same names.
The values of the attributes will be converted to Numbers if they're not NaN. | BaseBasic | |
getVelocityWithAngle(velocity:Number, angle:Number, flip:Boolean):Number [static]
Gets the velocity that's calculated with a given angle. | BasicPhysics | ||
![]() | start(delay:Number = -1, position:Number = -1):*
This starts and creates the primitive. | BaseBasic | |
startAtTime(time:Number = 0, rate:Number = 0):BasicPhysics
This will start the physics as if it's already been running for the given amount of time. | BasicPhysics | ||
![]() | stop():Boolean
This stops and removes the primitive. | BaseBasic | |
![]() | toXML():XML
This creates an XML object that represents the object, based on it's config object. | BaseBasic |
acceleration | property |
acceleration:Number
Sets/gets the acceleration of the config and PrimitivePhysics object
public function get acceleration():Number
public function set acceleration(value:Number):void
friction | property |
friction:Number
Sets/gets the friction of the config and PrimitivePhysics object
public function get friction():Number
public function set friction(value:Number):void
velocity | property |
velocity:Number
Sets/gets the velocity of the config and PrimitivePhysics object
public function get velocity():Number
public function set velocity(value:Number):void
BasicPhysics | () | Constructor |
public function BasicPhysics(target:Object, configObject:Object = null)
This creates a BasicPhysics object.
Each BasicPhysics object controls a single property on a given target object, and applies basic physics equations to calculate a change in value.
Unlike tweens, there is no end value, and the BasicPhysics' update will continue to run until it is stopped, or it reaches the specified duration.
Paramaters for the configObject:
target:Object — The target object.
| |
configObject:Object (default = null ) — The object containing the physics configuration values.
|
See also
getVelocityWithAngle | () | method |
public static function getVelocityWithAngle(velocity:Number, angle:Number, flip:Boolean):Number
Gets the velocity that's calculated with a given angle.
Parameters
velocity:Number — The velocity to use
| |
angle:Number — The angle used to determine the new velocity
| |
flip:Boolean — Negate (or flip) the velocity.
|
Number — Number representing the new angle-velocity
|
startAtTime | () | method |
public function startAtTime(time:Number = 0, rate:Number = 0):BasicPhysics
This will start the physics as if it's already been running for the given amount of time.
Parameters
time:Number (default = 0 ) — How long in seconds to emulate
| |
rate:Number (default = 0 ) — If the target isn't a DisplayObject, you need to set the fps manually here, or BaseTicker.physicsRate.
|
BasicPhysics — The BasicPhysics object.
|