JS: Why isn't this variable available to the other functions?
- by Marius Jonsson
Hello there,
I've am trying to make a canvas animation:
var context;
var meter;
var pin;
function init() {
var meter = new Image();
var pin = new Image();
var context = document.getElementById('canvas').getContext('2d');
meter.src = 'background.png';
pin.src = 'needle.png';
context.drawImage(meter,0,0);
…