万年素人からHackerへの道

万年素人がHackerになれるまで殴り書きするぜ。

  • ・資産運用おすすめ
    10万円は1000円くらい利益
    資産運用ブログ アセマネ
    • ・寄付お願いします
      YENTEN:YYzNPzdsZWqr5THWAdMrKDj7GT8ietDc2W
      BitZenny:ZfpUbVya8MWQkjjGJMjA7P9pPkqaLnwPWH
      c0ban:8KG95GXdEquNpPW8xJAJf7nn5kbimQ5wj1
      Skycoin:KMqcn7x8REwwzMHPi9fV9fbNwdofYAWKRo

    Spineの「*.atlas.txt」の「rotate」とは?

    http://esotericsoftware.com/
    BoneアニメーションツールのSpineで吐き出された「*.atlas.txt」について。
    「*.atlas.txt」は、Atlasを定義するテキストファイルである。

    例えば、サンプルについている「boy.atlas.txt」は概ね理解できる。

    goblin/right-upper-leg
      rotate: true
      xy: 412, 90
      size: 34, 63
      orig: 34, 63
      offset: 0, 0
      index: -1
    全体的な名前/元々のSpriteの名前
      rotate: ※説明する
      xy: 左からのx座標, 下からのy座標
      size: 実際の画像のサイズ横幅, 実際の画像のサイズ縦幅
      orig: 元の画像のサイズ横幅, 元の画像のサイズ縦幅
      offset: オフセット左から, オフセット右から
      index: 謎?

    yについては、”下から”ということに注意すればいい。

    「rotate」については、今回解説する。
    「left-upper-leg」と「torso」については、「true」になっていた。
    これは、元の画像がAtlas生成時には”回転されている”かどうかを意味している。
    ”回転可能かどか”ではなく、”左に90度回転されている”こと。

    まず、元画像を確認してみる。
    ・left-upper-leg.png

    ・torso.png

    実際のアトラスを見てみると、赤で囲んだもののように、

    となっている。「左に(反時計回りに)90度回転」していること。

    しかし、「index」はまだわからない。

    If an image file name ends with underscore and then a number (eg animation_23.png),
    the number is considered the "index" and is stored separately.
    The image name is stored without the underscore and index.
    TextureAtlas allows a list of all images with the same name to be retrieved, ordered by index.
    This makes it easy to pack animations without losing the order of the frames.