add method

dynamic add(
  1. dynamic options
)

Implementation

add(options) {
  options.texture.repeat.set(1 / options.tilesHorizontal, 1 / options.tilesVertical);

  var animation = {
    "fps": 60,
    "duration": -1,
    "repeat": -1,
    "startFrame": 0,
    "numberOfTiles": options.tilesHorizontal * options.tilesVertical
  };

  // Merge in user options
  for (var key in options) {
    animation[key] = options[key];
  }

  animation["currentTile"] = animation["startFrame"];
  animation["looped"] = 0;

  animations.add(animation);

  return animation;
}