Class: TiledSprite

phina.display.TiledSprite

new phina.display.TiledSprite (image, width, height)

指定したスプライトをタイル状にリピード描画する。
背景スクロールなどに使用。
Name Type Description
image String | phina.asset.Texture | phina.graphics.Canvas
width Number optional
height Number optional
See:
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

frameIndex number

テクスチャをフレーム分割していた場合のインデックス

image phina.asset.Texture | phina.graphics.Canvas

画像テクスチャ

offsetX number

x軸原点オフセット

offsetY number

y軸原点オフセット

Methods

setFrameIndex (index, width, height)this

indexに応じてタイル化範囲をセット
Name Type Description
index Number
width Number optional タイル幅
height Number optional タイル高さ
Returns:
Type Description
this

setImage (image, width, height)this

画像をセット
Name Type Description
image String | phina.asset.Texture | phina.graphics.Canvas
width Number optional
height Number optional
Returns:
Type Description
this

setOffset (x, y)this

原点オフセットを一括セット
Name Type Description
x Number
y Number
Returns:
Type Description
this