Fireworks
Fireworks copied to clipboard
Background Image
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
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.