spherecylinder.js
/**
 *  An event listener for the keydown event.  It is installed by the init() function.
 */
An event listener for the keydown event.  It is installed by the init() function.
An event listener for the keydown event . It is installed by the init () function .
function doKey(evt) {
    var translationChanged = true;
    switch (evt.keyCode) {
        case 37: Y -= 0.5; break;        
        case 39: Y += 0.5; break;       
        case 38: X -= 0.5; break;        
        case 40: X += 0.5; break;        
        case 13: X = Y = 0; break;  
        case 36: X = Y = 0; break;  
        default: translationChanged = false;
    }
    if (translationChanged) {
        evt.preventDefault();
        render();
        theta -= 0.5;  
    }
}
function doKey ( evt ) { var translationChanged = true ; switch ( evt . keyCode ) { case 37 : Y -= 0.5 ; break ; case 39 : Y += 0.5 ; break ; case 38 : X -= 0.5 ; break ; case 40 : X += 0.5 ; break ; case 13 : X = Y = 0 ; break ; case 36 : X = Y = 0 ; break ; default : translationChanged = false ; } if ( translationChanged ) { evt . preventDefault ( ) ; render ( ) ; theta -= 0.5 ; } }
An event listener for the keydown event.
An event listener for the keydown event .
// left arrow // right arrow // up arrow // down arrow // return // home //*** theta must be decremented to compensate for the increment caused by the render callback (every 0.1 sec)