function bindKeyboardControls() {
        Mousetrap.bind(['w', 'a', 's', 'd'], function (e, key) {

            keyDown = keyDown ? ++keyDown : 1;

            var validKey = true;

            switch (key) {
            case 'w':
                camera.goForwards(keyDown);
                break;
            case 'a':
                camera.goLeft(keyDown);
                break;
            case 's':
                camera.goBackwards(keyDown);
                break;
            case 'd':
                camera.goRight(keyDown);
                break;
            default:
                validKey = false;
            }

            if (validKey) {
                triggerAnimation();
            }

        }, 'keydown');

        Mousetrap.bind(['w', 'a', 's', 'd'], function (e, key) {
            keyDown = false;
        }, 'keyup');

        Mousetrap.bind(['f'], function (e, key) {
            camera.toggleFullScreen();
            triggerAnimation();
        }, 'keydown');

        Mousetrap.bind(['p'], function (e, key) {
            paused = !paused;
        }, 'keydown');

        Mousetrap.bind(['r'], function (e, key) {
            camera.resetPosition();
            triggerAnimation();
        }, 'keydown');
    }
/**
     * Binds some key events to handler functions.
     * @method bindKeyboardControls
     */
Binds some key events to handler functions.
Binds some key events to handler functions .
function bindKeyboardControls() {
        Mousetrap.bind(['w', 'a', 's', 'd'], function (e, key) {
            keyDown = keyDown ? ++keyDown : 1;
            var validKey = true;
            switch (key) {
            case 'w':
                camera.goForwards(keyDown);
                break;
            case 'a':
                camera.goLeft(keyDown);
                break;
            case 's':
                camera.goBackwards(keyDown);
                break;
            case 'd':
                camera.goRight(keyDown);
                break;
            default:
                validKey = false;
            }
            if (validKey) {
                triggerAnimation();
            }
        }, 'keydown');
        Mousetrap.bind(['w', 'a', 's', 'd'], function (e, key) {
            keyDown = false;
        }, 'keyup');
        Mousetrap.bind(['f'], function (e, key) {
            camera.toggleFullScreen();
            triggerAnimation();
        }, 'keydown');
        Mousetrap.bind(['p'], function (e, key) {
            paused = !paused;
        }, 'keydown');
        Mousetrap.bind(['r'], function (e, key) {
            camera.resetPosition();
            triggerAnimation();
        }, 'keydown');
    }
function bindKeyboardControls ( ) { Mousetrap . bind ( [ 'w' , 'a' , 's' , 'd' ] , function ( e , key ) { keyDown = keyDown ? ++ keyDown : 1 ; var validKey = true ; switch ( key ) { case 'w' : camera . goForwards ( keyDown ) ; break ; case 'a' : camera . goLeft ( keyDown ) ; break ; case 's' : camera . goBackwards ( keyDown ) ; break ; case 'd' : camera . goRight ( keyDown ) ; break ; default : validKey = false ; } if ( validKey ) { triggerAnimation ( ) ; } } , 'keydown' ) ; Mousetrap . bind ( [ 'w' , 'a' , 's' , 'd' ] , function ( e , key ) { keyDown = false ; } , 'keyup' ) ; Mousetrap . bind ( [ 'f' ] , function ( e , key ) { camera . toggleFullScreen ( ) ; triggerAnimation ( ) ; } , 'keydown' ) ; Mousetrap . bind ( [ 'p' ] , function ( e , key ) { paused = ! paused ; } , 'keydown' ) ; Mousetrap . bind ( [ 'r' ] , function ( e , key ) { camera . resetPosition ( ) ; triggerAnimation ( ) ; } , 'keydown' ) ; }
Binds some key events to handler functions.
Binds some key events to handler functions .