code: function getViewTileId(gid) {
           if (this.animations.has(gid)) {
             // apply animations
             gid = this.animations.get(gid).cur.tileid;
           } else {
             // get the local tileset id
             gid -= this.firstgid;
           }
  
           return gid;
         }
docs: Get the view (local) tile ID from a GID, with animations applied
  @name me.TMXTileset#getViewTileId
  @public
  @function
  @param {Number} gid Global tile ID
  @return {Number} View tile ID