指定したスプライトをタイル状にリピード描画する。
背景スクロールなどに使用。
背景スクロールなどに使用。
Name | Type | Description |
---|---|---|
image |
String | phina.asset.Texture | phina.graphics.Canvas | |
width |
Number | optional |
height |
Number | optional |
Example
// 背景をx軸スクロールする
const SCROLL_SPEED = 4;
const bgImage = phina.display.TiledSprite("background")
.addChildTo(this)
.on('enterframe', function() {
this.offsetX -= SCROLL_SPEED;
})
;
Extends
- phina.display.DisplayElement
Members
-
テクスチャをフレーム分割していた場合のインデックス
-
画像テクスチャ
-
x軸原点オフセット
-
y軸原点オフセット
Methods
-
indexに応じてタイル化範囲をセット
Name Type Description index
Number width
Number optional タイル幅 height
Number optional タイル高さ Returns:
Type Description this -
画像をセット
Name Type Description image
String | phina.asset.Texture | phina.graphics.Canvas width
Number optional height
Number optional Returns:
Type Description this -
原点オフセットを一括セット
Name Type Description x
Number y
Number Returns:
Type Description this