Class jaws.Parallax
Manage a parallax scroller with different layers. "Field Summary" contains options for the Parallax()-constructor.
- Defined in: parallax.js
Constructor Attributes | Constructor Name and Description |
---|---|
jaws.Parallax(options)
|
Field Attributes | Field Name and Description |
---|---|
number, x-position of "camera".
|
|
number, y-position of "camera".
|
|
true|false, repeat all parallax layers horizontally
|
|
true|false, repeat all parallax layers vertically
|
|
number, scale factor for all layers (2 will double everything and so on)
|
Method Summary
Method Attributes | Method Name and Description |
---|---|
addLayer(options)
Add a new layer to the parallax scroller
|
|
draw(options)
Draw all layers in parallax scroller
|
|
toString()
Debugstring for Parallax()
|
Class Detail
jaws.Parallax(options)
parallax = new jaws.Parallax({repeat_x: true}) parallax.addLayer({image: "parallax_1.png", damping: 100}) parallax.addLayer({image: "parallax_2.png", damping: 6}) parallax.camera_x += 1 // scroll layers horizontally parallax.draw()
- Parameters:
- options
Field Detail
camera_x
number, x-position of "camera". add to camera_x and layers will scroll left. defaults to 0
camera_y
number, y-position of "camera". defaults to 0
repeat_x
true|false, repeat all parallax layers horizontally
repeat_y
true|false, repeat all parallax layers vertically
scale
number, scale factor for all layers (2 will double everything and so on)
Method Detail
-
addLayer(options)Add a new layer to the parallax scroller
- Parameters:
- options
-
draw(options)Draw all layers in parallax scroller
- Parameters:
- options
-
toString()Debugstring for Parallax()