Documentation generator: JsDoc Toolkit 2.4.0
Template: Codeview 1.2
Generated on: 2016-0-4 21:22

Class enchant.Entity

A class with objects displayed as DOM elements. Not to be used directly.

Class Summary
Constructor Attributes Constructor Name and Description
 
Field Summary
Field Attributes Field Name and Description
 
The Entity background color.
 
Defines this Entity as a button.
 
Indicates if this Entity is being clicked.
 
 
The Entity debug color.
 
The height of the Entity.
 
The transparency of this entity.
 
The point of origin used for rotation and scaling.
 
The point of origin used for rotation and scaling.
 
Entity rotation angle (degree).
 
Scaling factor on the x axis of this Entity.
 
Scaling factor on the y axis of this Entity.
 
Indicates whether or not this Entity can be touched.
 
Indicates whether or not to display this Entity.
 
The width of the Entity.
Fields borrowed from class enchant.Node:
age, parentNode, scene, x, y

Method Summary

Method Attributes Method Name and Description
<static>  
enchant.Entity.alignBottomIn(another, margin)
Performs downwards movement within specified object.
<static>  
enchant.Entity.alignBottomOf(another, margin)
Moves to lower side of specified object.
<static>  
enchant.Entity.alignHorizontalCenterIn(another, margin)
Performs central movement along x axis within specified object.
<static>  
enchant.Entity.alignLeftIn(another, margin)
Performs leftwards movement within specified object.
<static>  
enchant.Entity.alignLeftOf(another, margin)
Moves to left side of specified object.
<static>  
enchant.Entity.alignRightIn(another, margin)
Performs rightwards movement within specified object.
<static>  
enchant.Entity.alignRightOf(another, margin)
Moves to right side of specified object.
<static>  
enchant.Entity.alignTopIn(another, margin)
Performs upwards movement within specified object.
<static>  
enchant.Entity.alignTopOf(another, margin)
Moves to upper side of specified object.
<static>  
enchant.Entity.alignVerticalCenterIn(another, margin)
Performs central movement along y axis within specified object.
 
 
 
intersect(other)
Performs a collision detection based on whether or not the bounding rectangles are intersecting.
 
rotate(deg)
Rotate this Entity.
 
scale(x, y)
Enlarges or shrinks this Entity.
 
within(other, distance)
Performs a collision detection based on distance from the Entity's central point.
Methods borrowed from class enchant.Node:
moveBy
moveTo
Methods borrowed from class enchant.EventTarget:
addEventListener
clearEventListener
dispatchEvent
on
removeEventListener

Class Detail

enchant.Entity()

Field Detail

{String} backgroundColor
The Entity background color. Must be provided in the same format as the CSS 'color' property.
{String} buttonMode
Defines this Entity as a button. When touched or clicked the corresponding button event is dispatched. Valid buttonModes are: left, right, up, down, a, b.
{Boolean} buttonPressed
Indicates if this Entity is being clicked. Only works when enchant.Entity.buttonMode is set.
{String} compositeOperation
{String} debugColor
The Entity debug color. Must be provided in the same format as the CSS 'color' property.
{Number} height
The height of the Entity.
{Number} opacity
The transparency of this entity. Defines the transparency level from 0 to 1 (0 is completely transparent, 1 is completely opaque).
{Number} originX
The point of origin used for rotation and scaling.
{Number} originY
The point of origin used for rotation and scaling.
{Number} rotation
Entity rotation angle (degree).
{Number} scaleX
Scaling factor on the x axis of this Entity.
{Number} scaleY
Scaling factor on the y axis of this Entity.
{Boolean} touchEnabled
Indicates whether or not this Entity can be touched.
{Boolean} visible
Indicates whether or not to display this Entity.
{Number} width
The width of the Entity.

