I am very new to javascript and paperscript so someone else may
provide a much better solution. Based on the docs, if you want to
repeat a lot of something but not access each one individually later,
the use of symbols is recommended since they perform much better. I
also found the the size of the image does not get inherited by tile
unless the src is set before creating the raster.
var img = new Image();
// src must be set before raster for tile to have dimension of image
img.src = '
http://placehold.it/10x150/225522/225522';
var tile = new Raster(img);
// Create a symbol from the raster and remove tile from the view:
var symbol = new Symbol(tile);
tile.remove();
img.onload = function() {
for (var i = 0; i < view.size.width / tile.width; i++) {
for (var j = 0; j < view.size.height / tile.height; j++) {
var instance = new PlacedSymbol(tile);
instance.position = new Point(tile.width * i, tile.height
* j);
};
};
view.draw();
};
you can see it working here with a placeholder image:
http://jsfiddle.net/dansalmo/EjSFu/
On Jun 9, 9:19 pm, Emmanuel Bourmault <
shadowbo...@gmail.com> wrote:
> What I need is like on this example the "Scaling" part.
https://developer.mozilla.org/en/Canvas_tutorial/Using_images