Draw an image with or without repeating (tiling).
public this .image(String url[, String repeat])
Draw specified image. Repeat follows CSS syntax ("no-repeat", "repeat", "repeat-x", "repeat-y"
);
Note: Default repeat is no-repeat
which is different to standard DOM (which is repeat
)
If the width and height are 0
and repeat is set to no-repeat
the width and
height will automatically assume that of the image. This is an
easy way to create an image without needing sprites.
Will default to no-repeat. Entity width and height will be set to the images width and height
var ent = Crafty.e("2D, DOM, Image").image("myimage.png");
Create a repeating background.
var bg = Crafty.e("2D, DOM, Image")
.attr({w: Crafty.viewport.width, h: Crafty.viewport.height})
.image("bg.png", "repeat");