Constructor
new cImage()
- Description:
- Create a cImage object
- Source:
Properties:
Name | Type | Description |
---|---|---|
source |
string | Source path of image file |
primary |
Object | Primary set of coordinates |
secondary |
Object | Secondary set of coordinates |
canvas |
HTMLCanvasElement | 2D canvas context |
anchor |
Anchor | Anchor properties |
options |
Options | Options for this object |
position |
Position | Position properties |
mass |
number | Mass of object |
velocity |
Point | X & Y velocity coordinates |
Methods
anchor() → {Anchor}
- Description:
- Get anchor
- Source:
Returns:
Anchor properties
- Type
- Anchor
area() → {number}
- Description:
- Get area of this object
- Source:
- See:
Returns:
Area of this object
- Type
- number
aspect(value)
- Description:
- Set aspect properties
- Source:
Parameters:
Name | Type | Description |
---|---|---|
value |
Aspect | Aspect properties |
aspect() → {Aspect}
- Description:
- Get aspect properties
- Source:
Returns:
Aspect properties
- Type
- Aspect
canvas(value)
- Description:
- Set canvas value
- Source:
- See:
-
- individual.canvas
Parameters:
Name | Type | Description |
---|---|---|
value |
string | Canvas id |
canvas() → {string}
- Description:
- Get canvas value
- Source:
- See:
-
- individual.canvas
Returns:
Canvas id
- Type
- string
center() → {Point}
- Description:
- Get center of this object
- Source:
- See:
Returns:
Center point coordinates
- Type
- Point
draw(canvas)
- Description:
- Draw this object
- Source:
Parameters:
Name | Type | Description |
---|---|---|
canvas |
string | Canvas Id |
height() → {number}
- Description:
- Get aspect height
- Source:
Returns:
Height value
- Type
- number
mass(value)
- Description:
- Set mass
- Source:
Parameters:
Name | Type | Description |
---|---|---|
value |
number | Mass of object |
mass() → {number}
- Description:
- Get mass
- Source:
Returns:
Mass of object
- Type
- number
move(degree, distance, drawopt, clearopt)
- Description:
- Move this object
- Source:
- See:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
degree |
number | Direction to move; in degrees | ||
distance |
number | Distance to move | ||
draw |
boolean |
<optional> |
false
|
Draw post movement |
clear |
boolean |
<optional> |
false
|
Clear canvas during each movement |
options() → {Options}
- Description:
- Get options properties
- Source:
Returns:
Options properties
- Type
- Options
perimeter() → {number}
- Description:
- Get perimeter of this object
- Source:
- See:
Returns:
Perimeter of rectangle
- Type
- number
point(value)
- Description:
- Set point
- Source:
Parameters:
Name | Type | Description |
---|---|---|
value |
Point | X & Y coordinates |
point() → {Point}
- Description:
- Get point
- Source:
Returns:
X & Y coordinates
- Type
- Point
position() → {Position}
- Description:
- Get position properties
- Source:
Returns:
Position properties
- Type
- Position
primary(value)
- Description:
- Sets primary property value
- Source:
Parameters:
Name | Type | Description |
---|---|---|
value |
string | Path of image |
primary() → {Image}
- Description:
- Gets primary property value
- Source:
Returns:
Image object
- Type
- Image
rotate(degree, anchoropt, clearopt)
- Description:
- Rotate this object
- Source:
- See:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
degree |
number | Distance to rotate; in degrees | ||
anchor |
string |
<optional> |
'center'
|
Anchoring point during rotation |
clear |
number |
<optional> |
true
|
Clear canvas during each rotation |
secondary(value)
- Description:
- Sets secondary property value
- Source:
Parameters:
Name | Type | Description |
---|---|---|
value |
string | Path of image |
secondary() → {Image}
- Description:
- Gets secondary property value
- Source:
Returns:
Image object
- Type
- Image
showCoordinates(offsetopt, fontSizeopt)
- Description:
- Shows coordinates of this object
- Source:
- See:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
offset |
number |
<optional> |
10
|
Offset of coordinates y origin |
fontSize |
number |
<optional> |
16
|
Coordinates font size |
source(value)
- Description:
- Sets source property value
- Source:
Parameters:
Name | Type | Description |
---|---|---|
value |
string | Path of image source |
source() → {Image}
- Description:
- Gets source property value
- Source:
Returns:
Image source
- Type
- Image
velocity(value)
- Description:
- Set velocity
- Source:
Parameters:
Name | Type | Description |
---|---|---|
value |
number | Velocity of object |
velocity() → {number}
- Description:
- Get velocity
- Source:
Returns:
Velocity of object
- Type
- number
width() → {number}
- Description:
- Get aspect with
- Source:
Returns:
Width value
- Type
- number
x(value)
- Description:
- Set primary x-axis value
- Source:
Parameters:
Name | Type | Description |
---|---|---|
value |
number | X coordinate value |
x() → {number}
- Description:
- Get primary x-axis value
- Source:
Returns:
X coordinate value
- Type
- number
y(value)
- Description:
- Set primary y-axis value
- Source:
Parameters:
Name | Type | Description |
---|---|---|
value |
number | Y coordinate value |
y() → {number}
- Description:
- Get primary y-axis value
- Source:
Returns:
Y coordinate value
- Type
- number