Method Detail

  • <static> enchant.Entity.alignBottomIn(another, margin)
    Performs downwards movement within specified object.
    Defined in: widget.enchant.js.
    Parameters:
    {*} another
    Object that becomes standard.
    {Number} margin
    Number of pixels shifted.
    Requires:
    widget.enchant.js
  • <static> enchant.Entity.alignBottomOf(another, margin)
    Moves to lower side of specified object.
    Defined in: widget.enchant.js.
    Parameters:
    {*} another
    Object that becomes standard.
    {Number} margin
    Number of pixels shifted.
    Requires:
    widget.enchant.js
  • <static> enchant.Entity.alignHorizontalCenterIn(another, margin)
    Performs central movement along x axis within specified object.
    Defined in: widget.enchant.js.
    Parameters:
    {*} another
    Object that becomes standard.
    {Number} margin
    Number of pixels shifted.
    Requires:
    widget.enchant.js
  • <static> enchant.Entity.alignLeftIn(another, margin)
    Performs leftwards movement within specified object.
    Defined in: widget.enchant.js.
    Parameters:
    {*} another
    Object that becomes standard.
    {Number} margin
    Number of pixels shifted.
    Requires:
    widget.enchant.js
  • <static> enchant.Entity.alignLeftOf(another, margin)
    Moves to left side of specified object.
    Defined in: widget.enchant.js.
    Parameters:
    {*} another
    Object that becomes standard.
    {Number} margin
    Number of pixels shifted.
    Requires:
    widget.enchant.js
  • <static> enchant.Entity.alignRightIn(another, margin)
    Performs rightwards movement within specified object.
    Defined in: widget.enchant.js.
    Parameters:
    {*} another
    Object that becomes standard.
    {Number} margin
    Number of pixels shifted.
    Requires:
    widget.enchant.js
  • <static> enchant.Entity.alignRightOf(another, margin)
    Moves to right side of specified object.
    Defined in: widget.enchant.js.
    Parameters:
    {*} another
    Object that becomes standard.
    {Number} margin
    Number of pixels shifted.
    Requires:
    widget.enchant.js
  • <static> enchant.Entity.alignTopIn(another, margin)
    Performs upwards movement within specified object.
    Defined in: widget.enchant.js.
    Parameters:
    {*} another
    Object that becomes standard.
    {Number} margin
    Number of pixels shifted.
    Requires:
    widget.enchant.js
  • <static> enchant.Entity.alignTopOf(another, margin)
    Moves to upper side of specified object.
    Defined in: widget.enchant.js.
    Parameters:
    {*} another
    Object that becomes standard.
    {Number} margin
    Number of pixels shifted.
    Requires:
    widget.enchant.js
  • <static> enchant.Entity.alignVerticalCenterIn(another, margin)
    Performs central movement along y axis within specified object.
    Defined in: widget.enchant.js.
    Parameters:
    {*} another
    object that becomes standard.
    {Number} margin
    Number of pictures shifted.
    Requires:
    widget.enchant.js
  • disableCollection()
  • enableCollection()
  • {Boolean} intersect(other)
    Performs a collision detection based on whether or not the bounding rectangles are intersecting.
    Parameters:
    {*} other
    An object like Entity, with the properties x, y, width, height, which are used for the collision detection.
    Returns:
    {Boolean} True, if a collision was detected.
  • rotate(deg)
    Rotate this Entity.
    Parameters:
    {Number} deg
    Rotation angle (degree).
  • scale(x, y)
    Enlarges or shrinks this Entity.
    Parameters:
    {Number} x
    Scaling factor on the x axis.
    {Number} y Optional
    Scaling factor on the y axis.
  • {Boolean} within(other, distance)
    Performs a collision detection based on distance from the Entity's central point.
    Parameters:
    {*} other
    An object like Entity, with properties x, y, width, height, which are used for the collision detection.
    {Number} distance Optional
    The greatest distance to be considered for a collision. The default distance is the average of both objects width and height.
    Returns:
    {Boolean} True, if a collision was detected.