Class: ImageLayer

me. ImageLayer

new ImageLayer(x, y, settings, })

a generic Image Layer Object
Parameters:
Name Type Argument Default Description
x Number x coordinate
y Number y coordinate
settings Object ImageLayer properties
} HTMLImageElement | HTMLCanvasElement | String settings.image Image reference. See me.loader.getImage
settings.name String <optional>
"me.ImageLayer" Layer name
settings.z Number <optional>
0 z-index position
settings.ratio Number | me.Vector2d <optional>
1.0 Scrolling ratio to be applied
settings.anchorPoint Number | me.Vector2d <optional>
0.0 Image origin. See me.ImageLayer#anchorPoint
Source:
imagelayer.js, line 24

Extends

Members

alpha :Number

Define the renderable opacity
Set to zero if you do not wish an object to be drawn
Type:
  • Number
Inherited From:
Default Value:
  • 1.0
Source:
renderable.js, line 209
See:
  • me.Renderable#setOpacity
  • me.Renderable#getOpacity

ancestor :me.Container|me.Entity

a reference to the parent object that contains this renderable, or undefined if it has not been added to one.
Type:
Inherited From:
Default Value:
  • undefined
Source:
renderable.js, line 221

anchorPoint :me.Vector2d

Define how the image is anchored to the viewport bounds
By default, its upper-left corner is anchored to the viewport bounds upper left corner.
The anchorPoint is a unit vector where each component falls in range [0.0,1.0].
Some common examples:
* <0.0,0.0> : (Default) Anchor image to the upper-left corner of viewport bounds * <0.5,0.5> : Center the image within viewport bounds * <1.0,1.0> : Anchor image to the lower-right corner of viewport bounds To specify a value through Tiled, use one of the following format :
- a number, to change the value for both axis
- a json expression like `json:{"x":0.5,"y":0.5}` if you wish to specify a different value for both x and y
Type:
Default Value:
  • <0.0,0.0>
Source:
imagelayer.js, line 83

ratio :me.Vector2d

Define the image scrolling ratio
Scrolling speed is defined by multiplying the viewport delta position (e.g. followed entity) by the specified ratio. Setting this vector to <0.0,0.0> will disable automatic scrolling.
To specify a value through Tiled, use one of the following format :
- a number, to change the value for both axis
- a json expression like `json:{"x":0.5,"y":0.5}` if you wish to specify a different value for both x and y
Type:
Default Value:
  • <1.0,1.0>
Source:
imagelayer.js, line 59

repeat :String

Define if and how an Image Layer should be repeated.
By default, an Image Layer is repeated both vertically and horizontally.
Acceptable values :
* 'repeat' - The background image will be repeated both vertically and horizontally. (default)
* 'repeat-x' - The background image will be repeated only horizontally.
* 'repeat-y' - The background image will be repeated only vertically.
* 'no-repeat' - The background-image will not be repeated.
Type:
  • String
Source:
imagelayer.js, line 110

Methods

<static> resize(w, h)

resize the Image Layer to match the given size
Parameters:
Name Type Description
w Number new width
h Number new height
Source:
imagelayer.js, line 178