Christian Memije Christian Memije - 6 months ago 66
Javascript Question

Set an image to fill the canvas using Paper.js

I have an image that has the same aspect ratio as the canvas but a different resolution. I know I can make use of the view size,

view.viewSize
, but my trouble is setting the dimensions of the image. I have tried setting the width using
raster.width = 2000;
, for example, but it does not seem to work.

Answer

This ended up working for me.

raster.size = paper.view.viewSize;
raster.position = paper.view.center;