11 - Rotation Matrix/script.js
//keeps the value true as long as the key is pressed

keeps the value true as long as the key is pressed
keeps the value true as long as the key is pressed
function userInput(){
    canvas.addEventListener('keydown', function(e){
        if(e.keyCode === 37){
            LEFT = true;
        }
        if(e.keyCode === 38){
            UP = true;
        }
        if(e.keyCode === 39){
            RIGHT = true;
        }
        if(e.keyCode === 40){
            DOWN = true;
        }
    });
    canvas.addEventListener('keyup', function(e){
        if(e.keyCode === 37){
            LEFT = false;
        }
        if(e.keyCode === 38){
            UP = false;
        }
        if(e.keyCode === 39){
            RIGHT = false;
        }
        if(e.keyCode === 40){
            DOWN = false;
        }
    });    
}
function userInput ( ) { canvas . addEventListener ( 'keydown' , function ( e ) { if ( e . keyCode === 37 ) { LEFT = true ; } if ( e . keyCode === 38 ) { UP = true ; } if ( e . keyCode === 39 ) { RIGHT = true ; } if ( e . keyCode === 40 ) { DOWN = true ; } } ) ; canvas . addEventListener ( 'keyup' , function ( e ) { if ( e . keyCode === 37 ) { LEFT = false ; } if ( e . keyCode === 38 ) { UP = false ; } if ( e . keyCode === 39 ) { RIGHT = false ; } if ( e . keyCode === 40 ) { DOWN = false ; } } ) ; }
keeps the value true as long as the key is pressed
keeps the value true as long as the key is pressed