Description

Repeat an image of SpriteSheet. Do not forget to draw the pattern with "fillRect" or "fill"

Usage

Parameters

  • el {CanvasEngine.Element}

  • id {String}

    Sprite identifier defined with the method "set" (or the constructor)

  • (optional) {String}

    repeatOption Type of repetition (repeat (default), no-repeat, repeat-x, repeat-y)

Example

In "ready" method of the current scene :

var spritesheet = canvas.Spritesheet.new("my_spritesheet"),
    el = this.createElement();
spritesheet.set({
    grid: [{
        size: [3, 1],
        tile: [32, 32],
        set: ["border", "foo", "bar"]
    }]
});
spritesheet.pattern(el, "border");
el.fillRect(0, 0, 300, 32);
stage.append(el);

Discussion