| Package | org.flintparticles.twoD.zones |
| Class | public class BitmapDataZone |
| Inheritance | BitmapDataZone Object |
| Implements | Zone2D |
| Property | Defined By | ||
|---|---|---|---|
| bitmapData : BitmapData
The bitmapData object that defines the zone. | BitmapDataZone | ||
| offsetX : Number
A horizontal offset to apply to the pixels in the BitmapData object
to reposition the zone
| BitmapDataZone | ||
| offsetY : Number
A vertical offset to apply to the pixels in the BitmapData object
to reposition the zone
| BitmapDataZone | ||
| scaleX : Number
A scale factor to stretch the bitmap horizontally
| BitmapDataZone | ||
| scaleY : Number
A scale factor to stretch the bitmap vertically
| BitmapDataZone | ||
| Method | Defined By | ||
|---|---|---|---|
BitmapDataZone(bitmapData:BitmapData = null, offsetX:Number = 0, offsetY:Number = 0, scaleX:Number = 1, scaleY:Number = 1)
The constructor creates a BitmapDataZone object. | BitmapDataZone | ||
collideParticle(particle:Particle2D, bounce:Number = 1):Boolean
Manages collisions between a particle and the zone. | BitmapDataZone | ||
contains(x:Number, y:Number):Boolean
The contains method determines whether a point is inside the zone. | BitmapDataZone | ||
getArea():Number
The getArea method returns the size of the zone. | BitmapDataZone | ||
getLocation():Point
The getLocation method returns a random point inside the zone. | BitmapDataZone | ||
invalidate():void
This method forces the zone to revaluate itself. | BitmapDataZone | ||
| bitmapData | property |
bitmapData:BitmapDataThe bitmapData object that defines the zone.
public function get bitmapData():BitmapData public function set bitmapData(value:BitmapData):void| offsetX | property |
offsetX:NumberA horizontal offset to apply to the pixels in the BitmapData object to reposition the zone
public function get offsetX():Number public function set offsetX(value:Number):void| offsetY | property |
offsetY:NumberA vertical offset to apply to the pixels in the BitmapData object to reposition the zone
public function get offsetY():Number public function set offsetY(value:Number):void| scaleX | property |
scaleX:NumberA scale factor to stretch the bitmap horizontally
public function get scaleX():Number public function set scaleX(value:Number):void| scaleY | property |
scaleY:NumberA scale factor to stretch the bitmap vertically
public function get scaleY():Number public function set scaleY(value:Number):void| BitmapDataZone | () | Constructor |
public function BitmapDataZone(bitmapData:BitmapData = null, offsetX:Number = 0, offsetY:Number = 0, scaleX:Number = 1, scaleY:Number = 1)The constructor creates a BitmapDataZone object.
ParametersbitmapData:BitmapData (default = null) — The bitmapData object that defines the zone.
| |
offsetX:Number (default = 0) — A horizontal offset to apply to the pixels in the BitmapData object
to reposition the zone
| |
offsetY:Number (default = 0) — A vertical offset to apply to the pixels in the BitmapData object
to reposition the zone
| |
scaleX:Number (default = 1) — A scale factor to stretch the bitmap horizontally
| |
scaleY:Number (default = 1) — A scale factor to stretch the bitmap vertically
|
| collideParticle | () | method |
public function collideParticle(particle:Particle2D, bounce:Number = 1):BooleanManages collisions between a particle and the zone. The particle will collide with the edges of the zone, from the inside or outside. In the interests of speed, these collisions do not take account of the collisionRadius of the particle and they do not calculate an accurate bounce direction from the shape of the zone. Priority is placed on keeping particles inside or outside the zone.
Parameters
particle:Particle2D — The particle to be tested for collision with the zone.
| |
bounce:Number (default = 1) — The coefficient of restitution for the collision.
|
Boolean — Whether a collision occured.
|
| contains | () | method |
public function contains(x:Number, y:Number):BooleanThe contains method determines whether a point is inside the zone.
Parameters
x:Number — The location to test for.
| |
y:Number |
Boolean — true if point is inside the zone, false if it is outside.
|
| getArea | () | method |
public function getArea():NumberThe getArea method returns the size of the zone. It's used by the MultiZone class to manage the balancing between the different zones.
ReturnsNumber — the size of the zone.
|
| getLocation | () | method |
public function getLocation():PointThe getLocation method returns a random point inside the zone.
ReturnsPoint — a random point inside the zone.
|
| invalidate | () | method |
public function invalidate():voidThis method forces the zone to revaluate itself. It should be called whenever the contents of the BitmapData object change. However, it is an intensive method and calling it frequently will likely slow your code down.