Fireworks icon indicating copy to clipboard operation
Fireworks copied to clipboard

Background Image

Open syedrazanaqvi opened this issue 9 years ago • 1 comments

I was trying to add background image to your awesome script but not successful can you please help me ?

I want full screen size background image on created canvas. Thanks

syedrazanaqvi avatar Aug 26 '15 11:08 syedrazanaqvi

I know it has been 2 years and this probably no longer applies to you, but I was able to use this with my own background image.

When the clearContext is called I had it do this:

var img = new Image(); // Create new img element
img.src = insert link to image here;
var ptrn = mainContext.createPattern(img, 'repeat'); // Create a pattern with this image, and set it to "repeat".
mainContext.globalAlpha = 0.4;
mainContext.fillStyle = ptrn;
mainContext.fillRect(0, 0, viewportWidth, viewportHeight);

This worked well for me. The only issue i noticed is that you can faintly see some of the previous particles on the canvas. To fix this, I would adjust the globalAlpha accordingly.

jmp1548 avatar Dec 30 '17 03:12 jmp1548