0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Lanica Platino を使ってみる(スプライトアニメーション)

Posted at

引き続きLanica Platino。スプライトアニメーションを試してみる。

Sprite Animation

API Documentを見て実装。画像もここから拝借。

SpriteAnimation
var sheet = platino.createSpriteSheet({
    image: "spritesheet1a.png",
    width: 34,
    height: 42,
    border: 1,
});
scene.add(sheet);
sheet.animate(0, 5, 200, -1);

これだけ。
width、heightには、1フレーム分のサイズを指定する。
また、このサンプル画像は各フレーム画像の間に1pxのボーダーが入っているが、borderを指定するとこれを無視する。

ドキュメントを見る限り、「loop」パラメータは、0(ループなし)、-1(無限ループ)の2パターンしか無いっぽい。
Coronaとかである「往復ループ」のパターンが無いのは残念。そのうち追加されるかな。

なお、以下のようにフレーム数のindexを配列指定することも可能。

SpriteAnimation
//sheet.animate(0, 5, 200, -1);
// ↑と同義
sheet.animate([0, 1, 2, 3, 4], 200, -1);

以上

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?