Change c2canvas background

For developers using the Construct 2 Javascript SDK

Post » Mon Feb 15, 2016 12:47 am

I've made the bottom layer transparent and tried the following code.
I can see the image appears briefly but then disappears.
So, is it possible to load an image into and change the c2canvas background through javascript?

Code: Select all
var canvas = document.getElementById('c2canvas'),
context = canvas.getContext('2d');
function make_base()
  base_image = new Image();
  base_image.src = 'icon-256.png';
  base_image.onload = function(){
    context.drawImage(base_image, 100, 100);
Posts: 146
Reputation: 1,150

Return to Javascript SDK

Who is online

Users browsing this forum: No registered users and 0 guests